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

[LINUX/CPU/BASE] Added System-V ABI support in x64 backend & fixed mmap initialization #2228

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

Conversation

guccigang420
Copy link

@guccigang420 guccigang420 commented Sep 25, 2023

Current thunks in x64_backend.cc assumed that the calling convention is Microsoft ABI. Added an implementation for the System-V ABI which is used in Unix(-like) systems (Linux/MacOS/FreeBSD/etc).

When memory mapping a file, we should ensure it is large enough.

See:
https://wiki.osdev.org/System_V_ABI
https://man7.org/linux/man-pages/man2/mmap.2.html

@guccigang420 guccigang420 changed the title [LINUX/CPU/BASE] Added System-V ABI support in x64 backend & fixed mmap usage [LINUX/CPU/BASE] Added System-V ABI support in x64 backend & fixed mmap initialization Sep 30, 2023
@ashquarky
Copy link

This was required for me to get the CPU to work at all on Linux, before it was jumping to a random address due to the mismatched function arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants