Fixed ToXdkProtectFlags returning bad protection flags when

nocache/writecombine were present.
This commit is contained in:
gibbed 2016-06-20 11:27:25 -05:00
parent 6729ec182b
commit 919d84ad73
1 changed files with 4 additions and 4 deletions

View File

@ -31,10 +31,10 @@ uint32_t ToXdkProtectFlags(uint32_t protect) {
result = X_PAGE_READWRITE; result = X_PAGE_READWRITE;
} }
if (protect & kMemoryProtectNoCache) { if (protect & kMemoryProtectNoCache) {
result = X_PAGE_NOCACHE; result |= X_PAGE_NOCACHE;
} }
if (protect & kMemoryProtectWriteCombine) { if (protect & kMemoryProtectWriteCombine) {
result = X_PAGE_WRITECOMBINE; result |= X_PAGE_WRITECOMBINE;
} }
return result; return result;
} }
@ -42,10 +42,10 @@ uint32_t ToXdkProtectFlags(uint32_t protect) {
uint32_t FromXdkProtectFlags(uint32_t protect) { uint32_t FromXdkProtectFlags(uint32_t protect) {
uint32_t result = 0; uint32_t result = 0;
if ((protect & X_PAGE_READONLY) | (protect & X_PAGE_EXECUTE_READ)) { if ((protect & X_PAGE_READONLY) | (protect & X_PAGE_EXECUTE_READ)) {
result |= kMemoryProtectRead; result = kMemoryProtectRead;
} else if ((protect & X_PAGE_READWRITE) | } else if ((protect & X_PAGE_READWRITE) |
(protect & X_PAGE_EXECUTE_READWRITE)) { (protect & X_PAGE_EXECUTE_READWRITE)) {
result |= kMemoryProtectRead | kMemoryProtectWrite; result = kMemoryProtectRead | kMemoryProtectWrite;
} }
if (protect & X_PAGE_NOCACHE) { if (protect & X_PAGE_NOCACHE) {
result |= kMemoryProtectNoCache; result |= kMemoryProtectNoCache;