diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-23 15:03:16 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-23 15:03:16 +0200 |
| commit | 5f25c0bf306d316c87fca9d3fe160d6661be230d (patch) | |
| tree | 399317390f789c0a9f4a9f5a342ca8233cb1b313 /libpsn00b/libc | |
| parent | b1632d7df0e840692612461a80d0e05d6a3228ed (diff) | |
| download | psn00bsdk-5f25c0bf306d316c87fca9d3fe160d6661be230d.tar.gz | |
Library bugfixes and additions, _sdk_log_inner() removal
Diffstat (limited to 'libpsn00b/libc')
| -rw-r--r-- | libpsn00b/libc/_start.s | 17 | ||||
| -rw-r--r-- | libpsn00b/libc/_stubs.s | 27 | ||||
| -rw-r--r-- | libpsn00b/libc/abort.c | 8 |
3 files changed, 22 insertions, 30 deletions
diff --git a/libpsn00b/libc/_start.s b/libpsn00b/libc/_start.s new file mode 100644 index 0000000..fcd4c4c --- /dev/null +++ b/libpsn00b/libc/_start.s @@ -0,0 +1,17 @@ +# 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() function +# (_start_inner()) is called. + +.set noreorder + +.section .text._start +.global _start +.type _start, @function +.weak _start +_start: + la $gp, _gp + j _start_inner + nop diff --git a/libpsn00b/libc/_stubs.s b/libpsn00b/libc/_stubs.s deleted file mode 100644 index aa7bfbe..0000000 --- a/libpsn00b/libc/_stubs.s +++ /dev/null @@ -1,27 +0,0 @@ -# PSn00bSDK _start() trampoline and logging endpoint -# (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() function -# (_start_inner()) is called. The _sdk_log_inner() function called by other -# libraries to log debug messages can also be overridden in a similar way. - -.set noreorder - -.section .text._start -.global _start -.type _start, @function -.weak _start -_start: - la $gp, _gp - j _start_inner - nop - -.section .text._sdk_log_inner -.global _sdk_log_inner -.type _sdk_log_inner, @function -.weak _sdk_log_inner -_sdk_log_inner: - li $t2, 0xa0 - jr $t2 - li $t1, 0x3f diff --git a/libpsn00b/libc/abort.c b/libpsn00b/libc/abort.c index 9a4661a..0a3c325 100644 --- a/libpsn00b/libc/abort.c +++ b/libpsn00b/libc/abort.c @@ -3,13 +3,15 @@ * (C) 2022 spicyjpeg - MPL licensed */ +#undef SDK_LIBRARY_NAME + #include <assert.h> #include <psxapi.h> /* Internal function used by assert() macro */ void _assert_abort(const char *file, int line, const char *expr) { - _sdk_log_inner("%s:%d: assert(%s)\n", file, line, expr); + _sdk_log("%s:%d: assert(%s)\n", file, line, expr); for (;;) __asm__ volatile(""); @@ -18,7 +20,7 @@ void _assert_abort(const char *file, int line, const char *expr) { /* Standard abort */ void abort(void) { - _sdk_log_inner("abort()\n"); + _sdk_log("abort()\n"); for (;;) __asm__ volatile(""); @@ -27,7 +29,7 @@ void abort(void) { /* Pure virtual function call (C++) */ void __cxa_pure_virtual(void) { - _sdk_log_inner("__cxa_pure_virtual()\n"); + _sdk_log("__cxa_pure_virtual()\n"); for (;;) __asm__ volatile(""); |
