SPARC 窗口溢出

发布于 2024-10-06 12:41:19 字数 766 浏览 0 评论 0原文

假设我有 8 个像下图这样的窗口: http://www.sics.se/~psm/ sparcwin.gif

我就在这种情况下,WIM 指向 w7,而我在窗口 w0 中。

假设在此窗口中,我将调用某个接收一个参数的函数。所以我将参数值设置为%o1(让函数在%i0中接收它)。

好的,然后我拨打电话,该函数会执行“保存”操作。该窗口位中的 WIM 为 1,因此会触发 window_overflow。我对此的理解是,处理程序保存在窗口 w7 (%sp) 的堆栈上,寄存器 %i1,..,%i7,%l0,..,%l7,以便让“返回时”在 window_underflow 中恢复该窗口。

我的问题是...当保存窗口时,w7的原始%i0,...,%i7现在丢失了,是w0中的程序调用的函数的参数(因为我设置了%o0,. . 在调用之前在 w0 中然后进行“保存”故障)。所以这个“系统”没有意义,所以我想我错过了一些东西。

另一个类似的问题。假设我在 w0 中的程序不调用函数,而是使用 %o0,%o1,.. 作为“局部”变量,我什至不知道我杀死了 w7 的 %i0,%i1,..,也会遇到同样的问题。

解答:我发现无效的窗口已经保存在堆栈中,因此当“保存”完成时,window_overflow 处理程序会将 w6 保存在堆栈中(并将 WIM 设置为 w6)。这显然解释了我的问题。我想当我看到这个陷阱的处理程序示例时我很困惑,并且不记得在 V8 中它总是递减 CWP 而不检查 WIM。

Suppose I have 8 windows like this figure: http://www.sics.se/~psm/sparcwin.gif

And I'm right in that situation, WIM points to w7, and I'm in window w0.

Suppose that in this window, I'm going to call some function that recives one parameter. So I set the parameter value to %o1 (to let the function recive it in %i0).

Ok, then I make the call, and the function does a 'save'. WIM in that window bit is 1, so a window_overflow is triggered. What I understood about this, is that the handler save on the stack of window w7 (%sp), the registers %i1,..,%i7,%l0,..,%l7, to let then 'when going back' in the window_underflow recover that window.

My question is... when the window is saved, the originals %i0,...,%i7 of w7 where lost due to now are the parameters of the function that the program in w0 called (because I set %o0,.. in w0 before calling and then make the 'save' fault). So this "system" does not make sense, so I guess I'm missing something.

Another similar question. Suppose my program in w0 does not call a function, but use %o0,%o1,.. as "local" variables, I would have the same problem without even know that I killed %i0,%i1,.. of w7.

ANSWER: I found that the invalid windows is already saved in the stack, so when the 'save' is done, the window_overflow handler would save w6 in the stack (and set WIM to w6). This obviously explains all about my question. I guess I confused myselft when seeing an handler example of this trap and not remembering that in V8 it always decrements CWP without checking WIM.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文