mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
utils::memory_protect
This commit is contained in:
parent
ed711c0e59
commit
d09dd29054
4 changed files with 58 additions and 16 deletions
|
@ -1,22 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
namespace memory_helper
|
||||
namespace utils
|
||||
{
|
||||
/**
|
||||
* Reserve `size` bytes of virtual memory and returns it.
|
||||
* The memory should be commited before usage.
|
||||
*/
|
||||
void* reserve_memory(std::size_t size);
|
||||
void* memory_reserve(std::size_t size);
|
||||
|
||||
/**
|
||||
* Commit `size` bytes of virtual memory starting at pointer.
|
||||
* That is, bake reserved memory with physical memory.
|
||||
* pointer should belong to a range of reserved memory.
|
||||
*/
|
||||
void commit_page_memory(void* pointer, std::size_t size);
|
||||
void memory_commit(void* pointer, std::size_t size);
|
||||
|
||||
/**
|
||||
* Decommit all memory committed via commit_page_memory.
|
||||
*/
|
||||
void free_reserved_memory(void* pointer, std::size_t size);
|
||||
void memory_decommit(void* pointer, std::size_t size);
|
||||
|
||||
// Memory protection type
|
||||
enum class protection
|
||||
{
|
||||
rw, // Read + write (default)
|
||||
ro, // Read only
|
||||
no, // No access
|
||||
wx, // Read + write + execute
|
||||
rx, // Read + execute
|
||||
};
|
||||
|
||||
void memory_protect(void* pointer, std::size_t size, protection prot);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue