aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/libc/abort.c
blob: 0a3c32592b7455f1d95f6073b3ede572ffe9898d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * PSn00bSDK assert macro and internal logging
 * (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("%s:%d: assert(%s)\n", file, line, expr);

	for (;;)
		__asm__ volatile("");
}

/* Standard abort */

void abort(void) {
	_sdk_log("abort()\n");

	for (;;)
		__asm__ volatile("");
}

/* Pure virtual function call (C++) */

void __cxa_pure_virtual(void) {
	_sdk_log("__cxa_pure_virtual()\n");

	for (;;)
		__asm__ volatile("");
}