wip on pagetable

compiles&runs now
This commit is contained in:
2026-02-24 04:38:16 +01:00
parent dc1c98c091
commit c92b15e2a6
6 changed files with 40 additions and 28 deletions

View File

@@ -30,14 +30,15 @@ void Thread::kickoff(uintptr_t param1, uintptr_t param2, uintptr_t param3) {
}
void Thread::load_paging(Thread* t){
load_cr3((void*)&(t->paging_tree.l4.entries[0]));
load_cr3((void*)(t->paging_tree->l4));
}
Thread::Thread (bool kernel, void * startframe, int num_pages): queue_link(nullptr), isKernel(kernel), start(startframe), id(idCounter++), kill_flag(false){
StackPointer.isr = reinterpret_cast<void *>((uintptr_t)PageFrameAllocator::alloc(true)+STACK_SIZE);//(reserved_stack_space_isr + STACK_SIZE);
StackPointer.user = (void*)(0x4100000+STACK_SIZE);
create_basic_page_table(&paging_tree, &identity_table);
paging_tree = (four_lvl_paging_t*)PageFrameAllocator::alloc(true);
create_basic_page_table(paging_tree, &identity_table);
subtable = (pagetable_t*) PageFrameAllocator::alloc(true);
for(uint8_t i=0; i<num_pages; i++){
@@ -57,7 +58,7 @@ Thread::Thread (bool kernel, void * startframe, int num_pages): queue_link(null
//pagetable_t* l2addr = (pagetable_t*)(paging_tree.l3.entries[0].address<<12);
//l2addr->entries[32] = {
paging_tree.l2.entries[32] = {
paging_tree->l2->entries[32] = {
.present = 1,
.write = 1,
.user = 1,

View File

@@ -34,7 +34,7 @@ class Thread {
void* start;
four_lvl_paging_t paging_tree;
four_lvl_paging_t* paging_tree;
friend class Queue<Thread>;
friend class Semaphore;