Re: How to inform gcc not to save registers on entering a function?

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

 



PRC wrote:
> Hi All,
> I want to implement an exception handler on MIPS.
> First, I will save all registers on the entry of the exception handler written 
> in assembly. And then I will jump to another exception handler written in C.
> 
> ------------------------------------------------
> exc_handler:
>   SAVE_ALL_GPRS
>   j exc_handler_c
>   ...
> 
> void exc_handler_c()
> {
>   ...
> }
> ------------------------------------------------
> 
> When I check the un-assembly list file, I find gcc still saves used registers
> at the begin of function exc_handler_c.
> ------------------------------------------------
> 8000d1e4:	27bdffd8 	addiu	sp,sp,-40
> 8000d1e8:	afb10014 	sw	s1,20(sp)
> 8000d1ec:	afbf0024 	sw	ra,36(sp)
> 8000d1f0:	afb40020 	sw	s4,32(sp)
> 8000d1f4:	afb3001c 	sw	s3,28(sp)
> 8000d1f8:	afb20018 	sw	s2,24(sp)
> 8000d1fc:	afb00010 	sw	s0,16(sp)
> ...
> ------------------------------------------------
> It is uneccessary at all since all registers have been saved before entering the function
> and will be restored after leaving the function.
> 
> So how can I inform gcc not to save the registers on entering the funcion?
> 

I don't think it is possible.

Unless you want to modify the compiler, you have to live with it correctly implementing the ABI.

David Daney

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux