jit: Transfer the responsibility of detecting whether CodeMemory syscalls are available/usable to the homebrew environment

This commit is contained in:
fincs 2020-08-04 13:34:17 +02:00
parent d0d64ce1ce
commit 8d51f7de1c
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60

View File

@ -15,8 +15,8 @@ Result jitCreate(Jit* j, size_t size)
// Use new CodeMemory object introduced in [4.0.0+], if available. // Use new CodeMemory object introduced in [4.0.0+], if available.
// On [5.0.0+] this is only usable with a kernel patch, as svcControlCodeMemory now errors if it's used under the same process which owns the object. // On [5.0.0+] this is only usable with a kernel patch, as svcControlCodeMemory now errors if it's used under the same process which owns the object.
if (kernelAbove400() && envIsSyscallHinted(0x4B) && envIsSyscallHinted(0x4C) // The homebrew loading environment is responsible for hinting the syscalls if they are available/usable for jit.
&& (!kernelAbove500() || detectJitKernelPatch())) { if (envIsSyscallHinted(0x4B) && envIsSyscallHinted(0x4C)) {
type = JitType_CodeMemory; type = JitType_CodeMemory;
} }
// Fall back to JitType_SetProcessMemoryPermission if available. // Fall back to JitType_SetProcessMemoryPermission if available.