1
0
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:
Achilleas Anagnostopoulos
2017-03-26 21:35:17 +01:00
parent 95ce4c6057
commit 616fc6a412
4 changed files with 207 additions and 0 deletions

View File

@@ -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 (

View File

@@ -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")
}
}