rpcsx/kernel/orbis/include/orbis/pmem.hpp
2026-01-06 07:52:33 +03:00

32 lines
1 KiB
C++

#pragma once
#include "error/ErrorCode.hpp"
#include "kernel/MemoryResource.hpp"
#include "rx/AddressRange.hpp"
#include "rx/EnumBitSet.hpp"
#include <cstdint>
namespace orbis {
using kernel::AllocationFlags;
struct IoDevice;
struct File;
} // namespace orbis
namespace orbis::pmem {
ErrorCode initialize(rx::Mappable mappable, std::uint64_t size);
void destroy();
std::pair<rx::AddressRange, ErrorCode>
allocate(std::uint64_t addressHint, std::uint64_t size,
rx::EnumBitSet<AllocationFlags> flags, std::uint64_t alignment);
ErrorCode deallocate(rx::AddressRange range);
std::optional<rx::AddressRange> query(std::uint64_t address);
ErrorCode map(std::uint64_t virtualAddress, rx::AddressRange range,
rx::EnumBitSet<rx::mem::Protection> protection);
void *mapInternal(rx::AddressRange range,
rx::EnumBitSet<rx::mem::Protection> protection);
void unmapInternal(void *data, std::size_t size);
std::size_t getSize();
IoDevice *getDevice();
File *getFile();
} // namespace orbis::pmem