PeterX wrote:1.) Can the page directory point directly to a page? (Or only to page tables?)
Yes. That would be the 4MB paging you talk about later.
PeterX wrote:2.) In the page directory's definition there is size only 4KiB or 4MiB?
Well, if you are operating in long mode, you can get 4KB, 2MB, or 1GB.
PeterX wrote:3.) The bit 0 in CR0 is already set when the long mode is entered, right?
So why do we have to OR this bit when enabling paging?
Because it doesn't hurt. You have to load CR0 anyway, the OR instruction takes the same amount of time and space either way, so might as well set PE. My guess is that this is a left over from a test for entering long mode directly. When AMD64 was still new and fresh, a couple of hackers on this board noticed that it is possible on real implementations to switch directly from real mode to long mode by just skipping the protected mode step in the middle. And while that was technically possible, it was out-of-spec, so I never implemented that, and neither did some others. Plus, you only save a couple of instructions in the SMP trampoline. You don't save anything in the legacy multiboot path, since there, you already are in 32-bit mode by the time you gain control, and you don't save anything in the UEFI path, either, since there you are already in 64-bit mode. So this possibility was only ever of use for SMP trampolines and hand-rolled bootloaders.