Add __OSFPRInit(), __OSGetIOSRev()

This commit is contained in:
Charlotte 🦝 Delenk 2022-01-03 09:59:10 +01:00
parent b000c1e18b
commit 87050e5f85
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
8 changed files with 146 additions and 5 deletions

View file

@ -18,6 +18,7 @@
"future": "cpp",
"iosfwd": "cpp",
"sstream": "cpp",
"tuple": "cpp"
"tuple": "cpp",
"defines.h": "c"
},
}

View file

@ -4,7 +4,7 @@
,,,,,,80007214,800079fc,,,,,80406580,80406598,,,,,,,,,,,,,sdk/msl/runtime/runtime.o
80004380,800062c0,,,,,,,,,,,,,,,,,,,,,,,,,sdk/trk/__exception.o
,,,,,,8001a0b0,8001a2c0,,,,,,,80421da0,80421dd7,,,,,,,,,,,sdk/rvl/base/PPCArch.o
,,,,,,8001b670,8001b6c4,,,,,,,,,,,,,,,,,,,sdk/rvl/os/OS.o
,,,,,,8001a2c0,8001a45c,,,,,,,,,,,,,8055c778,8055c798,,,,,sdk/rvl/os/OS.o
,,,,,,8001c930,8001cf90,,,,,,,80422278,80422400,,,,,,,,,,,sdk/rvl/os/OSCache.o
,,,,,,8001cf90,8001d98c,,,,,,,80422400,804225b8,,,,,,,,,,,sdk/rvl/os/OSContext.o
800062c0,80006620,,,,,,,,,,,,,,,,,,,8055c878,8055c879,,,,,sdk/rvl/os/__start.o

1 .init start .init end extab start extab end extabindex start extabindex end .text start .text end .ctors start .ctors end .dtors start .dtors end .rodata start .rodata end .data start .data end .bss start .bss end .sdata start .sdata end .sbss start .sbss end .sdata2 start .sdata2 end .sbss2 start .sbss2 end File
4 80007214 800079fc 80406580 80406598 sdk/msl/runtime/runtime.o
5 80004380 800062c0 sdk/trk/__exception.o
6 8001a0b0 8001a2c0 80421da0 80421dd7 sdk/rvl/base/PPCArch.o
7 8001b670 8001a2c0 8001b6c4 8001a45c 8055c778 8055c798 sdk/rvl/os/OS.o
8 8001c930 8001cf90 80422278 80422400 sdk/rvl/os/OSCache.o
9 8001cf90 8001d98c 80422400 804225b8 sdk/rvl/os/OSContext.o
10 800062c0 80006620 8055c878 8055c879 sdk/rvl/os/__start.o

View file

@ -8,9 +8,9 @@ Address,SymbolName
80015aac,InitMetroTRK_BBA
80015d28,__TRKreset
800190a0,TRK_InterruptHandler
8001a2c0,__OSFPRInit
8001ad80,OSInit
8001b540,__OSSetExceptionHandler
8001b670,__OSPSInit
8001c370,OSGetMEM1ArenaHi
8001c380,OSGetMEM2ArenaHi
8001c390,OSGetMEM1ArenaLo

1 Address SymbolName
8 80015aac InitMetroTRK_BBA
9 80015d28 __TRKreset
10 800190a0 TRK_InterruptHandler
8001a2c0 __OSFPRInit
11 8001ad80 OSInit
12 8001b540 __OSSetExceptionHandler
13 8001b670 __OSPSInit
14 8001c370 OSGetMEM1ArenaHi
15 8001c380 OSGetMEM2ArenaHi
16 8001c390 OSGetMEM1ArenaLo

View file

@ -19,6 +19,17 @@ void *OSGetMEM2ArenaLo();
void *OSAllocFromMEM1ArenaLo(u32 size, u32 align);
void *OSAllocFromMEM2ArenaLo(u32 size, u32 align);
typedef struct OSIOSRev {
u8 unk;
u8 branch;
u8 major;
u8 minor;
/* please, broad-on, it's year-month-day */
u8 month;
u8 day;
u16 year;
} OSIOSRev;
#ifdef __cplusplus
}
#endif

View file

@ -13,6 +13,19 @@ typedef long long s64;
typedef float f32;
typedef double f64;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef volatile f32 vf32;
typedef volatile f64 vf64;
typedef int BOOL;
#define NULL 0

View file

