summaryrefslogtreecommitdiff
path: root/include/rvl/OS/OSContext.h
blob: 80b7c4936001d27584744752e8ca1a41fc23e803 (plain)
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
#ifndef RVL_SDK_OS_CONTEXT_H
#define RVL_SDK_OS_CONTEXT_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    OS_CONTEXT_STATE_FP_SAVED = (1 << 0),
} OSContextState;

typedef struct OSContext {
    u32 gprs[32];  // at 0x0
    u32 cr;        // at 0x80
    u32 lr;        // at 0x84
    u32 ctr;       // at 0x88
    u32 xer;       // at 0x8C
    f64 fprs[32];  // at 0x90
    u32 fpscr_pad; // at 0x190
    u32 fpscr;     // at 0x194
    u32 srr0;      // at 0x198
    u32 srr1;      // at 0x19C
    u16 mode;      // at 0x1A0
    u16 state;     // at 0x1A2
    u32 gqrs[8];   // at 0x1A4
    u32 psf_pad;   // at 0x1C4
    f64 psfs[32];  // at 0x1C8
} OSContext;

void OSFillFPUContext(OSContext *ctx);
void OSSaveFPUContext(OSContext *ctx);
void OSSetCurrentContext(OSContext *ctx);
OSContext *OSGetCurrentContext(void);
BOOL OSSaveContext(OSContext *ctx);
void OSLoadContext(OSContext *ctx);
void *OSGetStackPointer(void);
void OSSwitchFiber(void *func, void *stack);
void OSSwitchFiberEx(u32 r3, u32 r4, u32 r5, u32 r6, void *func, void *stack);
void OSClearContext(OSContext *ctx);
void OSInitContext(OSContext *ctx, void *_srr0, void *stack);
void OSDumpContext(const OSContext *ctx);
void __OSContextInit(void);

#ifdef __cplusplus
}
#endif
#endif