mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
FEX: serve decoder reads from fixed guest memory above the host limit
This commit is contained in:
1 parent
b6986d884e
commit
0086c789e0
1 file changed
+30
-9
@@ -1,4 +1,4 @@
|
||||
From 4e171202b61801787d250215809c07a6faaf6618 Mon Sep 17 00:00:00 2001
|
||||
From 4e237204720bf57c8e4b7dae1ff74b5e341763e6 Mon Sep 17 00:00:00 2001
|
||||
From: maxjivi05 <maxjividen@gmail.com>
|
||||
Date: Wed, 2 Dec 2026 20:01:44 -0500
|
||||
Subject: [PATCH] Map fixed guest memory above a small host address space
|
||||
@@ -15,11 +15,12 @@ Builds on StonkGuy's anti-cheat emulation from https://github.com/StonkGuy/FEX (
|
||||
Source/Tools/LinuxEmulation/CMakeLists.txt | 1 +
|
||||
.../LinuxSyscalls/GuestHighMemory.cpp | 439 ++++++++++++++++++
|
||||
.../LinuxSyscalls/GuestHighMemory.h | 26 ++
|
||||
.../LinuxEmulation/LinuxSyscalls/Syscalls.cpp | 31 +-
|
||||
.../LinuxSyscalls/SignalDelegator.cpp | 5 +
|
||||
.../LinuxEmulation/LinuxSyscalls/Syscalls.cpp | 30 +-
|
||||
.../LinuxSyscalls/SyscallsSMCTracking.cpp | 58 ++-
|
||||
.../LinuxSyscalls/ThreadManager.cpp | 2 +
|
||||
.../LinuxSyscalls/ThreadManager.h | 12 +
|
||||
7 files changed, 547 insertions(+), 22 deletions(-)
|
||||
8 files changed, 551 insertions(+), 22 deletions(-)
|
||||
create mode 100644 Source/Tools/LinuxEmulation/LinuxSyscalls/GuestHighMemory.cpp
|
||||
create mode 100644 Source/Tools/LinuxEmulation/LinuxSyscalls/GuestHighMemory.h
|
||||
|
||||
@@ -512,8 +513,31 @@ index 000000000..326b1a37d
|
||||
+bool HandleTrap(FEXCore::Core::InternalThreadState* Thread, int Signal, void* Info, void* UContext);
|
||||
+void ReleaseThread(FEX::HLE::ThreadStateObject* Thread);
|
||||
+} // namespace FEX::HLE::GuestHighMemory
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
|
||||
index efe49dbf1..e8723e8f1 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
|
||||
@@ -7,6 +7,7 @@ $end_info$
|
||||
*/
|
||||
|
||||
#include "LinuxSyscalls/SignalDelegator.h"
|
||||
+#include "LinuxSyscalls/GuestHighMemory.h"
|
||||
#include "LinuxSyscalls/Syscalls.h"
|
||||
#include "LinuxSyscalls/PtraceEmu.h"
|
||||
#include "LinuxSyscalls/SignalTrace.h"
|
||||
@@ -748,6 +749,10 @@ uint64_t SignalDelegator::GetNewSigMask(int Signal) const {
|
||||
}
|
||||
|
||||
bool SignalDelegator::HandleFrontendSIGSEGV(FEXCore::Core::InternalThreadState* Thread, int Signal, void* Info, void* UContext) {
|
||||
+ if (FEX::HLE::GuestHighMemory::HandleFault(Thread, Signal, Info, UContext)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
auto SigInfo = *static_cast<siginfo_t*>(Info);
|
||||
|
||||
if (FaultSafeUserMemAccess::TryHandleSafeFault(Signal, SigInfo, UContext)) {
|
||||
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
index 607ab0b97..6627b4eb7 100644
|
||||
index 607ab0b97..078faedac 100644
|
||||
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp
|
||||
@@ -16,6 +16,7 @@ $end_info$
|
||||
@@ -524,18 +548,15 @@ index 607ab0b97..6627b4eb7 100644
|
||||
#include <limits.h>
|
||||
#include "LinuxSyscalls/Syscalls.h"
|
||||
#include "LinuxSyscalls/Syscalls/Thread.h"
|
||||
@@ -818,8 +819,10 @@ SyscallHandler::SyscallHandler(FEXCore::Context::Context* _CTX, FEX::HLE::Signal
|
||||
GuestKernelVersion = CalculateGuestKernelVersion();
|
||||
Alloc32Handler = FEX::HLE::Create32BitAllocator();
|
||||
@@ -820,6 +821,7 @@ SyscallHandler::SyscallHandler(FEXCore::Context::Context* _CTX, FEX::HLE::Signal
|
||||
|
||||
+ SignalDelegation->RegisterHostSignalHandler(SIGSEGV, FEX::HLE::GuestHighMemory::HandleFault, true);
|
||||
SignalDelegation->RegisterHostSignalHandler(SIGSEGV, HandleSegfault, true);
|
||||
|
||||
+ SignalDelegation->RegisterHostSignalHandler(SIGTRAP, FEX::HLE::GuestHighMemory::HandleTrap, true);
|
||||
SignalDelegation->RegisterHostSignalHandler(
|
||||
SIGTRAP, [](FEXCore::Core::InternalThreadState*, int, void*, void*) { return false; }, true);
|
||||
|
||||
@@ -894,24 +897,22 @@ void SyscallHandler::HandleSyscallImpl(FEXCore::Core::CpuStateFrame* Frame, uint
|
||||
@@ -894,24 +896,22 @@ void SyscallHandler::HandleSyscallImpl(FEXCore::Core::CpuStateFrame* Frame, uint
|
||||
}
|
||||
|
||||
auto& Def = Definitions[SyscallNum];
|
||||
|
||||
Reference in new issue
Block a user