<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Tony,<BR>
 <BR>
Does this seem correct?<BR>
 <BR><SPAN lang=EN>
PROCEDURE SignalHandler (sig: int) =<BR>
VAR<BR>
...<BR>
old:<BR>
 <BR>
me.sp := SaveRegsInStack();<BR>
IF me.sp = NIL THEN me.sp := ADR(xx) END;<BR>
new:<BR>
 <BR>
SaveRegsInStack(); (* no return value *)<BR>
me.sp := ADR(xx); (* unconditional *)<BR>
</SPAN> <BR>
 <BR>
 <BR><SPAN lang=EN>
void ThreadPThread__SaveRegsInStack(void)<BR>
{<BR>
#ifdef M3_REGISTER_WINDOWS<BR>
/* On "register window" architectures, setjmp/longjmp tends<BR>
to flush registers to the stack in a fairly portable not<BR>
too inefficient fashion, and saves us the need for<BR>
gnarly assembly. (ta 3 on Sparc, flushrs on IA64)<BR>
*/<BR>
jmp_buf jb;<BR>
if (setjmp(jb) == 0) longjmp(jb, 1);<BR>
#endif<BR>
}<BR></SPAN>
 <BR>
 <BR>
You know -- was the stack pointer returned by SaveRegsInStack before really better/different than just ADR(xx)?<BR>
 <BR>
 <BR>
Consider:<BR>
 <BR>
#   if defined(__arch64__) || defined(__sparcv9)<BR>      asm("     save        %sp,-128,%sp");<BR>      asm("     flushw");<BR>      asm("     ret");<BR>      asm("     restore %sp,2047+128,%o0");<BR>#   else<BR>asm("     ta      0x3   ! ST_FLUSH_WINDOWS");<BR>      asm("     retl");<BR>      asm("     mov     %sp,%o0");<BR>#   endif<BR>
 <BR>
 <BR>
on 32bit, it just returns the unchanged %sp of its caller.<BR>
On 64bit, I suspect kind of the same thing, though I don't know what the 128 or 2047 are. 2047 is probably some "bias" builtin to the register and 128 I guess is required for flushw??<BR>
 <BR>
 <BR>
 - Jay<BR><BR><BR><BR>                                       </body>
</html>