Re: Is r25 saved across syscalls?

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

 



On Mon, 10 Sep 2012, Rich Felker wrote:

> As for my problem, I can use r7 as the temp ("move $2,$7 ; syscall")
> for syscalls with 3 or fewer args, but for the 4-arg syscall, $7 is
> occupied by an argument, and I'd need to spill the syscall number to
> the stack to be able to restore it if $25 is not available...

 If performance or some other factors require you to avoid spilling the 
syscall number to the stack or other readily-accessible (e.g. GP-relative) 
memory and the number is not a constant you could load with LI, then you 
can always store it in a call-saved register, one of $s0-$s8, that are 
guaranteed by the syscall ABI to be preserved across.

 Relying on any call-clobbered registers, including $7 to be preserved 
across a syscall is risky, to say the least, as this is not guaranteed by 
the syscall ABI.  I do wonder however why we have these instructions to 
save/restore $25 in SAVE_SOME/RESTORE_SOME.  This dates back to 2.4 at the 
very least.

 Ralf, any insights?

  Maciej



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux