create copys of appcode in thread constructor
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
class IdleThread : public Thread {
|
||||
public:
|
||||
explicit IdleThread() : Thread(true, 0) {}
|
||||
explicit IdleThread() : Thread(true, 0, 0, 0) {}
|
||||
|
||||
/*! \brief Wait for a thread to become ready and sleep in the meantime.
|
||||
*
|
||||
|
||||
@@ -38,14 +38,14 @@ void Thread::map_app(void* code_paddr, uint16_t code_page_num, void* stack_vaddr
|
||||
memset(paging_tree, 0, 4096);
|
||||
create_basic_page_table(paging_tree, &identity_table);
|
||||
|
||||
// insert app code pages at 0x4000000
|
||||
// app code pages at 0x4000000
|
||||
for(uintptr_t i=0; i<(code_page_num*4096); i+=4096){
|
||||
setMapping(0x4000000+i, (void*)((uintptr_t)code_paddr+i), paging_tree);
|
||||
copy_page(paging_tree->l4, (uintptr_t)code_paddr+i, (void*)(0x4000000+i));
|
||||
}
|
||||
|
||||
for(uintptr_t i=0; i<(stack_page_num*4096); i+=4096){
|
||||
uintptr_t user_stackframe_p = ((uintptr_t)PageFrameAllocator::alloc(false));
|
||||
setMapping((uintptr_t)(stack_vaddr)+i, (void*)((uintptr_t)user_stackframe_p), paging_tree);
|
||||
setMapping((uintptr_t)(stack_vaddr)+i, (void*)((uintptr_t)user_stackframe_p), paging_tree->l4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user