The hal package automatically selects the best font from the list of
available fonts based on the console dimensions and the font priorities. The font
selection can be overriden by passing the "consoleFont" boot commandline
parameter to the kernel (e.g. consoleFont=terminus8x16)
Ths page offset is defined in arch/XXX/constants.inc and needs to be
passed to the kernel so we can correctly calculate the physical frame
addresses that correspond to the ELF section virtual memory addresses.
The GDT is initially loaded in the 32-bit rt0 code where we cannot use
the 48-bit VMA for the GDT table and instead we use its physical
address. This approach works as the rt0 code establishes an identity
mapping for the region 0-8M. However, when the kernel creates a more
granular PDT it only includes the VMA addresses for the kernel ELF image
sections making the 0-8M invalid. Unless the GDT is reloaded with the
VMA of the table, the CPU will cause a non-recoverable page fault when
it tries to restore the segment registers while returning from a
recoverable page fault.
Currently, the kernel can write to 0xb80000 because this is part of the
initial identify mapping set up by the rt0 code. When we establish new
mappings for the kernel using its real VMA address then writes to the
framebuffer will cause a page fault unless we explicitly map it.
This commit removes the HWProbes() function from the console and tty
packages and replaces it with a global ProbeFuncs slice which is fetched
by the hal package when the hardware autodetection code runs.
Each driver should provide an init() function that appends a probe function
to the global ProbeFuncs slice.
This approach allows us to support conditional compilation of drivers in
the future (e.g. using build tags)
The implementation of Printf has been moved from the early package to
the kfmt package. The dependency to ActiveTerminal has been removed and
the code now uses an io.Writer for its output. As Go interfaces cannot
be used before bootstrapping the Go runtime, the code uses a ring-buffer
fallback for storing any kernel output emitted before that point.
The ring-buffer implements both io.Reader and io.Writer and uses a fixed
size of 2048 bytes (set by the ringBufferSize constant). This provides
enough space to hold a standard 80x25 screen's output.
This commit refactors the old VT implementation to work with the revised
TTY interface and adds support for:
- scrollback
- terminal state handling
When a terminal becomes activated, it overwrites the attached console
contents with the contents of its viewport.