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

Move Kmain into its own package

This allows us to keep the error definition in the kernel package
without causing circular import errors
This commit is contained in:
Achilleas Anagnostopoulos
2017-05-31 15:07:02 +01:00
parent d5a4c43406
commit ec6ce4b70e
3 changed files with 4 additions and 4 deletions

27
kernel/kmain/kmain.go Normal file
View File

@@ -0,0 +1,27 @@
package kmain
import (
"github.com/achilleasa/gopher-os/kernel/hal"
"github.com/achilleasa/gopher-os/kernel/hal/multiboot"
"github.com/achilleasa/gopher-os/kernel/mem/pmm"
)
// Kmain is the only Go symbol that is visible (exported) from the rt0 initialization
// code. This function is invoked by the rt0 assembly code after setting up the GDT
// and setting up a a minimal g0 struct that allows Go code using the 4K stack
// allocated by the assembly code.
//
// The rt0 code passes the address of the multiboot info payload provided by the
// bootloader.
//
// Kmain is not expected to return. If it does, the rt0 code will halt the CPU.
//
//go:noinline
func Kmain(multibootInfoPtr uintptr) {
multiboot.SetInfoPtr(multibootInfoPtr)
hal.InitTerminal()
hal.ActiveTerminal.Clear()
pmm.EarlyAllocator.Init()
}