forcing gcc to save all caller saved registers

Andrew Haley aph@redhat.com
Sat Nov 23 12:15:00 GMT 2002


Dietmar Maurer writes:
 > Hi all,
 > 
 > is there a way to force gcc to save/restore all caller saved registers
 > in the prolog/epilog.
 > 
 > I currently use the following code to accomplish that (on x86):
 > 
 > a_func ()
 > {
 > 	asm("" : : : "%esi", "%edi", "%ebx");
 > 
 > 	...
 > }
 > 
 > 
 > That way gcc save/restores all caller saved regs and generates exception
 > tables able to restore all those registers (when compiled with
 > -fextections)
 > 
 > Is there any other way to accomplish the same result?

Calling __builtin_setjmp() may do what you need.

Andrew.



More information about the Gcc mailing list