Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calling convention and return value #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kawaii-ghost
Copy link

@kawaii-ghost kawaii-ghost commented Nov 1, 2022

System Call calling convention on System V x86-64 parameter is r10 while the usespace function calling convention is rcx.

Actually, Linux system call is return 128 bit (x86-64), 64 bit (i386) value.
RDX as upper bits and EDX as upper bits. They're not changed if the value if rax / eax is enough to hold the return value.

System V x86-64 ABI System Call calling convention for param3 is r10 while Userspace calling convention for param3 is rcx.

Actually, rdx:rax are used to return 128 bit value or edx:eax are used to return 64 bit value.

Ref : man syscall and System V ABI docs
Fix calling convention and return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant