Thpertic wrote:
- I'm using recursive paging so as Page Directory should I use 0xFFFFF000 or the address pointed by it?
Use the one that in a task switch restores the same paging you're using now (the boot task's). I believe that should be the value in CR3.
Thpertic wrote:
- In the case of the first process (the one running from boot) do I have to use the ESP value or I have to allocate another 4K block as the other processes?
I think Brendan meant the current ESP.
However I'd like to point out that Brendan's advice is not the preferred nor the only way to do multitasking. There are many kernel task switching designs which makes this whole initial task structure mess completely unnecessary. And it won't work with SMP anyway (there each core should have its own stacks, and to store different ESP you'll need as many task structures as number of cores at minimum).
For example in my kernel I use identity mapping for the boot task, and once I switch to the first real task, there's absolutely no reason to switch back to identity mapping ever again. Memory allocated during early stage in boot task is simply accounted for the idle task on the BSP. Hence my kernel doesn't need this dirty initial task hack at all that Brendan is talking about.
Cheers,
bzt