link GCN_mem_alloc.c

clean & link GCN_mem_alloc.c
it needed an inline func
This commit is contained in:
EpochFlame 2021-10-24 19:37:09 -04:00
parent 211256d66d
commit ee5a6931f2
3 changed files with 25 additions and 112 deletions

View File

@ -1,88 +0,0 @@
.include "macros.inc"
.section .rodata # 0x804732E0 - 0x8049E220
.balign 0x8
.global lbl_80479F38
lbl_80479F38:
.4byte 0x47434E5F
.4byte 0x4D656D5F
.4byte 0x416C6C6F
.4byte 0x632E6320
.4byte 0x3A20496E
.4byte 0x69744465
.4byte 0x6661756C
.4byte 0x74486561
.4byte 0x702E204E
.4byte 0x6F204865
.4byte 0x61702041
.4byte 0x7661696C
.4byte 0x61626C65
.4byte 0x0A000000
.global lbl_80479F70
lbl_80479F70:
.4byte 0x4D657472
.4byte 0x6F776572
.4byte 0x6B732043
.4byte 0x57207275
.4byte 0x6E74696D
.4byte 0x65206C69
.4byte 0x62726172
.4byte 0x7920696E
.4byte 0x69746961
.4byte 0x6C697A69
.4byte 0x6E672064
.4byte 0x65666175
.4byte 0x6C742068
.4byte 0x6561700A
.4byte 0x00000000
.4byte 0x00000000
.section .text, "ax" # 0x800056C0 - 0x80472F00
.global __sys_free
__sys_free:
/* 800C23A8 000BF2E8 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 800C23AC 000BF2EC 7C 08 02 A6 */ mflr r0
/* 800C23B0 000BF2F0 90 01 00 24 */ stw r0, 0x24(r1)
/* 800C23B4 000BF2F4 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 800C23B8 000BF2F8 93 C1 00 18 */ stw r30, 0x18(r1)
/* 800C23BC 000BF2FC 93 A1 00 14 */ stw r29, 0x14(r1)
/* 800C23C0 000BF300 7C 7D 1B 78 */ mr r29, r3
/* 800C23C4 000BF304 80 0D 83 58 */ lwz r0, __OSCurrHeap@sda21(r13)
/* 800C23C8 000BF308 2C 00 FF FF */ cmpwi r0, -1
/* 800C23CC 000BF30C 40 82 00 6C */ bne lbl_800C2438
/* 800C23D0 000BF310 3C 60 80 48 */ lis r3, lbl_80479F38@ha
/* 800C23D4 000BF314 38 63 9F 38 */ addi r3, r3, lbl_80479F38@l
/* 800C23D8 000BF318 4C C6 31 82 */ crclr 6
/* 800C23DC 000BF31C 48 02 B3 11 */ bl OSReport
/* 800C23E0 000BF320 3C 60 80 48 */ lis r3, lbl_80479F70@ha
/* 800C23E4 000BF324 38 63 9F 70 */ addi r3, r3, lbl_80479F70@l
/* 800C23E8 000BF328 4C C6 31 82 */ crclr 6
/* 800C23EC 000BF32C 48 02 B3 01 */ bl OSReport
/* 800C23F0 000BF330 48 02 A0 3D */ bl OSGetArenaLo
/* 800C23F4 000BF334 7C 7F 1B 78 */ mr r31, r3
/* 800C23F8 000BF338 48 02 A0 2D */ bl OSGetArenaHi
/* 800C23FC 000BF33C 7C 7E 1B 78 */ mr r30, r3
/* 800C2400 000BF340 7F E3 FB 78 */ mr r3, r31
/* 800C2404 000BF344 38 A0 00 01 */ li r5, 1
/* 800C2408 000BF348 7F C4 F3 78 */ mr r4, r30
/* 800C240C 000BF34C 48 02 9F 3D */ bl OSInitAlloc
/* 800C2410 000BF350 7C 7F 1B 78 */ mr r31, r3
/* 800C2414 000BF354 48 02 A0 29 */ bl OSSetArenaLo
/* 800C2418 000BF358 38 1F 00 1F */ addi r0, r31, 0x1f
/* 800C241C 000BF35C 57 DE 00 34 */ rlwinm r30, r30, 0, 0, 0x1a
/* 800C2420 000BF360 54 03 00 34 */ rlwinm r3, r0, 0, 0, 0x1a
/* 800C2424 000BF364 7F C4 F3 78 */ mr r4, r30
/* 800C2428 000BF368 48 02 9F 91 */ bl OSCreateHeap
/* 800C242C 000BF36C 48 02 9F 0D */ bl OSSetCurrentHeap
/* 800C2430 000BF370 7F C3 F3 78 */ mr r3, r30
/* 800C2434 000BF374 48 02 A0 09 */ bl OSSetArenaLo
lbl_800C2438:
/* 800C2438 000BF378 80 6D 83 58 */ lwz r3, __OSCurrHeap@sda21(r13)
/* 800C243C 000BF37C 7F A4 EB 78 */ mr r4, r29
/* 800C2440 000BF380 48 02 9E 7D */ bl OSFreeToHeap
/* 800C2444 000BF384 80 01 00 24 */ lwz r0, 0x24(r1)
/* 800C2448 000BF388 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 800C244C 000BF38C 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 800C2450 000BF390 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 800C2454 000BF394 7C 08 03 A6 */ mtlr r0
/* 800C2458 000BF398 38 21 00 20 */ addi r1, r1, 0x20
/* 800C245C 000BF39C 4E 80 00 20 */ blr

