From 62a88f34a68e2fa8843e4f280d2f67c7f8d6d13a Mon Sep 17 00:00:00 2001 From: rozlette Date: Sun, 28 Oct 2018 23:12:21 -0500 Subject: [PATCH] Split file in boot as functions differ in opt level --- Makefile | 10 +++++++++- codescript.txt | 3 ++- objects.py | 1 + src/boot_O2_g3/boot_0x80080060.c | 20 ++++++++++++++++++++ undef.txt | 1 + 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/boot_O2_g3/boot_0x80080060.c diff --git a/Makefile b/Makefile index e49e3c94a0..77262439a4 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ OPTIMIZATION := -O2 -g3 build/src/libultra/os/%: OPTIMIZATION := -O1 build/src/libultra/io/%: OPTIMIZATION := -O2 build/src/libultra/libc/%: OPTIMIZATION := -O2 +build/src/boot_O2_g3/%: OPTIMIZATION := -O2 -g3 test.txt: OPTIMIZATION := -O2 -g3 test.txt: MIPS_VERSION := -mips2 @@ -24,7 +25,13 @@ BASEROM_FILES := $(wildcard baserom/*) BASEROM_O_FILES := $(BASEROM_FILES:baserom/%=build/baserom/%.o) S_FILES := $(wildcard asm/*) S_O_FILES = $(S_FILES:asm/%.asm=build/asm/%.o) -C_FILES := $(wildcard src/*) $(wildcard src/libultra/*) $(wildcard src/libultra/os/*) $(wildcard src/libultra/io/*) $(wildcard src/libultra/libc/*) $(wildcard src/code/*) +C_FILES := $(wildcard src/*) \ + $(wildcard src/libultra/*) \ + $(wildcard src/libultra/os/*) \ + $(wildcard src/libultra/io/*) \ + $(wildcard src/libultra/libc/*) \ + $(wildcard src/code/*) \ + $(wildcard src/boot_O2_g3/*) C_O_FILES = $(C_FILES:src/%.c=build/src/%.o) O_FILES := $(BASEROM_O_FILES) $(S_O_FILES) @@ -41,6 +48,7 @@ $(shell mkdir -p build/src/libultra/os) $(shell mkdir -p build/src/libultra/io) $(shell mkdir -p build/src/libultra/libc) $(shell mkdir -p build/src/code) +$(shell mkdir -p build/src/boot_O2_g3) check: $(ROM) code.bin boot.bin @md5sum -c checksum.md5 diff --git a/codescript.txt b/codescript.txt index 0f7b060b1b..74aa0ac1c8 100644 --- a/codescript.txt +++ b/codescript.txt @@ -2,7 +2,8 @@ SECTIONS { boot 0x80080060: { - build/asm/boot_0x80080060.o(.text) + build/src/boot_O2_g3/boot_0x80080060.o(.text) + build/asm/boot_0x80080180.o(.text) build/asm/boot_0x800805E0.o(.text) build/asm/boot_0x80080790.o(.text) build/asm/boot_0x80080E30.o(.text) diff --git a/objects.py b/objects.py index 4c50b3720f..7e57b812de 100644 --- a/objects.py +++ b/objects.py @@ -1,4 +1,5 @@ known_objects = { + 0x80080180:"", 0x80087b00:"setcause", 0x80087b10:"sendmesg", 0x80087e10:"stopthread", diff --git a/src/boot_O2_g3/boot_0x80080060.c b/src/boot_O2_g3/boot_0x80080060.c new file mode 100644 index 0000000000..db6c153fe9 --- /dev/null +++ b/src/boot_O2_g3/boot_0x80080060.c @@ -0,0 +1,20 @@ +#include +#include + +UNK_RET func_80080060(void) { + func_80085320(&D_80099500, &D_80099AF0, &D_80099EF0, 0, -1, &D_80098190); + D_80000318 = func_8008D350(); + func_800818F4(); + func_8008A6FC(); + osUnmapTLBAll(); + D_80096B40 = func_80092920(); + func_80085320(&D_80099AD0, &D_800996D0, &D_80099AD0_, 0, 256, &D_80098198); + osCreateThread(&D_80099520, 1, (void(*)(void*))func_80080514, 0, &D_80099AD0, 12); + osStartThread(&D_80099520); +} + +void func_80080150(UNK_PTR a0, UNK_PTR a1) { + if (a0 < a1) { + _blkclr(a0, (u32)a1 - (u32)a0); + } +} diff --git a/undef.txt b/undef.txt index 07ce40216b..7b1be2f985 100644 --- a/undef.txt +++ b/undef.txt @@ -14290,3 +14290,4 @@ func_840010CC = 0x840010CC; func_84001060 = 0x84001060; func_80920340 = 0x80920340; func_80922430 = 0x80922430; +D_80099AD0_ = 0x80099AD0;