2022-10-13 17:19:51 +00:00
|
|
|
#pragma once
|
|
|
|
#include "memory/Paging.h"
|
|
|
|
|
|
|
|
struct AddressSpace
|
|
|
|
{
|
|
|
|
static AddressSpace create();
|
|
|
|
|
|
|
|
void destroy();
|
|
|
|
|
2022-10-14 16:17:57 +00:00
|
|
|
void detach();
|
|
|
|
|
|
|
|
AddressSpace clone();
|
2022-10-14 14:46:00 +00:00
|
|
|
|
2022-10-13 17:19:51 +00:00
|
|
|
PageTable* get_pml4()
|
|
|
|
{
|
|
|
|
return m_pml4;
|
|
|
|
}
|
|
|
|
|
2022-10-14 16:17:57 +00:00
|
|
|
bool is_cloned()
|
|
|
|
{
|
2022-10-15 15:40:33 +00:00
|
|
|
return *m_refs > 1;
|
2022-10-14 16:17:57 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 17:19:51 +00:00
|
|
|
private:
|
|
|
|
PageTable* m_pml4;
|
2022-10-15 15:40:33 +00:00
|
|
|
|
|
|
|
int* m_refs;
|
2022-10-13 17:19:51 +00:00
|
|
|
};
|