Minor cleanup, move files to

This commit is contained in:
Phillip Stephens 2022-09-07 21:51:31 -07:00
parent e8bf411356
commit c1abac8c9e
5 changed files with 109 additions and 35 deletions

View File

@ -1,8 +1,37 @@
.include "macros.inc" .include "macros.inc"
.section .init, "ax" # 0x80003100 - 0x80005620
.global __init_hardware
__init_hardware:
/* 80003354 00000354 7C 00 00 A6 */ mfmsr r0
/* 80003358 00000358 60 00 20 00 */ ori r0, r0, 0x2000
/* 8000335C 0000035C 7C 00 01 24 */ mtmsr r0
/* 80003360 00000360 7F E8 02 A6 */ mflr r31
/* 80003364 00000364 48 0B 19 49 */ bl __OSPSInit
/* 80003368 00000368 48 0B 32 8D */ bl __OSCacheInit
/* 8000336C 0000036C 7F E8 03 A6 */ mtlr r31
/* 80003370 00000370 4E 80 00 20 */ blr
.global __flush_cache
__flush_cache:
/* 80003374 00000374 3C A0 FF FF */ lis r5, 0xFFFFFFF1@h
/* 80003378 00000378 60 A5 FF F1 */ ori r5, r5, 0xFFFFFFF1@l
/* 8000337C 0000037C 7C A5 18 38 */ and r5, r5, r3
/* 80003380 00000380 7C 65 18 50 */ subf r3, r5, r3
/* 80003384 00000384 7C 84 1A 14 */ add r4, r4, r3
lbl_80003388:
/* 80003388 00000388 7C 00 28 6C */ dcbst r0, r5
/* 8000338C 0000038C 7C 00 04 AC */ sync
/* 80003390 00000390 7C 00 2F AC */ icbi r0, r5
/* 80003394 00000394 30 A5 00 08 */ addic r5, r5, 8
/* 80003398 00000398 34 84 FF F8 */ addic. r4, r4, -8
/* 8000339C 0000039C 40 80 FF EC */ bge lbl_80003388
/* 800033A0 000003A0 4C 00 01 2C */ isync
/* 800033A4 000003A4 4E 80 00 20 */ blr
.section .text, "ax" .section .text, "ax"
.if 0
.global __init_user .global __init_user
__init_user: __init_user:
/* 80385824 00382784 7C 08 02 A6 */ mflr r0 /* 80385824 00382784 7C 08 02 A6 */ mflr r0
@ -13,7 +42,6 @@ __init_user:
/* 80385838 00382798 38 21 00 08 */ addi r1, r1, 8 /* 80385838 00382798 38 21 00 08 */ addi r1, r1, 8
/* 8038583C 0038279C 7C 08 03 A6 */ mtlr r0 /* 8038583C 0038279C 7C 08 03 A6 */ mtlr r0
/* 80385840 003827A0 4E 80 00 20 */ blr /* 80385840 003827A0 4E 80 00 20 */ blr
.endif
.global __init_cpp .global __init_cpp
__init_cpp: __init_cpp:
@ -53,3 +81,4 @@ _ExitProcess:
/* 803858AC 0038280C 38 21 00 08 */ addi r1, r1, 8 /* 803858AC 0038280C 38 21 00 08 */ addi r1, r1, 8
/* 803858B0 00382810 7C 08 03 A6 */ mtlr r0 /* 803858B0 00382810 7C 08 03 A6 */ mtlr r0
/* 803858B4 00382814 4E 80 00 20 */ blr /* 803858B4 00382814 4E 80 00 20 */ blr

View File

