Bootup sequance:
1.) Multiboot boot loader loads kernel
- .start: loaded at 0x100000, linked at 0x100000
- .text: after .start, linked at 0xC0000000 + .start size
- .data: after .text
- .bss: after .data
.start contains multiboot header followed by boot code
2.) Boot loader jumps to .start
3.) .start parses command line
4.) .start sets ESP to 0x100000
3.) .start creates physical free memory stack, skipping anything left from multiboot that must be saved, and the kernel
4.) .start initisilizes GDT, etc., and puts multiboot info after 0xC0400000, and keeps both 0x100000 and 0xC0000000 pointing to it
5.) .start initisilizes kernel heap and puts approate numbers in place for malloc, etc. (using 0xC0000000 area and includes the multiboot info as allocated)
6.) .start cleans up, and sets ESP to 0xD0000000 (allocate this from physical memory also)
7.) .start pushes pointer to an information strcuture
8.) .start jumps to kmain()
9.) kmain() removes 0x100000 from page tables
0xD0000000 - Top of stack, 256 MB from kernel (move this up if necessory)
0XC0400000 - Start of multiboot info, each bit of info goes into its own page, in between is unallocated, unallocate (free()) when done with it (if kernel > 4 MB, move this up)
0xC0xxxxxx - Physical memory allocation stack (at start of heap, is allocated according to malloc() rules)
0xC0xxxxxx - Start of heap (after kernel)
0xC00xxxxx - kernel .text, .data, and .bss (after .start)
0xC0000000 - .start location (logical)
0x100000 - .start location (physical)