ARM9 OS: Difference between revisions
Hallowizer (talk | contribs) →Threads: remove some extra unknown fields that are part of structs |
Hallowizer (talk | contribs) →Threads: kernelSp is a system stack used for thread cleanup and SVCs |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 30: | Line 30: | ||
void *lr; // 0x3c | void *lr; // 0x3c | ||
void *pc; // 0x40 | void *pc; // 0x40 | ||
void * | void *systemStack; // 0x44 | ||
struct OSMathContext math; // 0x48 | struct OSMathContext math; // 0x48 | ||
} | } | ||
| Line 47: | Line 47: | ||
void *stackLo; // 0x90 | void *stackLo; // 0x90 | ||
void *stackHi; // 0x94 | void *stackHi; // 0x94 | ||
void *unknown2; // 0x98 | |||
struct OSThreadQueue queueJoin; // 0x9c | struct OSThreadQueue queueJoin; // 0x9c | ||
u32 unknown3[3]; // 0xa4 | u32 unknown3[3]; // 0xa4 | ||
struct OSAlarm *timedSleepAlarm; // 0xb0 | struct OSAlarm *timedSleepAlarm; // 0xb0 | ||
u32 | void (*cleanupFunc)(u32 res); // 0xb4 | ||
u32 unknown4[2]; | |||
} | } | ||
| Line 94: | Line 95: | ||
== Time == | == Time == | ||
Timer 0 is used to keep track of global time by manually incrementing a global, while timer 1 is used to generate an interrupt for alarms. The OS orders the alarms by alert time, so that it only needs to keep track of the frontmost alarm. | |||
<pre> | <pre> | ||
| Line 114: | Line 115: | ||
} | } | ||
</pre> | </pre> | ||
== Interrupts == | |||
The interrupt handler called by the [[ARM9 BIOS]] calls a handler in a table mapping the raw IRQ IDs to handlers. Each handler is either a no-op (not listed in the table below) or a stub that calls <code>__OSDispatchInterrupt</code> with an OS interrupt ID. <code>__OSDispatchInterrupt</code> then calls the handler registered with <code>__OSSetInterruptHandler</code>. | |||
{| class="wikitable sortable" | |||
! Hardware ID | |||
! Translated ID | |||
! Name | |||
|- | |||
| 3 | |||
| 8 | |||
| Timer 0 overflow | |||
|- | |||
| 4 | |||
| 9 | |||
| Timer 1 overflow | |||
|- | |||
| 5 | |||
| 10 | |||
| Timer 2 overflow | |||
|- | |||
| 6 | |||
| 11 | |||
| Timer 3 overflow | |||
|- | |||
| 8 | |||
| 0 | |||
| DMA 0 | |||
|- | |||
| 9 | |||
| 1 | |||
| DMA 1 | |||
|- | |||
| 10 | |||
| 2 | |||
| DMA 2 | |||
|- | |||
| 11 | |||
| 3 | |||
| DMA 3 | |||
|- | |||
| 28 | |||
| 4 | |||
| New DMA 0 | |||
|- | |||
| 29 | |||
| 5 | |||
| New DMA 1 | |||
|- | |||
| 30 | |||
| 6 | |||
| New DMA 2 | |||
|- | |||
| 31 | |||
| 7 | |||
| New DMA 3 | |||
|} | |||