mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Implement utils::memory_lock
This commit is contained in:
parent
d1988d384c
commit
e98eb4659e
2 changed files with 12 additions and 0 deletions
|
@ -39,6 +39,9 @@ namespace utils
|
||||||
// Set memory protection
|
// Set memory protection
|
||||||
void memory_protect(void* pointer, std::size_t size, protection prot);
|
void memory_protect(void* pointer, std::size_t size, protection prot);
|
||||||
|
|
||||||
|
// Lock pages in memory
|
||||||
|
void memory_lock(void* pointer, std::size_t size);
|
||||||
|
|
||||||
// Shared memory handle
|
// Shared memory handle
|
||||||
class shm
|
class shm
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,6 +180,15 @@ namespace utils
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void memory_lock(void* pointer, std::size_t size)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
verify("VirtualLock" HERE), ::VirtualLock(pointer, size);
|
||||||
|
#else
|
||||||
|
verify("mlock" HERE), !::mlock(pointer, size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
shm::shm(u32 size, u32 flags)
|
shm::shm(u32 size, u32 flags)
|
||||||
: m_size(::align(size, 0x10000))
|
: m_size(::align(size, 0x10000))
|
||||||
, m_flags(flags)
|
, m_flags(flags)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue