mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Define kernel entry-points in Go
This commit is contained in:
parent
5b47048397
commit
865f46c467
18
boot.go
Normal file
18
boot.go
Normal file
@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import "github.com/achilleasa/gopher-os/kernel"
|
||||
|
||||
// main is the only Go symbol that is visible (exported) from the rt0 initialization
|
||||
// code. This function works as a trampoline for calling the actual kernel entrypoint
|
||||
// (kernel.Kmain) and its intentionally defined to prevent the Go compiler from
|
||||
// optimizing away the actual kernel code as its not aware of the presence of the
|
||||
// rt0 code.
|
||||
//
|
||||
// The main 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.
|
||||
//
|
||||
// main is not expected to return. If it does, the rt0 code will halt the CPU.
|
||||
func main() {
|
||||
kernel.Kmain()
|
||||
}
|
5
kernel/kmain.go
Normal file
5
kernel/kmain.go
Normal file
@ -0,0 +1,5 @@
|
||||
package kernel
|
||||
|
||||
// Kmain is invoked by the boot.go and implements the actual kernel entrypoint.
|
||||
func Kmain() {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user