Added --protect_zero command-line argument to protect page zero from read/writes.

This commit is contained in:
gibbed 2015-06-05 16:13:34 -05:00
parent 0cf3064bf5
commit dae8aa4386
1 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,9 @@
#include <sys/mman.h>
#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.