aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/libc
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-06-27 22:19:18 +0200
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2022-06-27 22:19:18 +0200
commit578181ace1374e72cb93d69d2c201ce7a0a2300c (patch)
tree8e91212c966bf95bd7c34901e56dad7f81b9af57 /libpsn00b/libc
parentef776e728cfa67fbca38bb375152b336fa0b5200 (diff)
downloadpsn00bsdk-578181ace1374e72cb93d69d2c201ce7a0a2300c.tar.gz
Add 8 MB RAM support and customizable _start stub
Diffstat (limited to 'libpsn00b/libc')
-rw-r--r--libpsn00b/libc/_start.s18
-rw-r--r--libpsn00b/libc/start.c4
2 files changed, 20 insertions, 2 deletions
diff --git a/libpsn00b/libc/_start.s b/libpsn00b/libc/_start.s
new file mode 100644
index 0000000..56075c8
--- /dev/null
+++ b/libpsn00b/libc/_start.s
@@ -0,0 +1,18 @@
+# PSn00bSDK _start() trampoline
+# (C) 2022 spicyjpeg - MPL licensed
+#
+# This file provides a weak function that can be easily overridden to e.g. set
+# $sp or perform additional initialization before the "real" _start()
+# (_start_inner()) is called.
+
+.set noreorder
+.section .text
+
+.global _start
+.type _start, @function
+.weak _start
+_start:
+ la $gp, _gp
+
+ j _start_inner
+ nop
diff --git a/libpsn00b/libc/start.c b/libpsn00b/libc/start.c
index fd6fe33..bfe9c9b 100644
--- a/libpsn00b/libc/start.c
+++ b/libpsn00b/libc/start.c
@@ -80,8 +80,8 @@ extern int main(int argc, const char* argv[]);
// Even though _start() usually takes no arguments, this implementation allows
// parent executables to pass args directly to child executables without having
// to overwrite the arg strings in kernel RAM.
-void _start(int32_t override_argc, const char **override_argv) {
- __asm__ volatile("la $gp, _gp;");
+void _start_inner(int32_t override_argc, const char **override_argv) {
+ //__asm__ volatile("la $gp, _gp;");
// Clear BSS 4 bytes at a time. BSS is always aligned to 4 bytes by the
// linker script.