mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Initialize a minimal terminal attached to a text console device
This commit is contained in:
parent
50da8ab106
commit
66eedf1200
@ -0,0 +1,21 @@
|
|||||||
|
package hal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/achilleasa/gopher-os/kernel/driver/tty"
|
||||||
|
"github.com/achilleasa/gopher-os/kernel/driver/video/console"
|
||||||
|
"github.com/achilleasa/gopher-os/kernel/hal/multiboot"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
egaConsole = &console.Ega{}
|
||||||
|
ActiveTerminal = &tty.Vt{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitTerminal provides a basic terminal to allow the kernel to emit some output
|
||||||
|
// till everything is properly setup
|
||||||
|
func InitTerminal() {
|
||||||
|
fbInfo := multiboot.GetFramebufferInfo()
|
||||||
|
|
||||||
|
egaConsole.Init(uint16(fbInfo.Width), uint16(fbInfo.Height), uintptr(fbInfo.PhysAddr))
|
||||||
|
ActiveTerminal.AttachTo(egaConsole)
|
||||||
|
}
|
@ -3,6 +3,7 @@ package kernel
|
|||||||
import (
|
import (
|
||||||
_ "unsafe" // required for go:linkname
|
_ "unsafe" // required for go:linkname
|
||||||
|
|
||||||
|
"github.com/achilleasa/gopher-os/kernel/hal"
|
||||||
"github.com/achilleasa/gopher-os/kernel/hal/multiboot"
|
"github.com/achilleasa/gopher-os/kernel/hal/multiboot"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,4 +20,8 @@ import (
|
|||||||
//go:noinline
|
//go:noinline
|
||||||
func Kmain(multibootInfoPtr uint32) {
|
func Kmain(multibootInfoPtr uint32) {
|
||||||
multiboot.SetInfoPtr(uintptr(multibootInfoPtr))
|
multiboot.SetInfoPtr(uintptr(multibootInfoPtr))
|
||||||
|
|
||||||
|
// Initialize and clear the terminal
|
||||||
|
hal.InitTerminal()
|
||||||
|
hal.ActiveTerminal.Clear()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user