xenia-project / xenia

Xbox 360 Emulator Research Project
https://xenia.jp
Other
7.87k stars 1.11k forks source link

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

Closed guccigang420 closed 9 months ago

guccigang420 commented 9 months ago

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. Additionally, if "AllocFixed" is called with a nullptr base_address, the MAP_FIXED flag should not be used.

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