summaryrefslogtreecommitdiff
path: root/src/libc/setjmp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libc/setjmp.h')
-rw-r--r--src/libc/setjmp.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libc/setjmp.h b/src/libc/setjmp.h
new file mode 100644
index 0000000..5f987f1
--- /dev/null
+++ b/src/libc/setjmp.h
@@ -0,0 +1,24 @@
+#ifndef SETJMP_H
+#define SETJMP_H
+
+#include <stdint.h>
+
+// C99 states this should be an array so we can address it without
+// the & operator, see prototypes of setjmp and longjmp
+// eax, ecx and edx are scratch registers, save the others
+// also store the jump address (eip)
+typedef struct {
+ uint32_t ebx;
+ uint32_t esp;
+ uint32_t ebp;
+ uint32_t esi;
+ uint32_t edi;
+ uint32_t eip;
+} jmp_buf[1];
+
+int setjmp( jmp_buf env );
+
+void longjmp( jmp_buf env, int val );
+
+#endif // SETJMP_H
+