Prog OS - wowjinxy/libPorpoise GitHub Wiki
Prog - OS
Scope
Core OS services used by libPorpoise and demos: threads, alarms, message queues, heaps, timing, panic/report, reset flow, memory helpers.
API Coverage
- Implemented (runtime-critical):
OS.c,OSAlloc.c,OSThread.c/.cpp,OSMessage.c,OSAlarm.c,OSMutex.c,OSSemaphore.c,OSTime.c,OSReset.c
- Partial (works, but parity caveats):
OSInterrupt.c,OSMemory.c,OSFont.c,OSRtc.c
- Stub-heavy / compatibility-only:
OSContext.c,OSUart.c, init stubs inos/init/*
Behavior Notes
- Heap auto-init exists for PC convenience (
OSAlloc: Auto-initialized default heap). - Alarm API is wired, but
OSCreateAlarmis effectively a compatibility no-op on PC because alarm core setup happens inOSInit. - Shutdown/reset pipeline is implemented for desktop process lifecycle.
OSReportrecursion guard is active and has appeared in real runs.
Known Issues
- Threading parity: replace current TLS placeholder path in
OSThread.cwith true per-thread storage. - Scheduler/queue parity: remove remaining thread queue/scheduler stubs in
OSThread.c. - Context fidelity:
OSContext.cstill uses no-op/placeholder behavior for PPC context semantics. - Memory protection parity: finish advanced protection path in
OSMemory.c(TODOnoted in source). - RTC parity:
__OSSetRTCcurrently logs as not implemented on PC. - Font system parity: several
OSFont.cfunctions are compatibility stubs.
Validation
- Demos tested: multiple GX demos stable through long runs (thread/alarm/message usage).
- Pikmin impact: startup, loading threads, message queues, retrace loop, and reset/shutdown paths are active.
- Last verified commit:
6879cd0(project),3c58a4c(wiki scaffold).
Next Work (Checklist)
- Build an OS conformance matrix page mapping each public OS API to: implemented / partial / stub.
- Add focused stress tests for
OSSendMessage/OSReceiveMessagequeue behavior under contention. - Replace
OSThread.cscheduler stubs with deterministic condition-variable backed behavior. - Define and document explicit "intentional deviations" from SDK semantics (PC-only behavior).
- Add regression notes for every observed
[OSReport] Recursion detected!event (root cause + fix).
API Matrix
- Full tracking checklist: Prog-OS-API-Matrix
First-pass Matrix Scan
- Functions listed in matrix: 128
- Symbol-present in src/os + include/dolphin/os: 107
- Marked Missing by first-pass scan: 21
- Note: this is symbol-presence triage, not full behavior parity verification.