如何在RISC-V Linux中添加系统调用?

发布于 2025-01-15 13:17:46 字数 325 浏览 3 评论 0 原文

关于如何向针对 x86 的 Linux 添加系统调用有详细的文档,例如有一个文件 /arch/x86/entry/syscalls/syscall_64.tbl

我在/arch/riscv下搜索了目录entry但没有找到。我尝试查找/arch/riscv下是否有以.tbl结尾的文件,但仍然没有找到任何东西。

是否有任何有用的资源来描述 RISC-V Linux 如何处理系统调用以及我们如何向其中添加我们自己的系统调用?或者我们可以忽略 syscall_64.tbl 文件?

It is well-documented on how to add a system call to Linux targeting x86, e.g. there is a file /arch/x86/entry/syscalls/syscall_64.tbl.

I searched for the directory entry under /arch/riscv but did not find it. I tried to find if there is a file ends with .tbl under /arch/riscv but still did not find anything.

Is there any useful resource that describes how RISC-V Linux handles the system call and how we could add our own system calls to it? Or we could just ignore the syscall_64.tbl file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

茶色山野 2025-01-22 13:17:46

感谢@oakad 的评论。我没有尝试这种方法,但发现了一种有用的 文章讨论此问题:

某些体系结构(例如 x86)有自己的特定于体系结构的系统调用表,但其他几种体系结构共享通用系统调用表。通过向 include/uapi/asm-generic/unistd.h 中的列表添加条目,将新系统调用添加到通用列表中

添加到 riscv 与 x86 类似,只是 riscv 没有系统调用表。因此,无需添加到 riscv 表中。对于其余步骤,请按照此 链接

Thanks @oakad's comment. I did not try that approach, but found one useful article that discusses about this:

Some architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in include/uapi/asm-generic/unistd.h

Adding to riscv is similar to x86, except that riscv does not have a syscall table. Hence, no need to add to the table for riscv. For the rest of the steps, follow this link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文