20 #ifndef KERNEL_PROCESSOR_X86_VIRTUALADDRESSSPACE_H 21 #define KERNEL_PROCESSOR_X86_VIRTUALADDRESSSPACE_H 23 #include "pedigree/kernel/Spinlock.h" 24 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 25 #include "pedigree/kernel/processor/types.h" 30 #define KERNEL_SPACE_START reinterpret_cast<void *>(0xC0000000) 32 #define USERSPACE_DYNAMIC_LINKER_LOCATION reinterpret_cast<void *>(0x4FA00000) 34 #define USERSPACE_VIRTUAL_START reinterpret_cast<void *>(0x400000) 35 #define USERSPACE_VIRTUAL_HEAP reinterpret_cast<void *>(0x50000000) 36 #define USERSPACE_VIRTUAL_STACK reinterpret_cast<void *>(0xB0000000) 37 #define USERSPACE_RESERVED_START USERSPACE_VIRTUAL_HEAP 38 #define USERSPACE_VIRTUAL_MAX_STACK_SIZE 0x100000 39 #define USERSPACE_VIRTUAL_LOWEST_STACK reinterpret_cast<void *>(0x70000000) 40 #define VIRTUAL_PAGE_DIRECTORY reinterpret_cast<void *>(0xFFBFF000) 41 #define VIRTUAL_PAGE_TABLES reinterpret_cast<void *>(0xFFC00000) 42 #define KERNEL_VIRTUAL_TEMP1 reinterpret_cast<void *>(0xFFBFC000) 43 #define KERNEL_VIRTUAL_TEMP2 reinterpret_cast<void *>(0xFFBFD000) 44 #define KERNEL_VIRTUAL_TEMP3 reinterpret_cast<void *>(0xFFBFE000) 45 #define KERNEL_VIRTUAL_HEAP reinterpret_cast<void *>(0xC0000000) 46 #define KERNEL_VIRTUAL_HEAP_SIZE 0x10000000 47 #define KERNEL_VIRUTAL_PAGE_DIRECTORY reinterpret_cast<void *>(0xFF7FF000) 48 #define KERNEL_VIRTUAL_ADDRESS reinterpret_cast<void *>(0xFF400000 - 0x100000) 49 #define KERNEL_VIRTUAL_MEMORYREGION_ADDRESS reinterpret_cast<void *>(0xD0000000) 50 #define KERNEL_VIRTUAL_PAGESTACK_4GB reinterpret_cast<void *>(0xF0000000) 51 #define KERNEL_VIRTUAL_STACK reinterpret_cast<void *>(0xFF3F6000) 52 #define KERNEL_VIRTUAL_MEMORYREGION_SIZE 0x10000000 53 #define KERNEL_STACK_SIZE 0x8000 76 virtual bool isMapped(
void *virtualAddress);
82 virtual void setFlags(
void *virtualAddress,
size_t newFlags);
83 virtual void unmap(
void *virtualAddress);
86 virtual void freeStack(
void *pStack);
108 physical_uintptr_t
physicalAddress,
void *virtualAddress,
size_t flags);
118 return reinterpret_cast<uintptr_t
>(KERNEL_SPACE_START);
124 return reinterpret_cast<uintptr_t
>(USERSPACE_VIRTUAL_START);
130 return reinterpret_cast<uintptr_t
>(USERSPACE_RESERVED_START);
142 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_HEAP);
148 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_HEAP) +
149 KERNEL_VIRTUAL_HEAP_SIZE;
162 void *Heap, physical_uintptr_t PhysicalPageDirectory,
163 void *VirtualPageDirectory,
void *VirtualPageTables,
166 bool doIsMapped(
void *virtualAddress);
168 physical_uintptr_t
physicalAddress,
void *virtualAddress,
size_t flags);
170 void *virtualAddress, physical_uintptr_t &physicalAddress,
172 void doSetFlags(
void *virtualAddress,
size_t newFlags);
173 void doUnmap(
void *virtualAddress);
174 void *doAllocateStack(
size_t sSize);
198 uint32_t
toFlags(
size_t flags,
bool bFinal =
false);
204 size_t fromFlags(uint32_t Flags,
bool bFinal =
false);
220 uintptr_t &v, physical_uintptr_t physicalAddress,
void *virtualAddress,
252 virtual bool isMapped(
void *virtualAddress);
258 virtual void setFlags(
void *virtualAddress,
size_t newFlags);
259 virtual void unmap(
void *virtualAddress);
virtual void unmap(void *virtualAddress)
size_t fromFlags(uint32_t Flags, bool bFinal=false)
#define INITIALISATION_ONLY
virtual uintptr_t getKernelHeapStart() const
virtual bool isAddressValid(void *virtualAddress)
virtual bool map(physical_uintptr_t physicalAddress, void *virtualAddress, size_t flags)
static EXPORTED_PUBLIC VirtualAddressSpace & getKernelAddressSpace()
virtual void getMapping(void *virtualAddress, physical_uintptr_t &physicalAddress, size_t &flags)
virtual bool memIsInHeap(void *pMem)
Vector< void * > m_freeStacks
virtual void * getEndOfHeap()
static VirtualAddressSpace * create()
virtual void revertToKernelAddressSpace()
static void initialise() INITIALISATION_ONLY
uintptr_t physicalAddress(physical_uintptr_t address) PURE
bool mapPageStructures(physical_uintptr_t physicalAddress, void *virtualAddress, size_t flags)
void * m_VirtualPageDirectory
static X86KernelVirtualAddressSpace m_Instance
virtual uintptr_t getKernelHeapEnd() const
virtual uintptr_t getDynamicLinkerAddress() const
uintptr_t beginCrossSpace(X86VirtualAddressSpace *pOther)
The exception was caused by a hardware task switch.
virtual void setFlags(void *virtualAddress, size_t newFlags)
virtual uintptr_t getKernelStart() const
bool getPageTableEntry(void *virtualAddress, uint32_t *&pageTableEntry)
#define USERSPACE_DYNAMIC_LINKER_LOCATION
void * m_VirtualPageTables
virtual void * allocateStack()
X86VirtualAddressSpace & operator=(const X86VirtualAddressSpace &)
virtual uintptr_t getUserStart() const
virtual bool isMapped(void *virtualAddress)
bool mapCrossSpace(uintptr_t &v, physical_uintptr_t physicalAddress, void *virtualAddress, size_t flags)
physical_uintptr_t m_PhysicalPageDirectory
virtual uintptr_t getUserReservedStart() const
uint32_t toFlags(size_t flags, bool bFinal=false)