aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdata.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-24 14:15:46 +0200
committeruser <user@clank>2026-09-24 14:15:46 +0200
commit50a56b48f22cd31868403f1fde10cf8367344e2e (patch)
tree57c606182378dde67ce63d115ea07f98cc96b709 /src/kdata.asm
parentusr: xxd - hex dump a file or stdin (diff)
downloadgbos-50a56b48f22cd31868403f1fde10cf8367344e2e.tar.gz
gbos-50a56b48f22cd31868403f1fde10cf8367344e2e.tar.xz
gbos-50a56b48f22cd31868403f1fde10cf8367344e2e.zip
fs: mount the builtins at /bin
The commands only existed in the kernel's program table, so the only way to find out what the machine could do was to already know (or read the source). They are now a directory in the tree: /# ls / /# xxd -l 16 /bin/uname bin 0000: cd 6b 43 06 00 0e 00 f7 .kC..... readme 0008: 18 fe 47 0e 03 f7 c9 21 ..G....! /# ls -l /bin | head -2 - 1 16384 worker /bin is synthetic, not disk: dir_find resolves "bin" in the root to BIN_INO and names inside it through the NameTable, so `ls /bin` lists exactly what the shell can run - one table, one truth, no second list to keep in sync. The root listing carries "bin" as a synthetic first entry so it is discoverable by walking the tree. A program image is inode BIN_FILE|progid: it stats as a 16 KiB file (a program IS its ROM bank) and reads through rom_getb, which maps that bank, takes the byte, and maps the CALLER'S text bank back before returning - the caller is itself executing from $4000, so leaving the wrong bank mapped would return into another program's code. Verified byte-for-byte against the host's view of the blob. The tree is read-only: create/remove/write inside /bin all fail. xxd grows -l (stop after N bytes), because a program image is 2048 dump lines - more than a pipe's temp file can hold, let alone the screen. Two traps worth remembering, both found the hard way here: `and BIN_FILE` destroys A, so the inode must be reloaded before inode_ptr (missing it once made ls -l stat inode 0 and call every file an empty non-directory); and ls now copies its directory argument to the stack first, because stat()'s request block is a static living at $A000 - on top of the command line it was reading.
Diffstat (limited to 'src/kdata.asm')
0 files changed, 0 insertions, 0 deletions