根据此表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需要获取计数。
在链接的站点上,仅显示内核中syscall的内部实现和接口。您需要使用公共接口:
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
因此您需要6个参数和系统调用号:
addr
length
prot
flags
fd
offset
__NR_mmap
然后用swi 0x0
调用系统调用。
有关参数的语义,请参见例如the mmap manpage宏的实际值可以在sys/mman.h
中找到