Can more than seven arguments be passed to system call in arm linux?

一世执手 提交于 2019-12-11 16:55:38

问题


In arm linux(EABI), system call number is passed in r7 and the arguments can be passed in r0-r6 registers

Below table from (syscall(2)) shows the registers used to pass the system call arguments.

   arch/ABI      arg1  arg2  arg3  arg4  arg5  arg6  arg7  Notes
   ──────────────────────────────────────────────────────────────
   alpha         a0    a1    a2    a3    a4    a5    -
   arc           r0    r1    r2    r3    r4    r5    -
   arm/OABI      a1    a2    a3    a4    v1    v2    v3
   arm/EABI      r0    r1    r2    r3    r4    r5    r6

I am just curious whether seven is the maximum number of arguments that can be passed to arm linux in a system call. Is it possible to pass more arguments ?


回答1:


For system calls passing more than 3-4 arguments is normally a plus. The reason for using registers in passing arguments to a system call is that normally, in switching to kernel mode, you change the stack, so you have to access the parameters stored in the user stack by using poor efficiency means. When you need to pass more info than what fits in 7 registers, then you normally pass a pointer to a structure that has all the information (probably you have already seen this with some system calls in the system you use)

For normal procedure calls the stack is always there, so the maximum number of parameters is not an issue.



来源:https://stackoverflow.com/questions/53903726/can-more-than-seven-arguments-be-passed-to-system-call-in-arm-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!