Hello Samuel and Sergey,

I'm working on the loongarch64 port of mach and would like to discuss
the syscall ABI.

Linux loongarch use $a7(r11) to hold the syscall number, because linux
only have 6 arguments. But some syscall in mach has more than 8
arguments like vm_map has 11.

I see sergey's implement in aarch64, it use w8 to specify the syscall
number so there are 8 arguments will pass to reg and 3 will place in the
stack.

I'm considering to use the $t0(r12) to follow the Loongarch abi
recommendation to pass as many arguments in reg as possible, I've
communicate with LoongArch engineer, he advised not to use $t0 because
it might be overwritten.

On the other hand, if we use $a7, vm_map() would need one additional
register move: we would have to move the original value of $a7 to the
stack before putting the syscall number in $a7.

What do you think would be the better approach? :)

-- 
Donjuanplatinum, Yifei Yao <[email protected]> GPG: 1C9E EEE5 4C8E
D5A8 3039 1C87 A9F6 8632 D259 40E6满堂兮美人 忽独与余兮目成

Reply via email to