the bitrig pedro_amd64_locore branch has been created by pedro. it is 0 commits behind master, and 1 commit ahead.
commit d07c0b9816e7137efab9205fff07257e27703ee3 diff: https://github.com/bitrig/bitrig/commit/d07c0b9 author: pedro martelletto <[email protected]> date: Wed Nov 12 11:34:06 2014 +0100 fix amd64 boot problems the changes implemented in 1921a655 made the kernel able to boot images of arbitrary size, without the user having to fine tune initial bootstrap pmap parameters. this meant getting rid of fixed definitions and calculating NKL2_KIMG_ENTRIES (the number of L2 page table entries allocated for the kernel image) as well as TABLESIZE (the size of the kernel's initial page tables) on the fly. in order to avoid having to calculate TABLESIZE repeatedly, the code in 1921a655 calculated the value once and stored it on the stack, which at this point is contained within the kernel image (tmpstk) and backed by the initially established identity mapping. we then proceed with the kernel's initialisation and, once in long mode, dispose of the identity mapping. there is, however, one final reference to TABLESIZE in the stack, which now lies in unmapped memory! note that there are no TLB flushes inbetween, so albeit involving unmapped memory, theoretically this access should work but, as demonstrated by QEMU when configured with specific settings (i don't have the details) sometimes it does not. in any case, this is a grey area -- and definitely unintended behaviour! -- that can be easily circumvented by just calculating TABLESIZE again, and this is what this diff does. M sys/arch/amd64/amd64/locore.S
