2022-09-06 16:08:15 +00:00
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-10-08 12:52:28 +00:00
|
|
|
#ifndef PAGE_SIZE
|
|
|
|
#define PAGE_SIZE 4096
|
|
|
|
#endif
|
|
|
|
|
2022-09-22 05:57:30 +00:00
|
|
|
#define MAP_READ_WRITE 1 << 0
|
|
|
|
#define MAP_USER 1 << 1
|
2022-09-23 14:41:43 +00:00
|
|
|
#define MAP_EXEC 1 << 2
|
2022-09-22 05:57:30 +00:00
|
|
|
|
2022-09-24 19:45:13 +00:00
|
|
|
namespace MemoryManager
|
2022-09-06 16:08:15 +00:00
|
|
|
{
|
2022-09-25 15:38:17 +00:00
|
|
|
void init();
|
|
|
|
|
2022-09-22 05:57:30 +00:00
|
|
|
void* get_mapping(void* physicalAddress, int flags = MAP_READ_WRITE);
|
2022-09-06 16:08:15 +00:00
|
|
|
void release_mapping(void* mapping);
|
|
|
|
|
2022-09-22 05:57:30 +00:00
|
|
|
void* get_unaligned_mapping(void* physicalAddress, int flags = MAP_READ_WRITE);
|
|
|
|
void* get_unaligned_mappings(void* physicalAddress, uint64_t count, int flags = MAP_READ_WRITE);
|
2022-09-07 08:33:22 +00:00
|
|
|
void release_unaligned_mapping(void* mapping);
|
2022-09-07 17:41:08 +00:00
|
|
|
void release_unaligned_mappings(void* mapping, uint64_t count);
|
2022-09-07 08:33:22 +00:00
|
|
|
|
2022-09-22 05:57:30 +00:00
|
|
|
void* get_page(int flags = MAP_READ_WRITE);
|
|
|
|
void* get_pages(uint64_t count, int flags = MAP_READ_WRITE);
|
2022-09-06 16:08:15 +00:00
|
|
|
|
2022-10-01 10:12:50 +00:00
|
|
|
void* get_page_at(uint64_t addr, int flags = MAP_READ_WRITE);
|
|
|
|
void* get_pages_at(uint64_t addr, uint64_t count, int flags = MAP_READ_WRITE);
|
|
|
|
|
2022-09-06 16:08:15 +00:00
|
|
|
void release_page(void* page);
|
|
|
|
void release_pages(void* pages, uint64_t count);
|
|
|
|
}
|