[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

@@ -35,6 +35,7 @@ enum class PageAccess {
kNoAccess = 0,
kReadOnly = 1 << 0,
kReadWrite = kReadOnly | 1 << 1,
kExecuteReadOnly = kReadOnly | 1 << 2,
kExecuteReadWrite = kReadWrite | 1 << 2,
};
@@ -49,6 +50,16 @@ enum class DeallocationType {
kDecommit = 1 << 1,
};
// Whether the host allows the pages to be allocated or mapped with
// PageAccess::kExecuteReadWrite - if not, separate mappings backed by the same
// memory-mapped file must be used to write to executable pages.
bool IsWritableExecutableMemorySupported();
// Whether PageAccess::kExecuteReadWrite is a supported and preferred way of
// writing executable memory, useful for simulating how Xenia would work without
// writable executable memory on a system with it.
bool IsWritableExecutableMemoryPreferred();
// Allocates a block of memory at the given page-aligned base address.
// Fails if the memory is not available.
// Specify nullptr for base_address to leave it up to the system.