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

查看:25
本文介绍了可以将超过七个参数传递给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 的最大参数数.是否可以传递更多参数?

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天全站免登陆