vm: add "hook" memory (32G)

Implement overcommit emulation for shm.
This commit is contained in:
Nekotekina 2021-04-30 17:28:48 +03:00
parent e327d47169
commit 1b0b2fe21e
3 changed files with 48 additions and 8 deletions

View file

@ -51,13 +51,16 @@ namespace utils
#else
int m_file{};
#endif
u32 m_size{};
u32 m_flags{};
u64 m_size{};
atomic_t<void*> m_ptr{nullptr};
public:
explicit shm(u32 size, u32 flags = 0);
// Construct with specified path as sparse file storage
shm(u64 size, const std::string& storage);
shm(const shm&) = delete;
shm& operator=(const shm&) = delete;
@ -91,7 +94,7 @@ namespace utils
return static_cast<u8*>(+m_ptr);
}
u32 size() const
u64 size() const
{
return m_size;
}