mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
Kernel: Move kernel above the 3GB virtual address mark
The kernel and its static data structures are no longer identity-mapped in the bottom 8MB of the address space, but instead move above 3GB. The first 8MB above 3GB are pseudo-identity-mapped to the bottom 8MB of the physical address space. But things don't have to stay this way! Thanks to Jesse who made an earlier attempt at this, it was really easy to get device drivers working once the page tables were in place! :^) Fixes #734.
This commit is contained in:
parent
cee597a728
commit
e362b56b4f
17 changed files with 325 additions and 125 deletions
|
@ -20,6 +20,28 @@
|
|||
|
||||
#define PAGE_ROUND_UP(x) ((((u32)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
|
||||
|
||||
template<typename T>
|
||||
inline T* low_physical_to_virtual(T* physical)
|
||||
{
|
||||
return (T*)(((u8*)physical) + 0xc0000000);
|
||||
}
|
||||
|
||||
inline u32 low_physical_to_virtual(u32 physical)
|
||||
{
|
||||
return physical + 0xc0000000;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* virtual_to_low_physical(T* physical)
|
||||
{
|
||||
return (T*)(((u8*)physical) - 0xc0000000);
|
||||
}
|
||||
|
||||
inline u32 virtual_to_low_physical(u32 physical)
|
||||
{
|
||||
return physical - 0xc0000000;
|
||||
}
|
||||
|
||||
class KBuffer;
|
||||
class SynthFSInode;
|
||||
|
||||
|
@ -38,7 +60,7 @@ class MemoryManager {
|
|||
public:
|
||||
static MemoryManager& the();
|
||||
|
||||
static void initialize(u32 physical_address_for_kernel_page_tables);
|
||||
static void initialize();
|
||||
|
||||
PageFaultResponse handle_page_fault(const PageFault&);
|
||||
|
||||
|
@ -85,7 +107,7 @@ public:
|
|||
static const Region* region_from_vaddr(const Process&, VirtualAddress);
|
||||
|
||||
private:
|
||||
MemoryManager(u32 physical_address_for_kernel_page_tables);
|
||||
MemoryManager();
|
||||
~MemoryManager();
|
||||
|
||||
enum class AccessSpace { Kernel, User };
|
||||
|
@ -116,6 +138,9 @@ private:
|
|||
u8* quickmap_page(PhysicalPage&);
|
||||
void unquickmap_page();
|
||||
|
||||
PageDirectoryEntry* quickmap_pd(PageDirectory&, size_t pdpt_index);
|
||||
PageTableEntry* quickmap_pt(PhysicalAddress);
|
||||
|
||||
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
|
||||
|
||||
PageTableEntry& ensure_pte(PageDirectory&, VirtualAddress);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue