create copys of appcode in thread constructor

This commit is contained in:
2026-02-28 18:01:15 +01:00
parent 1acc652446
commit 4976ea91be
9 changed files with 265 additions and 180 deletions

View File

@@ -56,8 +56,8 @@ extern "C" int main() {
PageFrameAllocator::stats();
Multiboot::Module* initrd = Multiboot::getModule(0);
DBG << "initrd address: " << hex << initrd->getStartAddress() << endl << "initrd size: " << initrd->getSize() << endl;
memcpy((void *)0x4000000, initrd->getStartAddress(), initrd->getSize());
mark_pageframes(0x4000000, 0x4000000 + initrd->getSize(), false);
//memcpy((void *)0x4000000, initrd->getStartAddress(), initrd->getSize());
//mark_pageframes(0x4000000, 0x4000000 + initrd->getSize(), false);
write_identity_map(identity_table, KERNEL_MEMORY_BORDER);
//create_basic_page_table(&paging_tree, identity_table);
@@ -88,8 +88,8 @@ extern "C" int main() {
uint32_t (*apps_header)[1024] = (uint32_t (*)[1024])Multiboot::getModule(0)->getStartAddress();
uint64_t offset = 1;
for(uint16_t i = 1; i <= (*apps_header)[0]; i++){
uint32_t appsize = (*apps_header)[i];
uintptr_t appstart = (0x4000+offset)<<12;
uint64_t appsize = (*apps_header)[i];
uintptr_t appstart = (uintptr_t)apps_header+(offset<<12);
DBG << "app " << i << " size " << appsize << " at " << appstart << endl;
Thread* thread_ptr= new Thread(false, (void*)0x4000000, (void*)appstart, (appsize/4096)+1); //TODO fix edgecase on size=4096