可以在arm linux中将七个以上的参数传递给系统调用吗? [英] Can more than seven arguments be passed to system call in arm linux?

查看:95
本文介绍了可以在arm linux中将七个以上的参数传递给系统调用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在arm linux(EABI)中,系统调用号在r7中传递,并且参数可以在r0-r6寄存器中传递

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

下表来自( syscall(2))显示用于传递系统调用的寄存器 争论.

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

我很好奇,是否可以在系统调用中传递给arm linux的最大参数数目是7.是否可以传递更多参数?

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 ?

推荐答案

对于系统调用,传递超过3-4个参数通常是一个加号.在将参数传递给系统调用时使用寄存器的原因通常是,在切换到内核模式时,您更改了堆栈,因此必须使用效率低下的方法来访问存储在用户堆栈中的参数.如果您需要传递的信息超出了7个寄存器所能容纳的范围,那么通常将指针传递给具有所有信息的结构(可能您已经在所使用的系统中通过一些系统调用看到了此信息)

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.

这篇关于可以在arm linux中将七个以上的参数传递给系统调用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