diff options
| author | user <user@clank> | 2026-07-16 12:49:19 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 12:49:19 +0200 |
| commit | 5fefd233769a56caefdb2ffecaa9fb8b9ec6db86 (patch) | |
| tree | 99f5b285a45c7b3792bb64e79fe58f70a6d01cab /src/proc.asm | |
| parent | fs rewrite stage 2: inodes + root directory (block-based, persistent) (diff) | |
| download | gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.tar.gz gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.tar.xz gbos-5fefd233769a56caefdb2ffecaa9fb8b9ec6db86.zip | |
fs rewrite stage 3: nested directories, paths, cwd (cd/mkdir/ls)
- directories generalized: dir_find/dir_add/dir_remove take any dir inode;
every dir carries '.'/'..'. Path resolution (resolve / resolve_parent) walks
absolute or cwd-relative paths; open/mkdir/chdir/remove/opendir take paths.
- per-process cwd: PROC_CWD in the PCB (root by default, inherited on fork);
sys_chdir sets it, sys_opendir points ls at any directory.
- shell: 'cd' builtin + cwd-aware prompt; 'mkdir'/'ls <dir>' tools; 'exit'/'quit'
and EOF call poweroff() (clean shutdown via the $ED opcode -> reliable save).
- three HL/buffer-clobber bugs fixed along the way: resolve didn't preserve the
path cursor across dir_find; cur_cwd clobbered HL; resolve_parent set the final
name before resolve() overwrote wFsNameBuf (now copied after).
- verified: nested mkdir/cd/save, multi-level paths (cat docs/sub/b), and the
whole tree persists across a reboot.
- README: document directories + the poweroff opcode.
Diffstat (limited to '')
| -rw-r--r-- | src/proc.asm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/proc.asm b/src/proc.asm index cd79160..c22d40d 100644 --- a/src/proc.asm +++ b/src/proc.asm @@ -226,7 +226,9 @@ ProcCreate:: ld [hl+], a ; PROC_STDIN = console ld [hl+], a ; PROC_STDOUT = console ld a, $FF - ld [hl], a ; PROC_PROG = none + ld [hl+], a ; PROC_PROG = none + ld a, ROOT_INO + ld [hl], a ; PROC_CWD = root ; build the initial stack frame in the task's RAM bank ld a, [wTmpEntry] @@ -458,7 +460,10 @@ sys_fork:: ld [hl+], a ; child STDOUT = parent STDOUT inc de ld a, [de] - ld [hl], a ; child PROC_PROG = parent PROC_PROG + ld [hl+], a ; child PROC_PROG = parent PROC_PROG + inc de + ld a, [de] + ld [hl], a ; child PROC_CWD = parent PROC_CWD ; ---- return to the parent with child pid ---- ld a, [wForkUserSP] |
