Re: longjmp question

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

 



From: Jurij Smakov <jurij@xxxxxxxxx>
Date: Sat, 22 Oct 2011 10:43:39 +0100

> On Sat, Oct 22, 2011 at 05:05:05AM -0400, David Miller wrote:
>> From: Jurij Smakov <jurij@xxxxxxxxx>
>> Date: Sat, 22 Oct 2011 10:00:24 +0100
>> 
>> > Is something conceptually wrong with just doing this:
>> > 
>> > asm volatile ("save; flush; restore");
>> > 
>> > It fixes the problem for freebsd (will test on linux later today), and 
>> > does not rely on compiler doing (or not doing) the "right" 
>> > optimization.
>> 
>> I would not do a "naked" save here, please just use the construct
>> I showed you with the %o7 register clobber.
> 
> Yes, I missed that save is not allocating any memory, which is 
> wrong. What I actually had in mind was this:
> 
> asm volatile ("save %sp, -96, %sp; flushw; restore");

Only works on 32-bit, will crash on 64-bit.

Just let the compiler do it for you, please... the compiler absolutely cannot
optimize away a function that uses a volatile asm statement.  And it absolutely
cannot make a function that clobbers %o7 a leaf function.

Please just use the approach I suggested, it covers all cases and is in fact
future proof.

--
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


[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux