[PATCH] mips/o32: fix internal_syscall5/6/7

Maciej W. Rozycki macro@imgtec.com
Wed Aug 16 14:47:00 GMT 2017


On Wed, 16 Aug 2017, Adhemerval Zanella wrote:

> +ENTRY(__libc_do_syscall)
> +        move    $2, $4
> +        move    $4, $5
> +        move    $5, $6
> +        move    $6, $7

 I'm not very keen on having a nested syscall function call, but if you do 
that, then please at least arrange the wrapper's arguments such that you 
don't have to shuffle them, i.e. I suggest placing the syscall number 
last.

 For historical reasons you may want to initialise $2 right before the 
SYSCALL instruction, although I take it we don't anymore support Linux 
kernels old enough to require it for the syscall restart convention (so it 
would mainly serve as a reference for those who need to write their own 
code supporting those old kernels, as people often blindly copy & paste 
existing pieces).

 Also the MIPS16 wrappers may require adjustment then in order not to 
execute a doubly nested function call unnecessarily, i.e. call 
`__libc_do_syscall' directly rather than through another wrapper.

  Maciej



More information about the Libc-alpha mailing list