1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Exclude the region where the kernel is loaded when allocating frames

The linked.ld script is extended to include the _kernel_start and
_kernel_end symbols which are passed by the rt0 code to Kmain. The
allocator converts these addresses to a start/end frame index by
rounding down the kernel start address to the nearest page and rounding
up the kernel end address to the nearest page.

When allocating frames, the allocator will treat the region defined by
these 2 indices as reserved and skip over it.
This commit is contained in:
Achilleas Anagnostopoulos
2017-06-17 10:53:53 +01:00
parent c81fd8b758
commit 8698e7bc93
3 changed files with 124 additions and 42 deletions

View File

@@ -24,7 +24,7 @@ func Kmain(multibootInfoPtr, kernelStart, kernelEnd uintptr) {
hal.InitTerminal()
hal.ActiveTerminal.Clear()
if err := allocator.Init(); err != nil {
if err := allocator.Init(kernelStart, kernelEnd); err != nil {
early.Printf("[%s] error: %s\n", err.Module, err.Message)
}
}