cpu_patches: Patch just-in-time using signal handlers. (#852)

* cpu_patches: Patch just-in-time using illegal instruction handler.

* core: Add common signal dispatch system and use for on-demand TCB patches.

* page_manager: Re-add userfaultfd implementation.
This commit is contained in:
squidbus 2024-09-15 13:48:34 -07:00 committed by GitHub
parent b09b28c7f3
commit 75a4df53a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 404 additions and 143 deletions

View file

@ -3,10 +3,6 @@
#pragma once
namespace Xbyak {
class CodeGenerator;
}
namespace Core {
/// Initializes a stack for the current thread for use by patch implementations.
@ -15,7 +11,11 @@ void InitializeThreadPatchStack();
/// Cleans up the patch stack for the current thread.
void CleanupThreadPatchStack();
/// Patches CPU instructions that cannot run as-is on the host.
void PatchInstructions(u64 segment_addr, u64 segment_size, Xbyak::CodeGenerator& c);
/// Registers a module for patching, providing an area to generate trampoline code.
void RegisterPatchModule(void* module_ptr, u64 module_size, void* trampoline_area_ptr,
u64 trampoline_area_size);
/// Applies CPU patches that need to be done before beginning executions.
void PrePatchInstructions(u64 segment_addr, u64 segment_size);
} // namespace Core