mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-09-03 00:53:49 -04:00
Link all of dolphin/os
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "dolphin/os/OSModule.h"
|
||||
#include "dolphin/os/OSLink.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -94,6 +94,23 @@ void PPCSetFpNonIEEEMode(void);
|
||||
#define MSR_RI 0x00000002 // Recoverable interrupt
|
||||
#define MSR_LE 0x00000001 // Little Endian
|
||||
|
||||
#define MSR_POW_BIT 13 // Power Management
|
||||
#define MSR_ILE_BIT 15 // Interrupt Little Endian
|
||||
#define MSR_EE_BIT 16 // external interrupt
|
||||
#define MSR_PR_BIT 17 // privilege level (should be 0)
|
||||
#define MSR_FP_BIT 18 // floating point available
|
||||
#define MSR_ME_BIT 19 // machine check enable
|
||||
#define MSR_FE0_BIT 20 // floating point exception enable
|
||||
#define MSR_SE_BIT 21 // single step trace enable
|
||||
#define MSR_BE_BIT 22 // branch trace enable
|
||||
#define MSR_FE1_BIT 23 // floating point exception enable
|
||||
#define MSR_IP_BIT 25 // Exception prefix
|
||||
#define MSR_IR_BIT 26 // instruction relocate
|
||||
#define MSR_DR_BIT 27 // data relocate
|
||||
#define MSR_PM_BIT 29 // Performance monitor marked mode
|
||||
#define MSR_RI_BIT 30 // Recoverable interrupt
|
||||
#define MSR_LE_BIT 31 // Little Endian
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+3
-14
@@ -2,6 +2,7 @@
|
||||
#define DB_H
|
||||
|
||||
#include "types.h"
|
||||
#include <dolphin/db/DBInterface.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
@@ -9,20 +10,8 @@ extern "C"{
|
||||
|
||||
#define OS_DBINTERFACE_ADDR 0x00000040
|
||||
|
||||
typedef struct DBInterface
|
||||
{
|
||||
u32 bPresent;
|
||||
u32 exceptionMask;
|
||||
void (*ExceptionDestination) ( void );
|
||||
void *exceptionReturn;
|
||||
} DBInterface;
|
||||
|
||||
extern DBInterface* __DBInterface;
|
||||
|
||||
void DBInit(void);
|
||||
void DBInitComm(int* inputFlagPtr, int* mtrCallback);
|
||||
static void __DBExceptionDestination(void);
|
||||
void DBPrintf(char* format, ...);
|
||||
BOOL DBIsDebuggerPresent(void);
|
||||
void DBPrintf(char* str, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef _DOLPHIN_DBINTERFACE_H_
|
||||
#define _DOLPHIN_DBINTERFACE_H_
|
||||
|
||||
#include <dolphin/os.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DBInterface {
|
||||
u32 bPresent;
|
||||
u32 exceptionMask;
|
||||
void (*ExceptionDestination)(void);
|
||||
void* exceptionReturn;
|
||||
} DBInterface;
|
||||
|
||||
extern DBInterface* __DBInterface;
|
||||
|
||||
void DBInit(void);
|
||||
void DBInitComm(int* inputFlagPtr, int* mtrCallback);
|
||||
void __DBExceptionDestination(void);
|
||||
void __DBExceptionDestinationAux(void);
|
||||
BOOL __DBIsExceptionMarked(__OSException exception);
|
||||
void __DBMarkException(u8 exception, int value);
|
||||
void __DBSetPresent(u32 value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "dolphin/os/OSError.h"
|
||||
#include "dolphin/os/OSInterrupt.h"
|
||||
#include "dolphin/os/OSModule.h"
|
||||
#include "dolphin/os/OSLink.h"
|
||||
#include "dolphin/os/OSMemory.h"
|
||||
#include "dolphin/os/OSMessage.h"
|
||||
#include "libforest/osreport.h" /* OSReport funcs */
|
||||
@@ -100,6 +101,18 @@ typedef struct OSBootInfo_s {
|
||||
#define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16)
|
||||
#define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16)
|
||||
|
||||
typedef struct BI2Debug {
|
||||
/* 0x00 */ s32 debugMonSize;
|
||||
/* 0x04 */ s32 simMemSize;
|
||||
/* 0x08 */ u32 argOffset;
|
||||
/* 0x0C */ u32 debugFlag;
|
||||
/* 0x10 */ int trackLocation;
|
||||
/* 0x14 */ int trackSize;
|
||||
/* 0x18 */ u32 countryCode;
|
||||
/* 0x1C */ u8 unk[8];
|
||||
/* 0x24 */ u32 padSpec;
|
||||
} BI2Debug;
|
||||
|
||||
#ifdef __MWERKS__
|
||||
u32 __OSPhysicalMemSize : (OS_BASE_CACHED | 0x0028);
|
||||
volatile int __OSTVMode : (OS_BASE_CACHED | 0x00CC);
|
||||
|
||||
@@ -9,6 +9,7 @@ extern "C" {
|
||||
|
||||
typedef u16 OSError;
|
||||
typedef void (*OSErrorHandler)(OSError error, OSContext *context, ...);
|
||||
typedef void (*OSErrorHandlerEx)(OSError error, OSContext* context, ...);
|
||||
|
||||
#define OS_ERROR_SYSTEM_RESET 0
|
||||
#define OS_ERROR_MACHINE_CHECK 1
|
||||
@@ -37,4 +38,4 @@ extern u32 __OSFpscrEnableBits;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,26 @@ typedef void (*__OSExceptionHandler)(__OSException exception, OSContext* context
|
||||
__OSExceptionHandler __OSSetExceptionHandler(__OSException exception, __OSExceptionHandler handler);
|
||||
__OSExceptionHandler __OSGetExceptionHandler(__OSException exception);
|
||||
|
||||
#define OS_EXCEPTION_SAVE_GPRS(context) \
|
||||
stw r0, OS_CONTEXT_R0(context); \
|
||||
stw r1, OS_CONTEXT_R1(context); \
|
||||
stw r2, OS_CONTEXT_R2(context); \
|
||||
stmw r6, OS_CONTEXT_R6(context); \
|
||||
mfspr r0, GQR1; \
|
||||
stw r0, OS_CONTEXT_GQR1(context); \
|
||||
mfspr r0, GQR2; \
|
||||
stw r0, OS_CONTEXT_GQR2(context); \
|
||||
mfspr r0, GQR3; \
|
||||
stw r0, OS_CONTEXT_GQR3(context); \
|
||||
mfspr r0, GQR4; \
|
||||
stw r0, OS_CONTEXT_GQR4(context); \
|
||||
mfspr r0, GQR5; \
|
||||
stw r0, OS_CONTEXT_GQR5(context); \
|
||||
mfspr r0, GQR6; \
|
||||
stw r0, OS_CONTEXT_GQR6(context); \
|
||||
mfspr r0, GQR7; \
|
||||
stw r0, OS_CONTEXT_GQR7(context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_FONT_ROM_SIZE_ANSI 0x03000
|
||||
#define OS_FONT_ROM_SIZE_SJIS 0x4D000
|
||||
|
||||
typedef struct OSFontHeader {
|
||||
u16 fontType; // _00
|
||||
u16 firstChar; // _02, first char code defined in font.
|
||||
|
||||
@@ -49,60 +49,98 @@ typedef enum OSInterruptType {
|
||||
OS_INTR_MAX
|
||||
} OSInterruptType;
|
||||
|
||||
#define OS_INTRMASK_MEM_0 (0x80000000U >> OS_INTR_MEM_0)
|
||||
#define OS_INTRMASK_MEM_1 (0x80000000U >> OS_INTR_MEM_1)
|
||||
#define OS_INTRMASK_MEM_2 (0x80000000U >> OS_INTR_MEM_2)
|
||||
#define OS_INTRMASK_MEM_3 (0x80000000U >> OS_INTR_MEM_3)
|
||||
#define OS_INTRMASK_MEM_ADDRESS (0x80000000U >> OS_INTR_MEM_ADDRESS)
|
||||
#define OS_INTRMASK_DSP_AI (0x80000000U >> OS_INTR_DSP_AI)
|
||||
#define OS_INTRMASK_DSP_ARAM (0x80000000U >> OS_INTR_DSP_ARAM)
|
||||
#define OS_INTRMASK_DSP_DSP (0x80000000U >> OS_INTR_DSP_DSP)
|
||||
#define OS_INTRMASK_AI_AI (0x80000000U >> OS_INTR_AI_AI)
|
||||
#define OS_INTRMASK_EXI_0_EXI (0x80000000U >> OS_INTR_EXI_0_EXI)
|
||||
#define OS_INTRMASK_EXI_0_TC (0x80000000U >> OS_INTR_EXI_0_TC)
|
||||
#define OS_INTRMASK_EXI_0_EXT (0x80000000U >> OS_INTR_EXI_0_EXT)
|
||||
#define OS_INTRMASK_EXI_1_EXI (0x80000000U >> OS_INTR_EXI_1_EXI)
|
||||
#define OS_INTRMASK_EXI_1_TC (0x80000000U >> OS_INTR_EXI_1_TC)
|
||||
#define OS_INTRMASK_EXI_1_EXT (0x80000000U >> OS_INTR_EXI_1_EXT)
|
||||
#define OS_INTRMASK_EXI_2_EXI (0x80000000U >> OS_INTR_EXI_2_EXI)
|
||||
#define OS_INTRMASK_EXI_2_TC (0x80000000U >> OS_INTR_EXI_2_TC)
|
||||
#define OS_INTRMASK_PI_CP (0x80000000U >> OS_INTR_PI_CP)
|
||||
#define OS_INTRMASK_PI_PE_TOKEN (0x80000000U >> OS_INTR_PI_PE_TOKEN)
|
||||
#define OS_INTRMASK_PI_PE_FINISH (0x80000000U >> OS_INTR_PI_PE_FINISH)
|
||||
#define OS_INTRMASK_PI_SI (0x80000000U >> OS_INTR_PI_SI)
|
||||
#define OS_INTRMASK_PI_DI (0x80000000U >> OS_INTR_PI_DI)
|
||||
#define OS_INTRMASK_PI_RSW (0x80000000U >> OS_INTR_PI_RSW)
|
||||
#define OS_INTRMASK_PI_ERROR (0x80000000U >> OS_INTR_PI_ERROR)
|
||||
#define OS_INTRMASK_PI_VI (0x80000000U >> OS_INTR_PI_VI)
|
||||
#define OS_INTRMASK_PI_DEBUG (0x80000000U >> OS_INTR_PI_DEBUG)
|
||||
#define OS_INTRMASK_PI_HSP (0x80000000U >> OS_INTR_PI_HSP)
|
||||
#define __OS_INTERRUPT_MEM_0 0
|
||||
#define __OS_INTERRUPT_MEM_1 1
|
||||
#define __OS_INTERRUPT_MEM_2 2
|
||||
#define __OS_INTERRUPT_MEM_3 3
|
||||
#define __OS_INTERRUPT_MEM_ADDRESS 4
|
||||
#define __OS_INTERRUPT_DSP_AI 5
|
||||
#define __OS_INTERRUPT_DSP_ARAM 6
|
||||
#define __OS_INTERRUPT_DSP_DSP 7
|
||||
#define __OS_INTERRUPT_AI_AI 8
|
||||
#define __OS_INTERRUPT_EXI_0_EXI 9
|
||||
#define __OS_INTERRUPT_EXI_0_TC 10
|
||||
#define __OS_INTERRUPT_EXI_0_EXT 11
|
||||
#define __OS_INTERRUPT_EXI_1_EXI 12
|
||||
#define __OS_INTERRUPT_EXI_1_TC 13
|
||||
#define __OS_INTERRUPT_EXI_1_EXT 14
|
||||
#define __OS_INTERRUPT_EXI_2_EXI 15
|
||||
#define __OS_INTERRUPT_EXI_2_TC 16
|
||||
#define __OS_INTERRUPT_PI_CP 17
|
||||
#define __OS_INTERRUPT_PI_PE_TOKEN 18
|
||||
#define __OS_INTERRUPT_PI_PE_FINISH 19
|
||||
#define __OS_INTERRUPT_PI_SI 20
|
||||
#define __OS_INTERRUPT_PI_DI 21
|
||||
#define __OS_INTERRUPT_PI_RSW 22
|
||||
#define __OS_INTERRUPT_PI_ERROR 23
|
||||
#define __OS_INTERRUPT_PI_VI 24
|
||||
#define __OS_INTERRUPT_PI_DEBUG 25
|
||||
#define __OS_INTERRUPT_PI_HSP 26
|
||||
#define __OS_INTERRUPT_MAX 32
|
||||
|
||||
#define OS_INTRMASK_MEM \
|
||||
(OS_INTRMASK_MEM_0 | OS_INTRMASK_MEM_1 | OS_INTRMASK_MEM_2 | \
|
||||
OS_INTRMASK_MEM_3 | OS_INTRMASK_MEM_ADDRESS)
|
||||
#define OS_INTERRUPTMASK(interrupt) (0x80000000u >> (interrupt))
|
||||
|
||||
#define OS_INTRMASK_AI (OS_INTRMASK_AI_AI)
|
||||
|
||||
#define OS_INTRMASK_DSP \
|
||||
(OS_INTRMASK_DSP_AI | OS_INTRMASK_DSP_ARAM | OS_INTRMASK_DSP_DSP)
|
||||
|
||||
#define OS_INTRMASK_EXI_0 \
|
||||
(OS_INTRMASK_EXI_0_EXI | OS_INTRMASK_EXI_0_TC | OS_INTRMASK_EXI_0_EXT)
|
||||
#define OS_INTRMASK_EXI_1 \
|
||||
(OS_INTRMASK_EXI_1_EXI | OS_INTRMASK_EXI_1_TC | OS_INTRMASK_EXI_1_EXT)
|
||||
#define OS_INTRMASK_EXI_2 (OS_INTRMASK_EXI_2_EXI | OS_INTRMASK_EXI_2_TC)
|
||||
#define OS_INTRMASK_EXI \
|
||||
(OS_INTRMASK_EXI_0_EXI | OS_INTRMASK_EXI_0_TC | OS_INTRMASK_EXI_0_EXT | \
|
||||
OS_INTRMASK_EXI_1_EXI | OS_INTRMASK_EXI_1_TC | OS_INTRMASK_EXI_1_EXT | \
|
||||
OS_INTRMASK_EXI_2_EXI | OS_INTRMASK_EXI_2_TC)
|
||||
|
||||
#define OS_INTRMASK_PI \
|
||||
(OS_INTRMASK_PI_CP | OS_INTRMASK_PI_SI | OS_INTRMASK_PI_DI | \
|
||||
OS_INTRMASK_PI_RSW | OS_INTRMASK_PI_ERROR | OS_INTRMASK_PI_VI | \
|
||||
OS_INTRMASK_PI_PE_TOKEN | OS_INTRMASK_PI_PE_FINISH | \
|
||||
OS_INTRMASK_PI_DEBUG | OS_INTRMASK_PI_HSP)
|
||||
|
||||
#define OS_INTRMASK_PI_PE (OS_INTRMASK_PI_PE_TOKEN | OS_INTRMASK_PI_PE_FINISH)
|
||||
#define OS_INTERRUPTMASK_MEM_0 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_0)
|
||||
#define OS_INTERRUPTMASK_MEM_1 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_1)
|
||||
#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_2)
|
||||
#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_3)
|
||||
#define OS_INTERRUPTMASK_MEM_ADDRESS \
|
||||
OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_ADDRESS)
|
||||
#define OS_INTERRUPTMASK_MEM_RESET \
|
||||
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 \
|
||||
| OS_INTERRUPTMASK_MEM_3)
|
||||
#define OS_INTERRUPTMASK_MEM \
|
||||
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 \
|
||||
| OS_INTERRUPTMASK_MEM_3 | OS_INTERRUPTMASK_MEM_ADDRESS)
|
||||
#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_AI)
|
||||
#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_ARAM)
|
||||
#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_DSP)
|
||||
#define OS_INTERRUPTMASK_DSP \
|
||||
(OS_INTERRUPTMASK_DSP_AI | OS_INTERRUPTMASK_DSP_ARAM \
|
||||
| OS_INTERRUPTMASK_DSP_DSP)
|
||||
#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(__OS_INTERRUPT_AI_AI)
|
||||
#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI)
|
||||
#define OS_INTERRUPTMASK_EXI_0_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXI)
|
||||
#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_TC)
|
||||
#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXT)
|
||||
#define OS_INTERRUPTMASK_EXI_0 \
|
||||
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC \
|
||||
| OS_INTERRUPTMASK_EXI_0_EXT)
|
||||
#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXI)
|
||||
#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_TC)
|
||||
#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXT)
|
||||
#define OS_INTERRUPTMASK_EXI_1 \
|
||||
(OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC \
|
||||
| OS_INTERRUPTMASK_EXI_1_EXT)
|
||||
#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_EXI)
|
||||
#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_TC)
|
||||
#define OS_INTERRUPTMASK_EXI_2 \
|
||||
(OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
|
||||
#define OS_INTERRUPTMASK_EXI \
|
||||
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC \
|
||||
| OS_INTERRUPTMASK_EXI_0_EXT | OS_INTERRUPTMASK_EXI_1_EXI \
|
||||
| OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT \
|
||||
| OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
|
||||
#define OS_INTERRUPTMASK_PI_PE_TOKEN \
|
||||
OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_TOKEN)
|
||||
#define OS_INTERRUPTMASK_PI_PE_FINISH \
|
||||
OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_FINISH)
|
||||
#define OS_INTERRUPTMASK_PI_PE \
|
||||
(OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH)
|
||||
#define OS_INTERRUPTMASK_PI_CP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_CP)
|
||||
#define OS_INTERRUPTMASK_PI_SI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_SI)
|
||||
#define OS_INTERRUPTMASK_PI_DI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DI)
|
||||
#define OS_INTERRUPTMASK_PI_RSW OS_INTERRUPTMASK(__OS_INTERRUPT_PI_RSW)
|
||||
#define OS_INTERRUPTMASK_PI_ERROR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ERROR)
|
||||
#define OS_INTERRUPTMASK_PI_VI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_VI)
|
||||
#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DEBUG)
|
||||
#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_HSP)
|
||||
#define OS_INTERRUPTMASK_PI \
|
||||
(OS_INTERRUPTMASK_PI_CP | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI \
|
||||
| OS_INTERRUPTMASK_PI_RSW | OS_INTERRUPTMASK_PI_ERROR \
|
||||
| OS_INTERRUPTMASK_PI_VI | OS_INTERRUPTMASK_PI_PE_TOKEN \
|
||||
| OS_INTERRUPTMASK_PI_PE_FINISH | OS_INTERRUPTMASK_PI_DEBUG \
|
||||
| OS_INTERRUPTMASK_PI_HSP)
|
||||
|
||||
typedef void (*__OSInterruptHandler)(__OSInterrupt, OSContext*);
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
#ifndef OSLINK_H
|
||||
#define OSLINK_H
|
||||
|
||||
#include <dolphin/os/OSUtil.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_MODULE_VERSION 2
|
||||
|
||||
typedef struct OSModuleHeader OSModuleHeader;
|
||||
|
||||
typedef u32 OSModuleID;
|
||||
typedef struct OSModuleQueue OSModuleQueue;
|
||||
typedef struct OSModuleLink OSModuleLink;
|
||||
typedef struct OSModuleInfo OSModuleInfo;
|
||||
typedef struct OSSectionInfo OSSectionInfo;
|
||||
typedef struct OSImportInfo OSImportInfo;
|
||||
typedef struct OSRel OSRel;
|
||||
|
||||
struct OSModuleQueue {
|
||||
OSModuleInfo* head;
|
||||
OSModuleInfo* tail;
|
||||
};
|
||||
|
||||
OSModuleQueue __OSModuleList AT_ADDRESS(0x800030C8);
|
||||
void* __OSStringTable AT_ADDRESS(0x800030D0);
|
||||
|
||||
struct OSModuleLink {
|
||||
OSModuleInfo* next;
|
||||
OSModuleInfo* prev;
|
||||
};
|
||||
|
||||
struct OSSectionInfo {
|
||||
u32 offset;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct OSModuleInfo {
|
||||
OSModuleID id; // unique identifier for the module
|
||||
OSModuleLink link; // doubly linked list of modules
|
||||
u32 numSections; // # of sections
|
||||
u32 sectionInfoOffset; // offset to section info table
|
||||
u32 nameOffset; // offset to module name
|
||||
u32 nameSize; // size of module name
|
||||
u32 version; // version number
|
||||
};
|
||||
|
||||
struct OSModuleHeader {
|
||||
// CAUTION: info must be the 1st member
|
||||
OSModuleInfo info;
|
||||
|
||||
// OS_MODULE_VERSION == 1
|
||||
u32 bssSize; // total size of bss sections in bytes
|
||||
u32 relOffset;
|
||||
u32 impOffset;
|
||||
u32 impSize; // size in bytes
|
||||
u8 prologSection; // section # for prolog function
|
||||
u8 epilogSection; // section # for epilog function
|
||||
u8 unresolvedSection; // section # for unresolved function
|
||||
u8 bssSection; // section # for bss section (set at run-time)
|
||||
u32 prolog; // prolog function offset
|
||||
u32 epilog; // epilog function offset
|
||||
u32 unresolved; // unresolved function offset
|
||||
|
||||
// OS_MODULE_VERSION == 2
|
||||
#if (2 <= OS_MODULE_VERSION)
|
||||
u32 align; // module alignment constraint
|
||||
u32 bssAlign; // bss alignment constraint
|
||||
#endif
|
||||
|
||||
// OS_MODULE_VERSION == 3
|
||||
#if (3 <= OS_MODULE_VERSION)
|
||||
u32 fixSize;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define OSGetSectionInfo(module) ((OSSectionInfo*)(((OSModuleInfo*)(module))->sectionInfoOffset))
|
||||
|
||||
#define OS_SECTIONINFO_EXEC 0x1
|
||||
#define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~0x1)
|
||||
|
||||
struct OSImportInfo {
|
||||
OSModuleID id; // external module id
|
||||
u32 offset; // offset to OSRel instructions
|
||||
};
|
||||
|
||||
struct OSRel {
|
||||
u16 offset; // byte offset from the previous entry
|
||||
u8 type;
|
||||
u8 section;
|
||||
u32 addend;
|
||||
};
|
||||
|
||||
#define R_DOLPHIN_NOP 201 // C9h current offset += OSRel.offset
|
||||
#define R_DOLPHIN_SECTION 202 // CAh current section = OSRel.section
|
||||
#define R_DOLPHIN_END 203 // CBh
|
||||
#define R_DOLPHIN_MRKREF 204 // CCh
|
||||
|
||||
BOOL OSLink(OSModuleInfo* newModule, void* bss);
|
||||
BOOL OSLinkFixed(OSModuleInfo* newModule, void* bss);
|
||||
BOOL OSUnlink(OSModuleInfo* module);
|
||||
void OSSetStringTable(const void* string_table);
|
||||
void __OSModuleInit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* OSLINK_H */
|
||||
@@ -7,63 +7,63 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OSModuleInfo_s OSModuleInfo;
|
||||
// typedef struct OSModuleInfo_s OSModuleInfo;
|
||||
|
||||
typedef struct OSModuleQueue_s {
|
||||
OSModuleInfo* head;
|
||||
OSModuleInfo* tail;
|
||||
} OSModuleQueue;
|
||||
// typedef struct OSModuleQueue_s {
|
||||
// OSModuleInfo* head;
|
||||
// OSModuleInfo* tail;
|
||||
// } OSModuleQueue;
|
||||
|
||||
typedef struct OSModuleLink_s {
|
||||
OSModuleInfo* next;
|
||||
OSModuleInfo* prev;
|
||||
} OSModuleLink;
|
||||
// typedef struct OSModuleLink_s {
|
||||
// OSModuleInfo* next;
|
||||
// OSModuleInfo* prev;
|
||||
// } OSModuleLink;
|
||||
|
||||
typedef struct OSModuleInfo_s {
|
||||
u32 id;
|
||||
OSModuleLink link;
|
||||
u32 numSections;
|
||||
u32 sectionInfoOfs;
|
||||
u32 nameOfs;
|
||||
u32 nameSize;
|
||||
u32 version;
|
||||
} OSModuleInfo;
|
||||
// typedef struct OSModuleInfo_s {
|
||||
// u32 id;
|
||||
// OSModuleLink link;
|
||||
// u32 numSections;
|
||||
// u32 sectionInfoOfs;
|
||||
// u32 nameOfs;
|
||||
// u32 nameSize;
|
||||
// u32 version;
|
||||
// } OSModuleInfo;
|
||||
|
||||
typedef struct OSModuleHeader_s {
|
||||
OSModuleInfo info;
|
||||
u32 bssSize;
|
||||
u32 relOfs;
|
||||
u32 impOfs;
|
||||
u32 impSize;
|
||||
// typedef struct OSModuleHeader_s {
|
||||
// OSModuleInfo info;
|
||||
// u32 bssSize;
|
||||
// u32 relOfs;
|
||||
// u32 impOfs;
|
||||
// u32 impSize;
|
||||
|
||||
u8 prologSection;
|
||||
u8 epilogSection;
|
||||
u8 unresolvedSection;
|
||||
u8 bssSection;
|
||||
// u8 prologSection;
|
||||
// u8 epilogSection;
|
||||
// u8 unresolvedSection;
|
||||
// u8 bssSection;
|
||||
|
||||
u32 prolog;
|
||||
u32 epilog;
|
||||
u32 unresolved;
|
||||
/* OS_MODULE_VERSION >= 2 */
|
||||
// u32 prolog;
|
||||
// u32 epilog;
|
||||
// u32 unresolved;
|
||||
// /* OS_MODULE_VERSION >= 2 */
|
||||
|
||||
u32 align;
|
||||
u32 bssAlign;
|
||||
} OSModuleHeader;
|
||||
// u32 align;
|
||||
// u32 bssAlign;
|
||||
// } OSModuleHeader;
|
||||
|
||||
typedef struct OSSectionInfo_s {
|
||||
u32 offset;
|
||||
u32 size;
|
||||
} OSSectionInfo;
|
||||
// typedef struct OSSectionInfo_s {
|
||||
// u32 offset;
|
||||
// u32 size;
|
||||
// } OSSectionInfo;
|
||||
|
||||
#define OSGetSectionInfo(module) \
|
||||
((OSSectionInfo*) (((OSModuleInfo*) (module))->sectionInfoOfs))
|
||||
// #define OSGetSectionInfo(module) \
|
||||
// ((OSSectionInfo*) (((OSModuleInfo*) (module))->sectionInfoOfs))
|
||||
|
||||
#define OS_SECTIONINFO_EXEC 1
|
||||
#define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~OS_SECTIONINFO_EXEC)
|
||||
// #define OS_SECTIONINFO_EXEC 1
|
||||
// #define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~OS_SECTIONINFO_EXEC)
|
||||
|
||||
void OSSetStringTable (const void* strTable);
|
||||
BOOL OSLink(OSModuleInfo* module, void* bss);
|
||||
BOOL OSUnlink(OSModuleInfo* module);
|
||||
// void OSSetStringTable (const void* strTable);
|
||||
// BOOL OSLink(OSModuleInfo* module, void* bss);
|
||||
// BOOL OSUnlink(OSModuleInfo* module);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -13,6 +13,11 @@ extern "C" {
|
||||
#define OS_RESET_HOTRESET 1 /* Soft reset */
|
||||
#define OS_RESET_SHUTDOWN 2
|
||||
|
||||
struct OSResetFunctionQueue {
|
||||
struct OSResetFunctionInfo* head;
|
||||
struct OSResetFunctionInfo* tail;
|
||||
};
|
||||
|
||||
typedef BOOL (*OSResetFunction)(BOOL final);
|
||||
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL OSGetResetSwitchState();
|
||||
typedef void (*OSResetCallback)(void);
|
||||
|
||||
OSResetCallback OSSetResetCallback(OSResetCallback callback);
|
||||
BOOL OSGetResetSwitchState(void);
|
||||
BOOL OSGetResetButtonState(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -46,6 +46,19 @@ typedef struct OSCalendarTime_s {
|
||||
OSTime OSCalendarTimeToTicks(OSCalendarTime* td);
|
||||
void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* td);
|
||||
|
||||
#define USEC_MAX 1000
|
||||
#define MSEC_MAX 1000
|
||||
#define MONTH_MAX 12
|
||||
#define WEEK_DAY_MAX 7
|
||||
#define YEAR_DAY_MAX 365
|
||||
|
||||
#define SECS_IN_MIN 60
|
||||
#define SECS_IN_HOUR (SECS_IN_MIN * 60)
|
||||
#define SECS_IN_DAY (SECS_IN_HOUR * 24)
|
||||
#define SECS_IN_YEAR (SECS_IN_DAY * 365)
|
||||
|
||||
#define BIAS 0xB2575
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user