In aarch32, more precisely the ARM-OABI, the immediate value of swi
was still used to transfer the syscall number. In ARM-EABI, on the other hand, a register is used instead. swi #0
then indicates that a register should be used.
This option is no longer available in aarch64, so I use this combination all the time:
mov x8, syscall_number
svc #0
Why do I have to add an additional 4 bytes of code size here and the immediate value remains unused this time?
According to the ARM Programmer's Guide, the immediate value is stored in the Exception Syndrome Register ESR_EL
and should therefore be readable with mrs
. Or is that already a too big loss of performance?
References: