mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Implement simple terminal
The terminal uses console.Vga as its output device. A proper terminal implementation would be using a console.Console interface as its output. However, at this point we cannot use Go interfaces as the fn pointers in the itables have not been yet initialized. The Go runtime bits that set up the itables need access to a memory allocator, a facility which is not yet provided by the kernel.
This commit is contained in:
@@ -42,6 +42,13 @@ func (cons *Vga) Init() {
|
||||
}))
|
||||
}
|
||||
|
||||
// OverrideFb overrides the console framebuffer slice with the supplied slice.
|
||||
// This is a temporary function used by tests that will be removed once we can work
|
||||
// with interfaces.
|
||||
func (cons *Vga) OverrideFb(fb []uint16) {
|
||||
cons.fb = fb
|
||||
}
|
||||
|
||||
// Clear clears the specified rectangular region
|
||||
func (cons *Vga) Clear(x, y, width, height uint16) {
|
||||
var (
|
||||
|
||||
@@ -202,3 +202,15 @@ func TestVgaWrite(t *testing.T) {
|
||||
t.Errorf("expected call to Write() to set fb[0] to %d; got %d", expVal, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVgaOverrideFb(t *testing.T) {
|
||||
var cons = Vga{}
|
||||
cons.Init()
|
||||
|
||||
fb := []uint16{}
|
||||
cons.OverrideFb(fb)
|
||||
|
||||
if len(cons.fb) != len(fb) {
|
||||
t.Fatalf("expected calling OverrideFb to change the framebuffer for the console")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user