mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-14 06:56:51 -04:00
Fix the use of the PML4 Table
This commit is contained in:
parent
76d13ba968
commit
3f41625b80
@ -7,8 +7,11 @@ typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
|
|||||||
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
|
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
|
||||||
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
|
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
|
||||||
|
|
||||||
static_assert(sizeof(uint8_t) == 1, "The size must match");
|
typedef std::size_t uintptr_t;
|
||||||
static_assert(sizeof(uint16_t) == 2, "The size must match");
|
|
||||||
static_assert(sizeof(uint32_t) == 4, "The size must match");
|
static_assert(sizeof(uint8_t) == 1, "uint32_t must be 1 byte long");
|
||||||
|
static_assert(sizeof(uint16_t) == 2, "uint32_t must be 2 bytes long");
|
||||||
|
static_assert(sizeof(uint32_t) == 4, "uint32_t must be 4 bytes long");
|
||||||
|
static_assert(sizeof(uintptr_t) == sizeof(std::size_t*), "uintptr_t must have the same size as a pointer");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,11 +81,9 @@ std::size_t* allocate_block(std::size_t blocks){
|
|||||||
}
|
}
|
||||||
|
|
||||||
pml4t_t pml4t = (pml4t_t) 0x70000;
|
pml4t_t pml4t = (pml4t_t) 0x70000;
|
||||||
auto pdpt = (page_directory_pointer_table)(pml4t[pml4t_index] - 0x3);
|
auto pdpt = (page_directory_pointer_table)(reinterpret_cast<uintptr_t>(pml4t[pml4t_index]) & ~0xFFF);
|
||||||
auto pdt = (page_directory_table)(pdpt[pdpt_index] - 0x3);
|
auto pdt = (page_directory_table)(reinterpret_cast<uintptr_t>(pdpt[pdpt_index]) & ~0xFFF);
|
||||||
auto pt = (page_table)(pdt[pdt_index] - 0x3);
|
auto pt = (page_table)(reinterpret_cast<uintptr_t>(pdt[pdt_index]) & ~0xFFF);
|
||||||
|
|
||||||
pt = (page_table) 0x73000;
|
|
||||||
|
|
||||||
if(pt_index + blocks >= 512){
|
if(pt_index + blocks >= 512){
|
||||||
//TODO Go to a new page table
|
//TODO Go to a new page table
|
||||||
|
Loading…
x
Reference in New Issue
Block a user