aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/libc
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2022-11-03 10:14:22 +0800
committerGitHub <noreply@github.com>2022-11-03 10:14:22 +0800
commit4139331d233b7a962e747c5564fa68a285f81cc8 (patch)
treed4d3374afd5e36e8580cc424ab2c63ee9e7d357c /libpsn00b/libc
parente08a3d9366f8ca14a76b3dd569dac1fb9f569748 (diff)
parent37d963f724113e45d15aa9b8ee86baa9c4362b8f (diff)
downloadpsn00bsdk-4139331d233b7a962e747c5564fa68a285f81cc8.tar.gz
Merge pull request #60 from spicyjpeg/bugfix
Bugfixes, new serial port API and sound examples
Diffstat (limited to 'libpsn00b/libc')
-rw-r--r--libpsn00b/libc/_start.s5
-rw-r--r--libpsn00b/libc/abort.c21
-rw-r--r--libpsn00b/libc/memset.s3
3 files changed, 18 insertions, 11 deletions
diff --git a/libpsn00b/libc/_start.s b/libpsn00b/libc/_start.s
index 56075c8..fcd4c4c 100644
--- a/libpsn00b/libc/_start.s
+++ b/libpsn00b/libc/_start.s
@@ -2,17 +2,16 @@
# (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()
+# $sp or perform additional initialization before the "real" _start() function
# (_start_inner()) is called.
.set noreorder
-.section .text
+.section .text._start
.global _start
.type _start, @function
.weak _start
_start:
la $gp, _gp
-
j _start_inner
nop
diff --git a/libpsn00b/libc/abort.c b/libpsn00b/libc/abort.c
index 2db5016..0a3c325 100644
--- a/libpsn00b/libc/abort.c
+++ b/libpsn00b/libc/abort.c
@@ -1,19 +1,26 @@
+/*
+ * PSn00bSDK assert macro and internal logging
+ * (C) 2022 spicyjpeg - MPL licensed
+ */
-#include <psxetc.h>
+#undef SDK_LIBRARY_NAME
-/* Standard abort */
+#include <assert.h>
+#include <psxapi.h>
-void abort(void) {
- _sdk_log("abort()\n");
+/* Internal function used by assert() macro */
+
+void _assert_abort(const char *file, int line, const char *expr) {
+ _sdk_log("%s:%d: assert(%s)\n", file, line, expr);
for (;;)
__asm__ volatile("");
}
-/* Internal function used by assert() macro */
+/* Standard abort */
-void _assert_abort(const char *file, int line, const char *expr) {
- _sdk_log("%s:%d: assert(%s)\n", file, line, expr);
+void abort(void) {
+ _sdk_log("abort()\n");
for (;;)
__asm__ volatile("");
diff --git a/libpsn00b/libc/memset.s b/libpsn00b/libc/memset.s
index 5a1589d..6ef84ec 100644
--- a/libpsn00b/libc/memset.s
+++ b/libpsn00b/libc/memset.s
@@ -38,8 +38,9 @@ memset:
sb $a1, 0xc($a0)
sb $a1, 0xd($a0)
sb $a1, 0xe($a0)
- jr $ra
sb $a1, 0xf($a0)
+ jr $ra
+ nop
.Llarge_fill:
# Initialize fast filling by repeating the fill byte 4 times, so it can be