@ -1,31 +0,0 @@
.include "macros.inc"
.section .init, "ax" # 0x80003100 - 0x80005620
.global __init_hardware
__init_hardware:
/* 80003354 00000354 7C 00 00 A6 */ mfmsr r0
/* 80003358 00000358 60 00 20 00 */ ori r0, r0, 0x2000
/* 8000335C 0000035C 7C 00 01 24 */ mtmsr r0
/* 80003360 00000360 7F E8 02 A6 */ mflr r31
/* 80003364 00000364 48 0B 19 49 */ bl __OSPSInit
/* 80003368 00000368 48 0B 32 8D */ bl __OSCacheInit
/* 8000336C 0000036C 7F E8 03 A6 */ mtlr r31
/* 80003370 00000370 4E 80 00 20 */ blr
.global __flush_cache
__flush_cache:
/* 80003374 00000374 3C A0 FF FF */ lis r5, 0xFFFFFFF1@h
/* 80003378 00000378 60 A5 FF F1 */ ori r5, r5, 0xFFFFFFF1@l
/* 8000337C 0000037C 7C A5 18 38 */ and r5, r5, r3
/* 80003380 00000380 7C 65 18 50 */ subf r3, r5, r3
/* 80003384 00000384 7C 84 1A 14 */ add r4, r4, r3
lbl_80003388:
/* 80003388 00000388 7C 00 28 6C */ dcbst r0, r5
/* 8000338C 0000038C 7C 00 04 AC */ sync
/* 80003390 00000390 7C 00 2F AC */ icbi r0, r5
/* 80003394 00000394 30 A5 00 08 */ addic r5, r5, 8
/* 80003398 00000398 34 84 FF F8 */ addic. r4, r4, -8
/* 8000339C 0000039C 40 80 FF EC */ bge lbl_80003388
/* 800033A0 000003A0 4C 00 01 2C */ isync
/* 800033A4 000003A4 4E 80 00 20 */ blr

View File

@ -684,7 +684,7 @@ MTX_FILES :=\
# TODO: Move __ppc_eabi_init_text into the same source files as __ppc_eabi_init # TODO: Move __ppc_eabi_init_text into the same source files as __ppc_eabi_init
OS_FILES :=\ OS_FILES :=\
$(BUILD_DIR)/src/os/__start.o\ $(BUILD_DIR)/src/Dolphin/os/__start.o\
$(BUILD_DIR)/asm/Dolphin/os/OS.o\ $(BUILD_DIR)/asm/Dolphin/os/OS.o\
$(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\ $(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\
$(BUILD_DIR)/asm/Dolphin/os/OSArena.o\ $(BUILD_DIR)/asm/Dolphin/os/OSArena.o\
@ -705,7 +705,7 @@ OS_FILES :=\
$(BUILD_DIR)/asm/Dolphin/os/OSSync.o\ $(BUILD_DIR)/asm/Dolphin/os/OSSync.o\
$(BUILD_DIR)/asm/Dolphin/os/OSThread.o\ $(BUILD_DIR)/asm/Dolphin/os/OSThread.o\
$(BUILD_DIR)/asm/Dolphin/os/OSTime.o\ $(BUILD_DIR)/asm/Dolphin/os/OSTime.o\
$(BUILD_DIR)/src/os/__ppc_eabi_init.o\ $(BUILD_DIR)/src/Dolphin/os/__ppc_eabi_init.o\
PAD_FILES :=\ PAD_FILES :=\
$(BUILD_DIR)/asm/Dolphin/pad/PadClamp.o\ $(BUILD_DIR)/asm/Dolphin/pad/PadClamp.o\

View File

@ -0,0 +1,76 @@
#include "dolphin/__ppc_eabi_init.h"
#include "dolphin/PPCArch.h"
#ifdef __cplusplus
extern "C" {
#endif
void __OSPSInit();
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
}
void __init_user() {
__init_cpp();
}
typedef void (*voidfunctionptr)(void); // pointer to function returning void
__declspec(section ".init") extern voidfunctionptr _ctors[];
__declspec(section ".init") extern voidfunctionptr _dtors[];
#pragma push
#pragma peephole off
void __init_cpp(void)
{
voidfunctionptr *constructor;
/*
* call static initializers
*/
for (constructor = _ctors; *constructor; constructor++) {
(*constructor)();
}
}
#pragma pop
void _ExitProcess(void) {
PPCHalt();
}
#ifdef __cplusplus
}
#endif