From dae8aa43866e55d3f6ec28df655e56064d4f187f Mon Sep 17 00:00:00 2001 From: gibbed Date: Fri, 5 Jun 2015 16:13:34 -0500 Subject: [PATCH] Added --protect_zero command-line argument to protect page zero from read/writes. --- src/xenia/memory.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 2f5582aca..0bc4145a5 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -27,6 +27,9 @@ #include #endif // WIN32 +DEFINE_bool(protect_zero, false, + "Protect the zero page from reads and writes."); + DEFINE_bool(scribble_heap, false, "Scribble 0xCD into all allocated heap memory."); @@ -179,7 +182,7 @@ int Memory::Initialize() { heaps_.v00000000.AllocFixed( 0x00000000, 4096, 4096, kMemoryAllocationReserve | kMemoryAllocationCommit, - kMemoryProtectRead | kMemoryProtectWrite); + !FLAGS_protect_zero ? kMemoryProtectRead | kMemoryProtectWrite : kMemoryProtectNoAccess); // GPU writeback. // 0xC... is physical, 0x7F... is virtual. We may need to overlay these.