aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdata.asm
blob: 6c520dd4613bc4671c5ffb9ae4eb87b3cde6af0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; =============================================================================
; 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

; cart-RAM bank allocator: 0 = free, 1 = in use. bank 0 is the init task's.
wBankUsed::    DS NUM_RAM_BANKS

; scratch used by sys_fork
wForkUserSP::    DS 2      ; parent user SP at fork entry (= Uafter)
wForkChildSlot:: DS 1
wForkChildPid::  DS 1
wForkParentBank::DS 1
wForkChildBank:: DS 1
wCopyBuf::       DS 256    ; bank-copy bounce buffer (WRAM0, always mapped)

; scratch used by sys_exit / sys_wait
wExitMyPid::     DS 1
wExitParentPid:: DS 1
wWaitMyPid::     DS 1
wWaitRetPid::    DS 1
wWaitRetCode::   DS 1

; filesystem: open-file table + scratch
wOFTable::   DS OF_MAX * OF_SIZE
wFsMode::    DS 1
wFsSlot::    DS 1
wFsByte::    DS 1
wFsOFPtr::   DS 2
wFsCurBlk::  DS 1       ; data block currently in fs_datbuf ($FF = none)
wFsDirty::   DS 1       ; fs_datbuf needs write-back
wFsInode::   DS 1       ; working inode number
wFsNameBuf:: DS 16      ; kernel-side copy of a name/component
wFsDir::     DS 1       ; directory inode for dir_* ops
wFsDirBlk::  DS 1       ; that directory's data block (for write-back)
wFsCur::     DS 1       ; current inode during path resolution
wFsPath::    DS 40      ; kernel-side copy of a path argument
wFsSlashPtr::DS 2       ; last '/' seen while splitting a path
wListDir::   DS 1       ; directory sys_list enumerates
wKChar::     DS 1       ; scratch for KPutc
wKillParent::DS 1       ; scratch for sys_kill
wPsBuf::     DS 2       ; scratch for sys_ps
wPnStart::   DS 2       ; scratch for sys_progname