Re: longjmp question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Jurij Smakov <jurij@xxxxxxxxx>
Date: Sat, 8 Oct 2011 13:55:35 +0100

> On Sat, Oct 08, 2011 at 02:43:55AM -0400, David Miller wrote:
>> @@ -67,15 +67,13 @@ LOC(thread):
>>  #ifdef PTR_DEMANGLE
>>  	ld	ENV(g1,JB_PC), %g5 /* Set return PC. */
>>  	ld	ENV(g1,JB_SP), %g1 /* Set saved SP on restore below. */
>> -	PTR_DEMANGLE2 (%o7, %g5, %g4)
>> +	PTR_DEMANGLE2 (%i7, %g5, %g4)
>>  	PTR_DEMANGLE2 (%fp, %g1, %g4)
>>  #else
>> -	ld	ENV(g1,JB_PC), %o7 /* Set return PC. */
>> +	ld	ENV(g1,JB_PC), %i7 /* Set return PC. */
>>  	ld	ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */
>>  #endif
>> -	sub	%fp, 64, %sp	/* Allocate a register frame. */
>> -	st	%g3, RW_FP	/* Set saved FP on restore below. */
>> -	retl
>> +	jmp	%i7 + 8
>>  	 restore %g2, 0, %o0	/* Restore values from above register frame. */
> 
> I don't really see anything in the code which would ensure that after 
> we execute this restore, fp is going to be set to target fp value 
> (available as ENV(g1,JB_FP) or g3. It might be the responsibility of 
> the unwinding part, but then it would not explain why such code was 
> explicitly present in the old version.

Because the restore traps, causing a window fill, and that trap
handler will load up the register window at JB_SP, inside of which
JB_FP is contained.

The only reason we store JB_FP is for the implementation the optimized
longjmp loop.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux MIPS Home]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite News]     [MIPS Architecture]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux