mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Memory: Factorize virtual memory reservation/allocation code in function
This commit is contained in:
parent
241dedef4e
commit
942f26509b
5 changed files with 75 additions and 15 deletions
22
Utilities/VirtualMemory.h
Normal file
22
Utilities/VirtualMemory.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
namespace memory_helper
|
||||
{
|
||||
/**
|
||||
* Reserve size bytes of virtual memory and returns it.
|
||||
* The memory should be commited before usage.
|
||||
*/
|
||||
void* reserve_memory(size_t size);
|
||||
|
||||
/**
|
||||
* Commit page_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, size_t page_size);
|
||||
|
||||
/**
|
||||
* Free memory alloced via reserve_memory.
|
||||
*/
|
||||
void free_reserved_memory(void* pointer, size_t size);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue