ReXGlue SDK
Loading...
Searching...
No Matches
virtual_memory.h File Reference
#include <cstdlib>
#include <filesystem>
#include <memory>
#include <string_view>
#include <rex/platform.h>
#include <rex/types.h>
#include <rex/utility.h>

Go to the source code of this file.

Classes

class  rex::memory::MappedMemory
class  rex::memory::ChunkedMappedMemoryWriter

Namespaces

namespace  rex
namespace  rex::memory

Typedefs

using rex::memory::FileMappingHandle = int

Enumerations

enum class  PageAccess : u8 {
  kNoAccess = 0 , kReadOnly = 1 << 0 , kReadWrite = kReadOnly | 1 << 1 , kExecuteReadOnly = kReadOnly | 1 << 2 ,
  kExecuteReadWrite = kReadWrite | 1 << 2
}
enum class  rex::memory::AllocationType : u8 { rex::memory::kReserve = 1 << 0 , rex::memory::kCommit = 1 << 1 , kReserveCommit = kReserve | kCommit }
enum class  rex::memory::DeallocationType : u8 { rex::memory::kRelease = 1 << 0 , rex::memory::kDecommit = 1 << 1 }

Functions

size_t rex::memory::GetPageSize ()
size_t rex::memory::GetAllocationGranularity ()
bool rex::memory::IsWritableExecutableMemorySupported ()
void * rex::memory::AllocFixed (void *base_address, size_t length, AllocationType allocation_type, PageAccess access)
bool rex::memory::DeallocFixed (void *base_address, size_t length, DeallocationType deallocation_type)
bool rex::memory::Protect (void *base_address, size_t length, PageAccess access, PageAccess *out_old_access=nullptr)
bool rex::memory::QueryProtect (void *base_address, size_t &length, PageAccess &out_access)
template<typename T>
T * rex::memory::AlignedAlloc (size_t alignment)
template<typename T>
void rex::memory::AlignedFree (T *ptr)
FileMappingHandle rex::memory::CreateFileMappingHandle (const std::filesystem::path &path, size_t length, PageAccess access, bool commit)
std::filesystem::path rex::memory::CreateFileMappingName (std::string_view prefix)
void rex::memory::RemoveStaleFileMappings (std::string_view prefix)
void rex::memory::CloseFileMappingHandle (FileMappingHandle handle, const std::filesystem::path &path)
void * rex::memory::MapFileView (FileMappingHandle handle, void *base_address, size_t length, PageAccess access, size_t file_offset)
bool rex::memory::UnmapFileView (FileMappingHandle handle, void *base_address, size_t length)
void * rex::memory::LowAddress (void *address)

Variables

constexpr FileMappingHandle rex::memory::kFileMappingHandleInvalid = -1

Detailed Description

License
BSD 3-Clause License See LICENSE file in the project root for full license text.
Remarks
Derived from Xenia's xenia/base/memory.h and xenia/base/mapped_memory.h (Ben Vanik, 2020).