[Memory/CPU] UWP: Support separate code execution and write memory, FromApp functions + other Windows memory fixes

This commit is contained in:
Triang3l
2020-11-24 22:18:50 +03:00
parent cabd28b9bb
commit a73592c2ef
15 changed files with 348 additions and 113 deletions

View File

@@ -39,6 +39,8 @@ uint32_t ToPosixProtectFlags(PageAccess access) {
return PROT_READ;
case PageAccess::kReadWrite:
return PROT_READ | PROT_WRITE;
case PageAccess::kExecuteReadOnly:
return PROT_READ | PROT_EXEC;
case PageAccess::kExecuteReadWrite:
return PROT_READ | PROT_WRITE | PROT_EXEC;
default:
@@ -47,6 +49,8 @@ uint32_t ToPosixProtectFlags(PageAccess access) {
}
}
bool IsWritableExecutableMemorySupported() { return true; }
void* AllocFixed(void* base_address, size_t length,
AllocationType allocation_type, PageAccess access) {
// mmap does not support reserve / commit, so ignore allocation_type.
@@ -112,6 +116,7 @@ FileMappingHandle CreateFileMappingHandle(const std::filesystem::path& path,
oflag = 0;
break;
case PageAccess::kReadOnly:
case PageAccess::kExecuteReadOnly:
oflag = O_RDONLY;
break;
case PageAccess::kReadWrite: