mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 09:00:40 +02:00
Merge pull request #1656 from Sonicadvance1/v5.17_support
V5.17 support
This commit is contained in:
11 files changed
+46
-7
No files matched your search
Vendored
+1
-1
Submodule External/drm-headers updated: 4d7eed48e8...3d23966687.
@@ -6,6 +6,16 @@ import logging
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.WARNING)
|
||||
|
||||
# Usage of this script is `Scripts/GenerateSyscallNumbers.py <Path to Linux directory>`
|
||||
# This will then parse the syscall headers and format them in an enum
|
||||
# Then this will be output in stdout
|
||||
# This output should then be checked and copied to the following headers, splitting up the enums:
|
||||
# - Source/Tests/LinuxSyscalls/x32/SyscallsEnum.h
|
||||
# - Source/Tests/LinuxSyscalls/x64/SyscallsEnum.h
|
||||
# - Source/Tests/LinuxSyscalls/Arm64/SyscallsEnum.h
|
||||
# `FEX_Syscalls_Common` is provided in the output as just an indicator for which syscalls are using the common
|
||||
# syscall interface.
|
||||
|
||||
@dataclass
|
||||
class SyscallDefinition:
|
||||
arch: str
|
||||
@@ -44,6 +54,14 @@ Syscallx64File = "/arch/x86/entry/syscalls/syscall_64.tbl"
|
||||
Syscallx86File = "/arch/x86/entry/syscalls/syscall_32.tbl"
|
||||
SyscallArm64File = "/include/uapi/asm-generic/unistd.h"
|
||||
|
||||
# Syscall names that had naming conflict with some global definitions
|
||||
# Renamed to work around that issue
|
||||
DefinitionRenameDict = {
|
||||
"pread64": "pread_64",
|
||||
"pwrite64": "pwrite_64",
|
||||
"prlimit64": "prlimit_64"
|
||||
}
|
||||
|
||||
Definitions_x64 = []
|
||||
Definitions_x64_dict = {}
|
||||
Definitions_x86 = []
|
||||
@@ -86,6 +104,9 @@ def ParseArchSyscalls(Defs, DefsDict, Arch, FilePath, IgnoreArch):
|
||||
else:
|
||||
EntryName = split_text[3]
|
||||
|
||||
if Name in DefinitionRenameDict:
|
||||
Name = DefinitionRenameDict[Name]
|
||||
|
||||
Def = SyscallDefinition(Arch, Num, ABI, Name, EntryName)
|
||||
|
||||
Defs.append(Def)
|
||||
@@ -154,6 +175,9 @@ def ParseCommonArchSyscalls(Defs, DefsDict, Arch, FilePath):
|
||||
ABI = Arch
|
||||
EntryName = split_text[1].strip().split(")")[0]
|
||||
|
||||
if Name in DefinitionRenameDict:
|
||||
Name = DefinitionRenameDict[Name]
|
||||
|
||||
Def = SyscallDefinition(Arch, Num, ABI, Name, EntryName)
|
||||
|
||||
Defs.append(Def)
|
||||
|
||||
@@ -335,6 +335,7 @@ enum Syscalls_Arm64 {
|
||||
SYSCALL_Arm64_memfd_secret = 447,
|
||||
SYSCALL_Arm64_process_mrelease = 448,
|
||||
SYSCALL_Arm64_futex_waitv = 449,
|
||||
SYSCALL_Arm64_set_mempolicy_home_node = 450,
|
||||
SYSCALL_Arm64_MAX = 512,
|
||||
|
||||
// Unsupported syscalls on this host
|
||||
|
||||
@@ -619,8 +619,8 @@ uint32_t SyscallHandler::CalculateHostKernelVersion() {
|
||||
}
|
||||
|
||||
uint32_t SyscallHandler::CalculateGuestKernelVersion() {
|
||||
// We currently only emulate a kernel between the ranges of Kernel 5.0.0 and 5.16.0
|
||||
return std::max(KernelVersion(5, 0), std::min(KernelVersion(5, 16), GetHostKernelVersion()));
|
||||
// We currently only emulate a kernel between the ranges of Kernel 5.0.0 and 5.17.0
|
||||
return std::max(KernelVersion(5, 0), std::min(KernelVersion(5, 17), GetHostKernelVersion()));
|
||||
}
|
||||
|
||||
uint64_t SyscallHandler::HandleSyscall(FEXCore::Core::CpuStateFrame *Frame, FEXCore::HLE::SyscallArguments *Args) {
|
||||
|
||||
@@ -54,7 +54,7 @@ class SignalDelegator;
|
||||
void RegisterIO();
|
||||
void RegisterIOUring(FEX::HLE::SyscallHandler *const Handler);
|
||||
void RegisterKey();
|
||||
void RegisterMemory();
|
||||
void RegisterMemory(FEX::HLE::SyscallHandler *const Handler);
|
||||
void RegisterMsg();
|
||||
void RegisterNamespace(FEX::HLE::SyscallHandler *const Handler);
|
||||
void RegisterNuma();
|
||||
|
||||
@@ -17,7 +17,7 @@ $end_info$
|
||||
#include <unistd.h>
|
||||
|
||||
namespace FEX::HLE {
|
||||
void RegisterMemory() {
|
||||
void RegisterMemory(FEX::HLE::SyscallHandler *const Handler) {
|
||||
using namespace FEXCore::IR;
|
||||
|
||||
REGISTER_SYSCALL_IMPL_FLAGS(brk, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
|
||||
@@ -104,5 +104,16 @@ namespace FEX::HLE {
|
||||
uint64_t Result = syscall(SYSCALL_DEF(membarrier), cmd, flags);
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
|
||||
if (Handler->IsHostKernelVersionAtLeast(5, 17, 0)) {
|
||||
REGISTER_SYSCALL_IMPL_PASS_FLAGS(set_mempolicy_home_node, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
|
||||
[](FEXCore::Core::CpuStateFrame *Frame, uint64_t start, uint64_t len, uint64_t home_node, uint64_t flags) -> uint64_t {
|
||||
uint64_t Result = ::syscall(SYSCALL_DEF(set_mempolicy_home_node), start, len, home_node, flags);
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
}
|
||||
else {
|
||||
REGISTER_SYSCALL_IMPL(set_mempolicy_home_node, UnimplementedSyscallSafe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,3 +8,4 @@ _BASIC_META(DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_WAIT)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_GET_CAPS)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB)
|
||||
_BASIC_META(DRM_IOCTL_VIRTGPU_CONTEXT_INIT)
|
||||
@@ -121,7 +121,7 @@ namespace FEX::HLE::x32 {
|
||||
FEX::HLE::RegisterIO();
|
||||
FEX::HLE::RegisterIOUring(this);
|
||||
FEX::HLE::RegisterKey();
|
||||
FEX::HLE::RegisterMemory();
|
||||
FEX::HLE::RegisterMemory(this);
|
||||
FEX::HLE::RegisterMsg();
|
||||
FEX::HLE::RegisterNamespace(this);
|
||||
FEX::HLE::RegisterSched();
|
||||
|
||||
@@ -464,6 +464,7 @@ enum Syscalls_x86 {
|
||||
SYSCALL_x86_memfd_secret = 447,
|
||||
SYSCALL_x86_process_mrelease = 448,
|
||||
SYSCALL_x86_futex_waitv = 449,
|
||||
SYSCALL_x86_set_mempolicy_home_node = 450,
|
||||
SYSCALL_x86_MAX = 512,
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace FEX::HLE::x64 {
|
||||
FEX::HLE::RegisterIO();
|
||||
FEX::HLE::RegisterIOUring(this);
|
||||
FEX::HLE::RegisterKey();
|
||||
FEX::HLE::RegisterMemory();
|
||||
FEX::HLE::RegisterMemory(this);
|
||||
FEX::HLE::RegisterMsg();
|
||||
FEX::HLE::RegisterNamespace(this);
|
||||
FEX::HLE::RegisterSched();
|
||||
|
||||
@@ -383,6 +383,7 @@ enum Syscalls_x64 {
|
||||
SYSCALL_x64_memfd_secret = 447,
|
||||
SYSCALL_x64_process_mrelease = 448,
|
||||
SYSCALL_x64_futex_waitv = 449,
|
||||
SYSCALL_x64_set_mempolicy_home_node = 450,
|
||||
SYSCALL_x64_MAX = 512,
|
||||
|
||||
// Unsupported syscalls on this host
|
||||
|
||||
Reference in new issue
Block a user