mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
The code responsible for mapping the kernel sections worked under the assumption that the linker would align all sections on a page boundary. To figure out the page extents for a particular section, the implementation would round the section VMA down to the nearest page and add to that the section length rounded up to the nearest page size. However, some sections (e.g. noptrbss) use 32 byte alignment. Depending on the section length, the original implementation could in some cases skip mapping of the last page in the section which would cause a page fault when its contents were accessed. The fix for this issue is quite simple: calculate the end page by rounding up (section start addr + section length) to the next page.