aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdata.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-15 23:44:28 +0200
committeruser <user@clank>2026-07-15 23:44:28 +0200
commitde725da74db5cba0f9bfd0755269e1683423d87b (patch)
treedc39eca9fbd290393ed51de31eee5e4bd6af8375 /src/kdata.asm
downloadgbos-de725da74db5cba0f9bfd0755269e1683423d87b.tar.gz
gbos-de725da74db5cba0f9bfd0755269e1683423d87b.tar.xz
gbos-de725da74db5cba0f9bfd0755269e1683423d87b.zip
gbos scaffold: working cooperative microkernel (verified ABAB in emulator)
- fix ClearKernelRAM clobbering the kernel stack (only clear $C000-$CBFF) - fix SyscallTrap clobbering DE (buffer arg) during table dispatch - README: run via ~/dev/gbc --headless; note bring-up bugs
Diffstat (limited to 'src/kdata.asm')
-rw-r--r--src/kdata.asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/kdata.asm b/src/kdata.asm
new file mode 100644
index 0000000..efc780a
--- /dev/null
+++ b/src/kdata.asm
@@ -0,0 +1,22 @@
+; =============================================================================
+; kdata.asm - kernel globals in fixed WRAM0 (always mapped, never swapped)
+; =============================================================================
+INCLUDE "include/gbos.inc"
+
+SECTION "kernel_bss", WRAM0[$C000]
+
+wProcTable:: DS MAX_PROCS * PROC_SIZE ; the process table
+wCurProc:: DS 2 ; pointer to running PCB
+wCurPid:: DS 1 ; running pid (reserved)
+wNextPid:: DS 1 ; pid allocator
+wSchedNext:: DS 1 ; round-robin cursor (slot index)
+wKernelPCB:: DS PROC_SIZE ; outgoing-context holder for 1st switch
+ ; (kernel/idle context; never resumed)
+
+; scratch used by ProcCreate
+wTmpEntry:: DS 2
+wTmpRamB:: DS 1
+wTmpWramB:: DS 1
+wTmpSlot:: DS 1
+wTmpPid:: DS 1
+wTmpSP:: DS 2