macOS 64位系统调用表 [英] macOS 64-bit System Call Table

查看:149
本文介绍了macOS 64位系统调用表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以找到一个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相同.参数分别通过rdirsirdxr10r8r9寄存器传递. 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屋!

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