ARM9 OS

From DSiBrew
Revision as of 02:38, 30 June 2022 by Hallowizer (talk | contribs) (created with info i found in the dsi system menu. note that "unknown" means I haven't found it, not that nobody knows.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The ARM9 SDK contains an OS library that handles various functions. It does not have many debugging strings, so most names listed on this page are taken from the Wii.

Threads

struct OSFpContext {
	f64 REG_DIV_NUMER; // 0x0
	f64 REG_DIV_DENOM; // 0x8
	f64 SQRT_PARAM; // 0x10
	u16 REG_DIVCNT; // 0x18
	u16 REG_SQRTCNT; // 0x1a
}

struct OSContext {
	u32 psr; // 0x0
	u32 r0; // 0x4
	u32 r1; // 0x8
	u32 r2; // 0xc
	u32 r3; // 0x10
	u32 r4; // 0x14
	u32 r5; // 0x18
	u32 r6; // 0x1c
	u32 r7; // 0x20
	u32 r8; // 0x24
	u32 r9; // 0x28
	u32 r10; // 0x2c
	u32 r11; // 0x30
	u32 r12; // 0x34
	void *sp; // 0x38
	void *lr; // 0x3c
	void *pc; // 0x40
	void *kernelSp; // 0x44
	struct OSFpContext fp; // 0x48
}

struct OSThread {
	struct OSContext ctx; // 0x0
	u32 state; // 0x64
	struct OSThread *nextRunning; // 0x68
	u32 threadId; // 0x6c
	u32 priority; // 0x70
	u32 unknown; // 0x74
	struct OSThreadQueue *queue; // 0x78
	struct OSThreadLink linkQueue; // 0x7c
	// more unknown fields - the total length is not known
}

struct OSThreadQueue {
	struct OSThread *head;
	struct OSThread *tail;
}

struct OSThreadLink {
	struct OSThread *prev;
	struct OSThread *next;
}