@ -3,7 +3,7 @@
namespace util {
template <class T> struct PlacementNew {
T *ptr_;
alignas(T) char data_[sizeof(T)];
char data_[sizeof(T)];
inline PlacementNew() : ptr_(0) {}
inline ~PlacementNew();

View file

@ -1,6 +1,113 @@
#include <base.h>
#include <defines.h>
#include <os.h>
#include <types.h>
USED BOOL __OSInIPL = 0;
USED BOOL __OSInNandBoot = 0;
USED BOOL __OSIsGcam = 0;
static f64 ZeroF = 0.0;
static f32 ZeroPS[2] = {0.0f, 0.0f};
#ifdef __CWCC__
USED asm void __OSFPRInit(void) {
// clang-format off
nofralloc;
mfmsr r3;
ori r3, r3, 0x2000;
mtmsr r3;
mfspr r3, 920;
rlwinm. r3, r3, 3, 31, 31;
beq LAB_8001a360;
lis r3, ZeroPS@ha;
addi r3, r3, ZeroPS@l;
psq_l f0, 0(r3), 0, 0;
ps_mr f1, f0;
ps_mr f2, f0;
ps_mr f3, f0;
ps_mr f4, f0;
ps_mr f5, f0;
ps_mr f6, f0;
ps_mr f7, f0;
ps_mr f8, f0;
ps_mr f9, f0;
ps_mr f10, f0;
ps_mr f11, f0;
ps_mr f12, f0;
ps_mr f13, f0;
ps_mr f14, f0;
ps_mr f15, f0;
ps_mr f16, f0;
ps_mr f17, f0;
ps_mr f18, f0;
ps_mr f19, f0;
ps_mr f20, f0;
ps_mr f21, f0;
ps_mr f22, f0;
ps_mr f23, f0;
ps_mr f24, f0;
ps_mr f25, f0;
ps_mr f26, f0;
ps_mr f27, f0;
ps_mr f28, f0;
ps_mr f29, f0;
ps_mr f30, f0;
ps_mr f31, f0;
LAB_8001a360:
lfd f0, ZeroF;
fmr f1, f0;
fmr f2, f0;
fmr f3, f0;
fmr f4, f0;
fmr f5, f0;
fmr f6, f0;
fmr f7, f0;
fmr f8, f0;
fmr f9, f0;
fmr f10, f0;
fmr f11, f0;
fmr f12, f0;
fmr f13, f0;
fmr f14, f0;
fmr f15, f0;
fmr f16, f0;
fmr f17, f0;
fmr f18, f0;
fmr f19, f0;
fmr f20, f0;
fmr f21, f0;
fmr f22, f0;
fmr f23, f0;
fmr f24, f0;
fmr f25, f0;
fmr f26, f0;
fmr f27, f0;
fmr f28, f0;
fmr f29, f0;
fmr f30, f0;
fmr f31, f0;
mtfsf 255, f0;
blr;
// clang-format on
}
#endif
USED void __OSGetIOSRev(OSIOSRev *rev) {
u32 version = *(u32 *)0xc0003140;
u32 date = *(u32 *)0xc0003144;
rev->unk = (u8)(version >> 24);
rev->branch = (u8)(version >> 16);
rev->major = (u8)(version >> 8);
rev->minor = (u8)(version);
rev->month = (u8)((date >> 20) & 0xf) * 10 + (u8)((date >> 16) & 0xf);
rev->day = (u8)((date >> 12) & 0xf) * 10 + (u8)((date >> 8) & 0xf);
rev->year = (u16)((date >> 4) & 0xf) * 10 + (u16)(date & 0xf) + 2000;
}
#if 0
#ifdef __CWCC__
void __OSPSInit(void) {
PPCMthid2(PPCMfhid2() | 0xA0000000);
@ -18,4 +125,13 @@ void __OSPSInit(void) {
mtspr 919, r3;
}
}
#endif
USED u8 __OSGetDIConfig(void) {
u32 val = *(vu32 *)0xcd006024;
return (u8)val;
}
USED void OSRegisterVersion(const char *version) { OSReport("%s\n", version); }
#endif

View file

@ -162,7 +162,7 @@ LAB_8001ca8c:
#endif
#ifdef __CWCC__
asm void ICFlashInvalidate(void) {
USED asm void ICFlashInvalidate(void) {
// clang-format off
nofralloc;
mfspr r3, 1008;