macOS 64位系统调用表 [英] macOS 64-bit System Call Table
问题描述
我可以找到一个Linux 64位系统调用表,但是该调用号在macOS上不起作用-每当尝试使用它们时,都会得到一个Bus Error: 10
.
I can find a Linux 64-bit system call table, but the call numbers do not work on macOS - I get a Bus Error: 10
whenever I try to use them.
用于sys_write
之类的操作的macOS呼叫号码是什么?
What are the macOS call numbers for operations like sys_write
?
推荐答案
您需要使用syscalls.master
文件将0x2000000
添加到电话号码中.我正在使用 XNU bds/kern/syscalls.master
文件一个>.这是我要调用的syscalls.master
文件中的一个函数:
You need to add 0x2000000
to the call number using a syscalls.master
file. I'm using the XNU bds/kern/syscalls.master
file. Here's a function in the syscalls.master
file that I'm going to call:
4 AUE_NULL ALL { user_ssize_t write(int fd, user_addr_t cbuf, user_size_t nbyte); }
就将参数传递给哪个寄存器而言,它与64位Linux相同.参数分别通过rdi
,rsi
,rdx
,r10
,r8
和r9
寄存器传递. write
函数采用三个参数,这些参数在以下程序集中进行描述:
In terms of which registers to pass arguments to, it's the same as 64-bit Linux. Arguments are passed through the rdi
, rsi
, rdx
, r10
, r8
and r9
registers, respectively. The write
function takes three arguments, which are described in the following assembly:
mov rax, 0x2000004 ; sys_write call identifier
mov rdi, 1 ; STDOUT file descriptor
mov rsi, myMessage ; buffer to print
mov rdx, myMessageLen ; length of buffer
syscall ; make the system call
这篇关于macOS 64位系统调用表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!