diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 17:19:09 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 17:19:09 +0200 |
| commit | fa06681a8418b7e31af96e010bb424e178402f4d (patch) | |
| tree | 3b2fa8674384078f73b62274c71e8279ca6d0644 /CONTEXT.md | |
| parent | shell: ^C cancels the line / aborts streams, ^D = EOF → poweroff (diff) | |
| download | rs-dos-fa06681a8418b7e31af96e010bb424e178402f4d.tar.gz rs-dos-fa06681a8418b7e31af96e010bb424e178402f4d.zip | |
tty + vt terminal split, rsdosedit editor (1:1 UNIX console)
Kernel now has the classic UNIX console split, so full-screen ANSI apps
can run in ring 0:
- vt.rs: terminal emulator owning the text screen — cell grid (char +
fg/bg), logical cursor (inverse-video), scrolling, and a small ANSI
CSI parser (cursor position H/f, erase J/K, moves A-D, SGR 16-colour
with correct ANSI→VGA mapping, cursor show/hide ?25). Blits only
changed cells; scroll shifts cell grids + pixels and re-rasterises
only the exposed bottom row. gop_println!/clear_screen now render
through the vt; gop.rs is the raw rasteriser (colored glyph blits,
pixel shift).
- tty.rs: line discipline — canonical read_line (echo, line buffer,
^C cancel, ^D EOF) moved out of the shell, and raw read_byte that
translates KeyEvents to the terminal byte protocol (arrows → ESC[A-D,
Backspace → 0x7f, ^X → 0x18, Ctrl+arrows → ESC[1;5A-D, Home/End/PgUp/
PgDn/Delete). interrupt_pressed() stays for streaming commands.
- ps2: generic Ctrl(char) + CtrlArrow events (was: only CtrlC/CtrlD).
- rsdosedit: no_std port of the RNG rsedit editor as the first real
app — undo, syntax highlighting (verified green/gray/yellow on the
framebuffer), search, word nav, smart indent, ^S save / ^X exit /
^X again to discard. termios → tty raw, stdout → vt, std::fs → VFS
(ramfs), SIGWINCH → fixed geometry, force-exit window → key counter.
- shell: 'edit <path>' command; read_line/strbuf moved to rsnix.
- CONTEXT.md: layout + milestones + known-issue perf notes.
Verified in QEMU: full edit → type → arrow-move → insert → save → exit
round trip with byte-exact file content; ANSI colors via screendump.
Diffstat (limited to '')
| -rw-r--r-- | CONTEXT.md | 38 |
1 files changed, 36 insertions, 2 deletions
| @@ -101,10 +101,20 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: | |||
| 101 | - `fs.rs` — VFS: dirs, ramfs files, char devices (`/dev/mem`, `rtc`, `pci`, | 101 | - `fs.rs` — VFS: dirs, ramfs files, char devices (`/dev/mem`, `rtc`, `pci`, |
| 102 | `version`, `meminfo`, `null`, `zero`, `console`, `serial`; `/tmp` ramfs; | 102 | `version`, `meminfo`, `null`, `zero`, `console`, `serial`; `/tmp` ramfs; |
| 103 | `/etc/motd`) | 103 | `/etc/motd`) |
| 104 | - `gop.rs` — framebuffer access and text rendering | 104 | - `gop.rs` — framebuffer rasteriser (glyph blits, pixel shifts); the text |
| 105 | surface itself lives in `vt` | ||
| 106 | - `vt.rs` — terminal emulator: cell grid, cursor, ANSI CSI parser (H/J/K, | ||
| 107 | cursor moves, SGR 16-colour, `?25l/h`), dirty-cell blitting | ||
| 108 | - `tty.rs` — line discipline: canonical `read_line` (echo, line buffer, | ||
| 109 | ^C/^D) and raw `read_byte` (terminal byte protocol: arrows → `ESC [ A–D`, | ||
| 110 | ^X → `0x18`, …) | ||
| 111 | - `strbuf.rs` — stack fixed-capacity ASCII string (moved from shell) | ||
| 105 | - `font.rs` — 8×16 bitmap font data | 112 | - `font.rs` — 8×16 bitmap font data |
| 106 | - `ps2.rs` — PS/2 keyboard driver (polling) | 113 | - `ps2.rs` — PS/2 keyboard driver (polling); generic `Ctrl(char)` and |
| 114 | `CtrlArrow` events | ||
| 107 | - `shell.rs` — command loop and built-in commands | 115 | - `shell.rs` — command loop and built-in commands |
| 116 | - `rsdosedit/` — kernel-native port of the RNG `rsedit` terminal editor | ||
| 117 | (no_std; talks to `tty` raw mode + `vt` ANSI; saves via the VFS) | ||
| 108 | 118 | ||
| 109 | ## Milestone status (v0.1) | 119 | ## Milestone status (v0.1) |
| 110 | 120 | ||
| @@ -133,6 +143,30 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: | |||
| 133 | ✅ **^C / ^D** — Ctrl+C cancels the line or aborts a running stream | 143 | ✅ **^C / ^D** — Ctrl+C cancels the line or aborts a running stream |
| 134 | (`cat`/`hexdump` check between chunks), Ctrl+D on an empty line | 144 | (`cat`/`hexdump` check between chunks), Ctrl+D on an empty line |
| 135 | powers off (EOF) | 145 | powers off (EOF) |
| 146 | ✅ **tty + vt (terminal) — the 1:1 UNIX console split**: `tty` owns the | ||
| 147 | line discipline (canonical echo/buffer/^C/^D for the shell; raw mode | ||
| 148 | translates keys to the classic terminal byte protocol), `vt` owns the | ||
| 149 | screen (cell grid + ANSI CSI parser + 16-colour SGR + dirty-cell blits | ||
| 150 | into the GOP framebuffer). `gop_println!` etc. now render through `vt`. | ||
| 151 | ✅ **rsdosedit** — the RNG `rsedit` editor ported to the kernel (no_std, | ||
| 152 | no libc): `edit <path>` opens a full-screen editor with undo, syntax | ||
| 153 | highlighting, search (^W), save (^S), exit (^X, twice to discard), word | ||
| 154 | nav (Ctrl+arrows), smart indent. Files live in the ramfs. Termios → | ||
| 155 | `tty` raw mode, stdout → `vt`, `std::fs` → VFS, SIGWINCH → fixed | ||
| 156 | geometry. Verified in QEMU: edit/type/navigate/insert/save/exit, exact | ||
| 157 | bytes via `cat`/`hexdump`, syntax colours via framebuffer dump. | ||
| 158 | |||
| 159 | ## Known issues / perf notes | ||
| 160 | |||
| 161 | - **Scroll is slow under QEMU without KVM**: each scroll shifts the whole | ||
| 162 | framebuffer up (~3 MB copy at 1280×800) with TCG-emulated stores. | ||
| 163 | Deferred optimisation: ring-buffer rows / deferred pan so scrolling | ||
| 164 | never touches the whole framebuffer. The vt's cell grid already avoids | ||
| 165 | re-rasterising on scroll (only the exposed bottom row is blitted). | ||
| 166 | - **Editor redraw** re-blits changed cells per keystroke (fine at 1280×800); | ||
| 167 | the "optimize drawing someday" item. | ||
| 168 | - **ramfs only**: edited files live in memory, lost on reboot until disk | ||
| 169 | support (AHCI/FAT32) lands. | ||
| 136 | 170 | ||
| 137 | ## Target audience | 171 | ## Target audience |
| 138 | 172 | ||
