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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user