在Arm Linux中调用mmap syscall

问题描述 投票:0回答:1

根据此表https://syscalls.w3challs.com/?arch=arm_strong我想用寄存器调用mmap syscall。

r7需要获取0x90005a

r0需要获得struct mmap_arg_struct *arg

arm linux头文件中的那个结构在哪里,所以我可以在eclipse中包含它?

有没有示例如何在Arm Linux中与这些参数进行映射?

或者使用mmap可能更好,而不是在mmap2手册页中看到This is probably not the system call that you are interested in; instead, see mmap(2), which describes the glibc wrapper function that invokes this system call

例如,当我想调用write syscall时:r7需要获取0x900004,r0需要获取fd,r1需要获取buf,r2需要获取计数。

c linux arm system-calls mmap
1个回答
0
投票

在链接的站点上,仅显示内核中syscall的内部实现和接口。您需要使用公共接口:

void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);

因此您需要6个参数和系统调用号:

  • r0:addr
  • r1:length
  • r2:prot
  • r3:flags
  • r4:fd
  • r5:offset
  • r7:系统调用号__NR_mmap

然后用swi 0x0调用系统调用。

有关参数的语义,请参见例如the mmap manpage宏的实际值可以在sys/mman.h

中找到
© www.soinside.com 2019 - 2024. All rights reserved.