20 #ifndef KERNEL_PROCESSOR_HOSTED_VIRTUALADDRESSSPACE_H 21 #define KERNEL_PROCESSOR_HOSTED_VIRTUALADDRESSSPACE_H 23 #include "pedigree/kernel/Spinlock.h" 24 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 25 #include "pedigree/kernel/processor/types.h" 26 #include "pedigree/kernel/utilities/Vector.h" 31 #define KERNEL_SPACE_START reinterpret_cast<void *>(0x0000700000000000) 33 #define USERSPACE_DYNAMIC_LINKER_LOCATION reinterpret_cast<void *>(0x4FA00000) 35 #define USERSPACE_VIRTUAL_START reinterpret_cast<void *>(0x20000000) 36 #define USERSPACE_VIRTUAL_HEAP reinterpret_cast<void *>(0x50000000) 37 #define USERSPACE_RESERVED_START USERSPACE_DYNAMIC_LINKER_LOCATION 38 #define USERSPACE_VIRTUAL_STACK_SIZE 0x100000 39 #define USERSPACE_VIRTUAL_MAX_STACK_SIZE 0x100000 40 #define USERSPACE_DYNAMIC_START reinterpret_cast<void *>(0x0000400000000000) 41 #define USERSPACE_DYNAMIC_END reinterpret_cast<void *>(0x0000500000000000) 42 #define USERSPACE_VIRTUAL_LOWEST_STACK \ 43 reinterpret_cast<void *>( \ 44 USERSPACE_DYNAMIC_END + USERSPACE_VIRTUAL_MAX_STACK_SIZE) 45 #define USERSPACE_VIRTUAL_STACK reinterpret_cast<void *>(0x00006FFFFFFFF000) 46 #define KERNEL_VIRTUAL_MODULE_BASE reinterpret_cast<void *>(0x70000000) 47 #define KERNEL_VIRTUAL_MODULE_SIZE 0x10000000 48 #define KERNEL_VIRTUAL_EVENT_BASE reinterpret_cast<void *>(0x300000000000) 49 #define KERNEL_VIRTUAL_HEAP reinterpret_cast<void *>(0x0000700000000000) 50 #define KERNEL_VIRTUAL_HEAP_SIZE 0x40000000 51 #define KERNEL_VIRTUAL_ADDRESS reinterpret_cast<void *>(0x400000) 52 #define KERNEL_VIRTUAL_CACHE reinterpret_cast<void *>(0x200000000000) 53 #define KERNEL_VIRTUAL_CACHE_SIZE 0x10000000 54 #define KERNEL_VIRTUAL_MEMORYREGION_ADDRESS \ 55 reinterpret_cast<void *>(0x0000700040000000) 56 #define KERNEL_VIRTUAL_MEMORYREGION_SIZE 0x40000000 57 #define KERNEL_VIRTUAL_PAGESTACK_4GB \ 58 reinterpret_cast<void *>(0x0000700080000000) 59 #define KERNEL_VIRTUAL_STACK reinterpret_cast<void *>(0x0000700FFFFFF000) 60 #define KERNEL_STACK_SIZE 0x10000 85 virtual bool isMapped(
void *virtualAddress);
88 map(physical_uintptr_t physAddress,
void *virtualAddress,
size_t flags);
90 void *virtualAddress, physical_uintptr_t &physAddress,
size_t &flags);
91 virtual void setFlags(
void *virtualAddress,
size_t newFlags);
92 virtual void unmap(
void *virtualAddress);
109 return reinterpret_cast<uintptr_t
>(KERNEL_SPACE_START);
115 return reinterpret_cast<uintptr_t
>(USERSPACE_VIRTUAL_START);
121 return reinterpret_cast<uintptr_t
>(USERSPACE_RESERVED_START);
133 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_HEAP);
139 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_HEAP) +
140 KERNEL_VIRTUAL_HEAP_SIZE;
146 return reinterpret_cast<uintptr_t
>(USERSPACE_DYNAMIC_START);
152 return reinterpret_cast<uintptr_t
>(USERSPACE_DYNAMIC_END);
158 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_CACHE);
164 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_CACHE) +
165 KERNEL_VIRTUAL_CACHE_SIZE;
171 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_EVENT_BASE);
177 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_MODULE_BASE);
183 return reinterpret_cast<uintptr_t
>(KERNEL_VIRTUAL_MODULE_BASE) +
184 KERNEL_VIRTUAL_MODULE_SIZE;
214 uint64_t
toFlags(
size_t flags,
bool bFinal =
false);
220 size_t fromFlags(uint64_t Flags,
bool bFinal =
false);
229 physical_uintptr_t paddr;
Stack * doAllocateStack(size_t sSize)
virtual uintptr_t getKernelHeapEnd() const
virtual bool isMapped(void *virtualAddress)
virtual void revertToKernelAddressSpace()
virtual uintptr_t getDynamicStart() const
virtual bool map(physical_uintptr_t physAddress, void *virtualAddress, size_t flags)
virtual uintptr_t getKernelCacheEnd() const
virtual bool isAddressValid(void *virtualAddress)
virtual uintptr_t getKernelModulesEnd() const
virtual uintptr_t getKernelCacheStart() const
virtual uintptr_t getDynamicLinkerAddress() const
uint64_t toFlags(size_t flags, bool bFinal=false)
static EXPORTED_PUBLIC VirtualAddressSpace & getKernelAddressSpace()
HostedVirtualAddressSpace & operator=(const HostedVirtualAddressSpace &)
virtual uintptr_t getKernelModulesStart() const
virtual uintptr_t getKernelEventBlockStart() const
virtual void setFlags(void *virtualAddress, size_t newFlags)
size_t fromFlags(uint64_t Flags, bool bFinal=false)
virtual bool memIsInHeap(void *pMem)
static VirtualAddressSpace * create()
virtual uintptr_t getKernelStart() const
virtual VirtualAddressSpace * clone(bool copyOnWrite=true)
virtual void * getEndOfHeap()
The exception was caused by a hardware task switch.
#define USERSPACE_DYNAMIC_LINKER_LOCATION
virtual uintptr_t getUserReservedStart() const
HostedVirtualAddressSpace()
virtual uintptr_t getDynamicEnd() const
virtual void getMapping(void *virtualAddress, physical_uintptr_t &physAddress, size_t &flags)
virtual void unmap(void *virtualAddress)
virtual void freeStack(Stack *pStack)
virtual uintptr_t getKernelHeapStart() const
static void switchAddressSpace(VirtualAddressSpace &oldSpace, VirtualAddressSpace &newSpace)
virtual Stack * allocateStack()
Vector< Stack * > m_freeStacks
virtual ~HostedVirtualAddressSpace()
virtual uintptr_t getUserStart() const