aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdata.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-24 23:08:35 +0200
committeruser <user@clank>2026-09-24 23:08:35 +0200
commit1430515ad419f2fddeb0265337a0da043901411b (patch)
treee94c53cb7d59ca4826242b81afeb3de3c655d02e /src/kdata.asm
parentusr: touch, tr, rev, cut, uniq (diff)
downloadgbos-1430515ad419f2fddeb0265337a0da043901411b.tar.gz
gbos-1430515ad419f2fddeb0265337a0da043901411b.tar.xz
gbos-1430515ad419f2fddeb0265337a0da043901411b.zip
fs: hard links - ln(1), and rm that removes a NAME
gbfs has carried I_NLINK since the beginning and nothing ever incremented it, so a file could only have one name. SYS_LINK adds a second directory entry pointing at the same inode: the data is stored once, and both names read it. That makes rm's job different. It now decrements the link count and only frees the inode and its blocks when the LAST name goes - removing one of two links used to free blocks the other still pointed at. Refused, with the reasons that matter here: linking a directory (it would make a cycle the tree walkers cannot survive), an existing name, and anything under /bin, which is ROM. The syscall takes a request block because the trap needs HL for its dispatch table - and ln copies both paths to the stack first, since that block is a static living at $A000, on top of the command line it is reading.
Diffstat (limited to 'src/kdata.asm')
-rw-r--r--src/kdata.asm3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kdata.asm b/src/kdata.asm
index b6c2b68..9322b4e 100644
--- a/src/kdata.asm
+++ b/src/kdata.asm
@@ -68,6 +68,9 @@ wBootA:: DS 1 ; A at entry: console model from the boot ROM
wBootB:: DS 1 ; B at entry: bit0 set = AGB (GBA in CGB mode)
wBootFsFresh::DS 1 ; fs_init formatted a blank disk this boot
wTicks:: DS 4 ; monotonic 64 Hz system tick (TimerISR), LE
+wEpoch:: DS 4 ; wall clock: unix seconds at wEpochTick (LE), 0 = unset
+wEpochTick:: DS 4 ; the tick wEpoch was taken at (LE)
+wTimeTmp:: DS 4 ; sys_gettime scratch (elapsed ticks -> seconds)
wTickTog:: DS 1 ; TimerISR fires at 128 Hz in double-speed mode;
; this toggle keeps wTicks counting at 64 Hz
wBatch:: DS 1 ; inside a sys_write: defer terminal tile rendering