diff --git a/asm/os/__ppc_eabi_init_text.s b/asm/os/__ppc_eabi_init_text.s index c9a7c811..88209d03 100644 --- a/asm/os/__ppc_eabi_init_text.s +++ b/asm/os/__ppc_eabi_init_text.s @@ -2,6 +2,7 @@ .section .text, "ax" +.if 0 .global __init_user __init_user: /* 80385824 00382784 7C 08 02 A6 */ mflr r0 @@ -12,6 +13,7 @@ __init_user: /* 80385838 00382798 38 21 00 08 */ addi r1, r1, 8 /* 8038583C 0038279C 7C 08 03 A6 */ mtlr r0 /* 80385840 003827A0 4E 80 00 20 */ blr +.endif .global __init_cpp __init_cpp: diff --git a/include/dolphin/__ppc_eabi_init.h b/include/dolphin/__ppc_eabi_init.h index 8f3ae0a5..815731fc 100644 --- a/include/dolphin/__ppc_eabi_init.h +++ b/include/dolphin/__ppc_eabi_init.h @@ -1,6 +1,14 @@ #include "types.h" -__declspec(section ".init") extern void __init_hardware(void); -__declspec(section ".init") extern void __flush_cache(register void* address, register unsigned int size); +#ifdef __cplusplus +extern "C" { +#endif +__declspec(section ".init") void __init_hardware(void); +__declspec(section ".init") void __flush_cache(register void* address, register unsigned int size); -extern void __init_cpp(void); +void __init_user(void); +void __init_cpp(void); + +#ifdef __cplusplus +} +#endif diff --git a/obj_files.mk b/obj_files.mk index 1bc8bf5e..3b9fe4f4 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -1,7 +1,4 @@ INIT_O_FILES :=\ - $(BUILD_DIR)/src/os/__start.o\ - $(BUILD_DIR)/src/os/__ppc_eabi_init.o\ - $(BUILD_DIR)/asm/Runtime/__mem.o METROTRK_FILES :=\ $(BUILD_DIR)/src/MetroTRK/mslsupp.o @@ -687,6 +684,7 @@ MTX_FILES :=\ # TODO: Move __ppc_eabi_init_text into the same source files as __ppc_eabi_init OS_FILES :=\ + $(BUILD_DIR)/src/os/__start.o\ $(BUILD_DIR)/asm/Dolphin/os/OS.o\ $(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\ $(BUILD_DIR)/asm/Dolphin/os/OSArena.o\ @@ -707,7 +705,7 @@ OS_FILES :=\ $(BUILD_DIR)/asm/Dolphin/os/OSSync.o\ $(BUILD_DIR)/asm/Dolphin/os/OSThread.o\ $(BUILD_DIR)/asm/Dolphin/os/OSTime.o\ - $(BUILD_DIR)/asm/os/__ppc_eabi_init_text.o + $(BUILD_DIR)/src/os/__ppc_eabi_init.o\ PAD_FILES :=\ $(BUILD_DIR)/asm/Dolphin/pad/PadClamp.o\ @@ -717,6 +715,7 @@ VI_FILES :=\ $(BUILD_DIR)/asm/Dolphin/vi.o MSL_PPCEABI_BARE_H :=\ + $(BUILD_DIR)/asm/Runtime/__mem.o\ $(BUILD_DIR)/asm/Runtime/__va_arg.o\ $(BUILD_DIR)/asm/Runtime/global_destructor_chain.o\ $(BUILD_DIR)/asm/Runtime/CPlusLibPPC.o\ diff --git a/src/os/__ppc_eabi_init.c b/src/os/__ppc_eabi_init.c deleted file mode 100644 index 1d0a8468..00000000 --- a/src/os/__ppc_eabi_init.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "Dolphin/__ppc_eabi_init.h" - -extern void __OSPSInit(); -extern void __OSCacheInit(); - -asm void __init_hardware(void) { -// clang-format off - nofralloc - mfmsr r0 - ori r0, r0, 0x2000 - mtmsr r0 - - mflr r31 - bl __OSPSInit - bl __OSCacheInit - mtlr r31 - blr -// clang-format on -} - -asm void __flush_cache(register void* address, register unsigned int size) { -// clang-format off - nofralloc - lis r5, 0xFFFF - ori r5, r5, 0xFFF1 - and r5, r5, r3 - subf r3, r5, r3 - add r4, r4, r3 - -loop: - dcbst r0, r5 - sync - icbi r0, r5 - addic r5, r5, 8 - subic. r4, r4, 8 - bge loop - isync - blr -// clang-format on -} - -#if 0 -extern void __init_cpp(void); - -#pragma scheduling off -void __init_user(void) { - __init_cpp(); -} -#endif