aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include/setjmp.h
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-05-12 18:05:21 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-05-12 18:05:21 +0200
commit513a6e99dd1f9cf5531d55f544478bec72efb910 (patch)
tree47d7789347ba596dca54704df24e85b6763f26a2 /libpsn00b/include/setjmp.h
parent4230715311892502452f326f3618e5ef4dc81972 (diff)
downloadpsn00bsdk-513a6e99dd1f9cf5531d55f544478bec72efb910.tar.gz
Downgrade GCC to 12.3, add setjmp(), fix CdGetRegion()
Diffstat (limited to 'libpsn00b/include/setjmp.h')
-rw-r--r--libpsn00b/include/setjmp.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/libpsn00b/include/setjmp.h b/libpsn00b/include/setjmp.h
new file mode 100644
index 0000000..0f05b67
--- /dev/null
+++ b/libpsn00b/include/setjmp.h
@@ -0,0 +1,31 @@
+/*
+ * PSn00bSDK standard library
+ * (C) 2023 spicyjpeg - MPL licensed
+ *
+ * This setjmp() implementation is compatible with the one in the BIOS, making
+ * it possible to pass a jmp_buf structure as-is to BIOS functions such as
+ * HookEntryInt().
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+typedef struct _JumpBuffer {
+ uint32_t ra, sp, fp;
+ uint32_t s0, s1, s2, s3, s4, s5, s6, s7;
+ uint32_t gp;
+} JumpBuffer;
+
+typedef JumpBuffer *jmp_buf;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int setjmp(jmp_buf buf);
+void longjmp(jmp_buf buf, int value);
+
+#ifdef __cplusplus
+}
+#endif