View File

@ -276,7 +276,7 @@ DOLPHIN:=\
$(BUILD_DIR)/asm/Dolphin/runtime.o\
$(BUILD_DIR)/asm/Dolphin/__init_cpp_exceptions.o\
$(BUILD_DIR)/asm/Dolphin/Gecko_ExceptionPPC.o\
$(BUILD_DIR)/asm/Dolphin/GCN_mem_alloc.o\
$(BUILD_DIR)/src/Dolphin/GCN_mem_alloc.o\
$(BUILD_DIR)/asm/Dolphin/abort_exit.o\
$(BUILD_DIR)/asm/Dolphin/alloc.o\
$(BUILD_DIR)/asm/Dolphin/ansi_files.o\

View File

@ -1,35 +1,36 @@
#include "types.h"
#include "Dolphin/os.h"
inline static void InitDefaultHeap() {
void* arenaLo;
void* arenaHi;
OSReport("GCN_Mem_Alloc.c : InitDefaultHeap. No Heap Available\n");
OSReport("Metrowerks CW runtime library initializing default heap\n");
arenaLo = OSGetArenaLo();
arenaHi = OSGetArenaHi();
arenaLo = OSInitAlloc(arenaLo, arenaHi, 1);
OSSetArenaLo(arenaLo);
arenaLo = (void*)RoundUpTo20(arenaLo);
arenaHi = (void*)RoundDownTo20(arenaHi);
OSSetCurrentHeap(OSCreateHeap(arenaLo, arenaHi));
OSSetArenaLo(arenaLo = arenaHi);
}
/*
* --INFO--
* Address: 800C23A8
* Size: 0000B8
*/
void __sys_free(void* ptr)
__declspec(weak) extern void __sys_free(void* ptr)
{
if (__OSCurrHeap == -1) {
void* arenaLo;
void* arenaHi;
void* newHi;
int currentHeap;
OSReport("GCN_Mem_Alloc.c : InitDefaultHeap. No Heap Available\n");
OSReport("Metrowerks CW runtime library initializing default heap\n");
arenaLo = OSGetArenaLo();
arenaHi = OSGetArenaHi();
newHi = OSInitAlloc(arenaLo, arenaHi, 1);
OSSetArenaLo(newHi);
arenaHi = (void*)RoundDownTo20(arenaHi);
newHi = (void*)RoundUpTo20(newHi);
currentHeap = OSCreateHeap(newHi, arenaHi);
OSSetCurrentHeap(currentHeap);
OSSetArenaLo(arenaHi);
if (__OSCurrHeap == -1)
{
InitDefaultHeap();
}
OSFreeToHeap(__OSCurrHeap, ptr);
}