summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2023-09-02 19:42:26 -0700
committerGitHub <noreply@github.com>2023-09-02 19:42:26 -0700
commit282ac6d4040b994d4b9d3ffea5df0a98dfdb122e (patch)
treef6283c90622d5a2768fe519087454d74ca97cc74 /src/boot
parent25c7beeb9541db400410a57d1b0e465c559bb334 (diff)
Libido OK (#84)
* libido OK * boot cleanup * format * renames
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/O2/loadfragment2.c3
-rw-r--r--src/boot/O2/logseverity.c (renamed from src/boot/logseverity.c)2
-rw-r--r--src/boot/boot_main.c4
-rw-r--r--src/boot/carthandle.c3
-rw-r--r--src/boot/libc/memmove.c23
-rw-r--r--src/boot/libc/memset.c11
-rw-r--r--src/boot/libc/strcmp.c16
-rw-r--r--src/boot/libc/strcpy.c12
-rw-r--r--src/boot/libc64/__osMalloc.c4
-rw-r--r--src/boot/libm/fmodf.c12
-rw-r--r--src/boot/viconfig.c2
-rw-r--r--src/boot/z_std_dma.c2
12 files changed, 86 insertions, 8 deletions
diff --git a/src/boot/O2/loadfragment2.c b/src/boot/O2/loadfragment2.c
index 3b4a888..1f977c0 100644
--- a/src/boot/O2/loadfragment2.c
+++ b/src/boot/O2/loadfragment2.c
@@ -6,8 +6,9 @@
* @note:
* These are for specific fragment overlays with the .ovl file extension
*/
-#include "global.h"
#include "loadfragment.h"
+#include "attributes.h"
+#include "libc/stddef.h"
#include "z_std_dma.h"
void DoRelocation(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart);
diff --git a/src/boot/logseverity.c b/src/boot/O2/logseverity.c
index 940aa87..3ada395 100644
--- a/src/boot/logseverity.c
+++ b/src/boot/O2/logseverity.c
@@ -1,3 +1,3 @@
-#include "global.h"
+#include "ultra64.h"
s32 gOverlayLogSeverity = 2;
diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c
index c3a70e6..76da7f9 100644
--- a/src/boot/boot_main.c
+++ b/src/boot/boot_main.c
@@ -1,5 +1,5 @@
-#include "global.h"
-
+#include "ultra64.h"
+#include "carthandle.h"
#include "idle.h"
#include "m_thread.h"
#include "segment_symbols.h"
diff --git a/src/boot/carthandle.c b/src/boot/carthandle.c
new file mode 100644
index 0000000..e18d46a
--- /dev/null
+++ b/src/boot/carthandle.c
@@ -0,0 +1,3 @@
+#include "ultra64.h"
+
+OSPiHandle* carthandle = NULL;
diff --git a/src/boot/libc/memmove.c b/src/boot/libc/memmove.c
new file mode 100644
index 0000000..31543f6
--- /dev/null
+++ b/src/boot/libc/memmove.c
@@ -0,0 +1,23 @@
+#include "libc/memmove.h"
+
+void* memmove(void* dst, const void* src, size_t len) {
+ u8* d = dst;
+ const u8* s = src;
+
+ if (d == s) {
+ return dst;
+ }
+ if (d < s) {
+ while (len--) {
+ *d++ = *s++;
+ }
+ } else {
+ d += len - 1;
+ s += len - 1;
+ while (len--) {
+ *d-- = *s--;
+ }
+ }
+
+ return dst;
+}
diff --git a/src/boot/libc/memset.c b/src/boot/libc/memset.c
new file mode 100644
index 0000000..3d7998f
--- /dev/null
+++ b/src/boot/libc/memset.c
@@ -0,0 +1,11 @@
+#include "libc/memset.h"
+
+void* memset(void* dst, s32 val, size_t len) {
+ u8* d = dst;
+
+ while (len--) {
+ *d++ = val;
+ }
+
+ return dst;
+}
diff --git a/src/boot/libc/strcmp.c b/src/boot/libc/strcmp.c
new file mode 100644
index 0000000..ab0c5cf
--- /dev/null
+++ b/src/boot/libc/strcmp.c
@@ -0,0 +1,16 @@
+#include "libc/strcmp.h"
+
+s32 strcmp(const char* str1, const char* str2) {
+ char c1;
+ char c2;
+
+ do {
+ c1 = *str1++;
+ c2 = *str2++;
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ } while (c1);
+
+ return 0;
+}
diff --git a/src/boot/libc/strcpy.c b/src/boot/libc/strcpy.c
new file mode 100644
index 0000000..e981d80
--- /dev/null
+++ b/src/boot/libc/strcpy.c
@@ -0,0 +1,12 @@
+#include "libc/strcpy.h"
+
+char* strcpy(char* dst, const char* src) {
+ char* d = dst;
+
+ while (*src != '\0') {
+ *d++ = *src++;
+ }
+ *d = '\0';
+
+ return dst;
+}
diff --git a/src/boot/libc64/__osMalloc.c b/src/boot/libc64/__osMalloc.c
index 3a4ae94..1845ac4 100644
--- a/src/boot/libc64/__osMalloc.c
+++ b/src/boot/libc64/__osMalloc.c
@@ -1,10 +1,10 @@
#include "libc64/osmalloc.h"
#include "alignment.h"
-#include "boot_functions.h"
#include "fault.h"
#include "libc/stdbool.h"
#include "libc/stddef.h"
#include "libc/stdint.h"
+#include "libc/memmove.h"
#include "macros.h"
#define NODE_MAGIC (0x7373)
@@ -430,7 +430,7 @@ void* __osRealloc(Arena* arena, void* ptr, size_t newSize) {
node->next = (ArenaNode*)((uintptr_t)next + sizeDiff);
node->size = newSize;
- func_8003BA60_jp(node->next, next, sizeof(ArenaNode));
+ memmove(node->next, next, sizeof(ArenaNode));
} else {
// Create a new pointer and manually copy the data from the old pointer to the new one.
void* newPtr;
diff --git a/src/boot/libm/fmodf.c b/src/boot/libm/fmodf.c
new file mode 100644
index 0000000..79a3cbd
--- /dev/null
+++ b/src/boot/libm/fmodf.c
@@ -0,0 +1,12 @@
+#include "libm/fmodf.h"
+
+f32 fmodf(f32 x, f32 y) {
+ s32 n;
+
+ if (y == 0.0f) {
+ return 0.0f;
+ }
+
+ n = x / y;
+ return x - (n * y);
+}
diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c
index c250cd7..41aa596 100644
--- a/src/boot/viconfig.c
+++ b/src/boot/viconfig.c
@@ -1,4 +1,4 @@
-#include "global.h"
+#include "viconfig.h"
#include "idle.h"
#include "irqmgr.h"
diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c
index 1153b45..08ab3ad 100644
--- a/src/boot/z_std_dma.c
+++ b/src/boot/z_std_dma.c
@@ -15,6 +15,7 @@ size_t B_800406B0_jp;
size_t B_800406B4_jp;
#include "z_std_dma.h"
+#include "carthandle.h"
#include "fault.h"
#include "irqmgr.h"
#include "yaz0.h"
@@ -23,7 +24,6 @@ size_t B_800406B4_jp;
#include "macros.h"
#include "attributes.h"
#include "segment_symbols.h"
-#include "boot_variables.h"
size_t gDmaMgrDmaBuffSize = DMAMGR_DEFAULT_BUFSIZE;