fork() with higher half kernel
Posted: Thu Jul 23, 2015 5:34 am
Hello,
i'm having a big problem at the moment, i don't know *anything* i could do about it.
I am using a higher half kernel, mapped at 3GB. Now i am implementing multithreading. Everything works really good at the moment, i can run two processes in kernel-space and i can even load my initrd elf file and start this one. But now i want to implement exec() and fork(). The thing is, for fork, i need to create a new page-directory and 'deep'-copy everything over. This means, new page-tables and everything that is mapped in process1's address-space needs to be copied. But, i don't see any possibility how i could copy the data in ram since there is 'no' way i can map in both directory's at the same time (Remember, after i've copied the page-directory and all tables, 0x10 in the first addressspace maps to another physical address then 0x10 in the second addressspace). I've seen in some tutorial that he disabled paging to copy everything over, but i just can't disable paging since my IP is at some high address >3GB. The only way i could think of is identity-map the kernel again, jump back to a ~1MB address, disable paging, copy everything over, enable paging again, jump back to higher half. But not even that is (easy) doable since the processes address-spaces are *not* necessarily a continuous block of *physical* memory.
Every bit of information could be helpful, i hope someone can give me a pointer
i'm having a big problem at the moment, i don't know *anything* i could do about it.
I am using a higher half kernel, mapped at 3GB. Now i am implementing multithreading. Everything works really good at the moment, i can run two processes in kernel-space and i can even load my initrd elf file and start this one. But now i want to implement exec() and fork(). The thing is, for fork, i need to create a new page-directory and 'deep'-copy everything over. This means, new page-tables and everything that is mapped in process1's address-space needs to be copied. But, i don't see any possibility how i could copy the data in ram since there is 'no' way i can map in both directory's at the same time (Remember, after i've copied the page-directory and all tables, 0x10 in the first addressspace maps to another physical address then 0x10 in the second addressspace). I've seen in some tutorial that he disabled paging to copy everything over, but i just can't disable paging since my IP is at some high address >3GB. The only way i could think of is identity-map the kernel again, jump back to a ~1MB address, disable paging, copy everything over, enable paging again, jump back to higher half. But not even that is (easy) doable since the processes address-spaces are *not* necessarily a continuous block of *physical* memory.
Every bit of information could be helpful, i hope someone can give me a pointer