From 144d8eac2481296af46127e4a0cbcea6311025d5 Mon Sep 17 00:00:00 2001 From: Charlotte Delenk Date: Thu, 14 Oct 2021 16:47:01 +0200 Subject: [PATCH] __OSPSInit --- data/objects.txt | 4 +++- data/ranges.csv | 1 + data/symbols.csv | 4 +++- include/base.h | 14 ++++++++++++++ include/ic.h | 11 +++++++++++ include/types.h | 11 +++++++++++ sdk/rvl/os/OS.c | 19 +++++++++++++++++++ src/bin/buildgen.rs | 1 + 8 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 include/base.h create mode 100644 include/ic.h create mode 100644 include/types.h create mode 100644 sdk/rvl/os/OS.c diff --git a/data/objects.txt b/data/objects.txt index 68488431..ebbd7c48 100644 --- a/data/objects.txt +++ b/data/objects.txt @@ -1,7 +1,9 @@ build/obj/sdk/msl/runtime/__mem.o build/obj/sdk/trk/__exception.o build/obj/2.o +build/obj/sdk/rvl/os/OS.o +build/obj/3.o build/obj/sdk/rvl/os/__start.o build/obj/sdk/rvl/os/__ppc_eabi_init.o -build/obj/5.o build/obj/6.o +build/obj/7.o diff --git a/data/ranges.csv b/data/ranges.csv index 6a269a5c..5c6c38e3 100644 --- a/data/ranges.csv +++ b/data/ranges.csv @@ -1,6 +1,7 @@ .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 80004000,80004380,,,,,,,,,,,,,,,,,,,,,,,,,sdk/msl/runtime/__mem.o 80004380,800062c0,,,,,,,,,,,,,,,,,,,,,,,,,sdk/trk/__exception.o +,,,,,,8001b670,8001b6c4,,,,,,,,,,,,,,,,,,,sdk/rvl/os/OS.o 800062c0,80006620,,,,,,,,,,,,,,,,,,,8055c878,8055c879,,,,,sdk/rvl/os/__start.o 80006620,80006684,,,,,,,,,,,,,,,,,,,,,,,,,sdk/rvl/os/__ppc_eabi_init.o ,,,,,,,,80406540,80406544,,,,,,,,,,,,,,,,,Linker generated symbol file diff --git a/data/symbols.csv b/data/symbols.csv index a3be9043..124e9e23 100644 --- a/data/symbols.csv +++ b/data/symbols.csv @@ -6,9 +6,11 @@ Address,SymbolName 80015aac,InitMetroTRK_BBA 80015d28,__TRKreset 800190a0,TRK_InterruptHandler +8001a200,PPCMfhid2 +8001a210,PPCMthid2 8001a2c0,__OSFPRInit 8001ad80,OSInit -8001b670,__OSPSInit +8001cab0,ICFlashInvalidate 8001cea0,__OSCacheInit 80023820,OSResetSystem 80028530,__init_user diff --git a/include/base.h b/include/base.h new file mode 100644 index 00000000..638fdd17 --- /dev/null +++ b/include/base.h @@ -0,0 +1,14 @@ +#pragma once + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +u32 PPCMfhid2(void); +void PPCMthid2(u32 fhid); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/include/ic.h b/include/ic.h new file mode 100644 index 00000000..79ee3f97 --- /dev/null +++ b/include/ic.h @@ -0,0 +1,11 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +void ICFlashInvalidate(void); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/include/types.h b/include/types.h new file mode 100644 index 00000000..9e671407 --- /dev/null +++ b/include/types.h @@ -0,0 +1,11 @@ +#pragma once + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef unsigned long long u64; + +typedef signed char s8; +typedef short s16; +typedef long s32; +typedef long long s64; diff --git a/sdk/rvl/os/OS.c b/sdk/rvl/os/OS.c new file mode 100644 index 00000000..c1612355 --- /dev/null +++ b/sdk/rvl/os/OS.c @@ -0,0 +1,19 @@ +#include +#include + +void __OSPSInit(void) { + PPCMthid2(PPCMfhid2() | 0xA0000000); + ICFlashInvalidate(); + asm { + sync; + li r3, 0; + mtspr 912, r3; + mtspr 913, r3; + mtspr 914, r3; + mtspr 915, r3; + mtspr 916, r3; + mtspr 917, r3; + mtspr 918, r3; + mtspr 919, r3; + } +} \ No newline at end of file diff --git a/src/bin/buildgen.rs b/src/bin/buildgen.rs index 32437569..3125cf95 100644 --- a/src/bin/buildgen.rs +++ b/src/bin/buildgen.rs @@ -13,6 +13,7 @@ fn parse_hex(s: &str) -> Result { const SOURCES: &[(&str, &str)] = &[ ("sdk/msl/runtime/__mem.c", "msl"), + ("sdk/rvl/os/OS.c", "sdk"), ("sdk/rvl/os/__start.c", "sdk"), ("sdk/rvl/os/__ppc_eabi_init.c", "sdk"), ];