wip on fork

minimal example works
This commit is contained in:
2026-02-25 11:32:22 +01:00
parent 22ab2fb2a5
commit 8b271e2470
8 changed files with 64 additions and 18 deletions

View File

@@ -4,6 +4,7 @@
#include "../arch/core_ring.h"
#include "../memory/pageframealloc.h"
#include "../memory/pagetable.h"
#include "../memory/page.h"
#include "../debug/kernelpanic.h"
#include "../interrupt/guard.h"
#include "debug/output.h"
@@ -49,11 +50,11 @@ void Thread::map_app(void* code_paddr, uint16_t code_page_num, void* stack_vaddr
}
}
Thread::Thread (bool kernel, void* start_addr, void * codeframe, int code_frame_num): queue_link(nullptr), isKernel(kernel), start(start_addr), id(idCounter++), kill_flag(false){
Thread::Thread (bool kernel, void* start_addr, void * codeframe, int code_frame_num): queue_link(nullptr), isKernel(kernel), start(start_addr), code_paddr(codeframe), code_pagenum(code_frame_num), id(idCounter++), kill_flag(false){
StackPointer.isr = reinterpret_cast<void *>((uintptr_t)PageFrameAllocator::alloc(true)+STACK_SIZE);// mapped due to identity mapping
StackPointer.user = (void*)(0x61FF000+STACK_SIZE);
StackPointer.user = (void*)(0x6000000+STACK_SIZE);
map_app(codeframe, code_frame_num, StackPointer.user, 1);
map_app(codeframe, code_frame_num, (void*)((uintptr_t)StackPointer.user-STACK_SIZE), 1);
prepareContext(StackPointer.isr, context, kickoff, reinterpret_cast<uintptr_t>(this), 0, 0);
}