Fully link __ppc_eabi_init.cpp

Former-commit-id: e8bf411356
This commit is contained in:
Phillip Stephens 2022-09-07 21:42:56 -07:00
parent 0f25a3c8d4
commit 18d45a80a7
4 changed files with 16 additions and 56 deletions

View File

@ -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:

View File

@ -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

View File

@ -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\

View File

@ -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