Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

ABI文档中没有syscall寄存器约定 #66

Open
XiaodongLoong opened this issue Aug 19, 2022 · 6 comments
Open

ABI文档中没有syscall寄存器约定 #66

XiaodongLoong opened this issue Aug 19, 2022 · 6 comments
Labels
documentation Improvements or additions to documentation

Comments

@XiaodongLoong
Copy link

Describe the question:

C库或者一些系统调用相关的库函数在实现时需要知道向内核参数传递的寄存器约定和寄存器里面的值的销毁情况。目前ABI文档中没有这样的描述。

Describe the idea:

Additional context:

@xen0n
Copy link
Contributor

xen0n commented Aug 19, 2022

不同内核的 syscall ABI 不一样,倒是可以在 Linux docs 补充这些信息

@FreeFlyingSheep
Copy link
Collaborator

目前 LoongArch 的系统调用寄存器约定和普通的函数调用一样。

@XiaodongLoong
Copy link
Author

目前 LoongArch 的系统调用寄存器约定和普通的函数调用一样。

syscall返回值里面应该不会使用多个寄存器,但是函数调用中会这种情况发生。我建议单独列出来,比较清楚,不容易混淆。

@XiaodongLoong XiaodongLoong added the documentation Improvements or additions to documentation label Aug 19, 2022
@xen0n
Copy link
Contributor

xen0n commented Aug 19, 2022

目前 LoongArch 的系统调用寄存器约定和普通的函数调用一样。

不一样,Linux/LoongArch 系统调用确保除了九个临时寄存器之外其他寄存器不被 clobber。正常寄存器约定里 a1-a7 也会给 clobber 掉。

@FreeFlyingSheep
Copy link
Collaborator

See #67.

@xen0n
Copy link
Contributor

xen0n commented Oct 18, 2022

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants