Jeff Dike | 1d7173b | 2006-01-18 17:42:49 -0800 | [diff] [blame] | 1 | #ifndef __UML_LONGJMP_H |
2 | #define __UML_LONGJMP_H | ||||
3 | |||||
Jeff Dike | 13c06be | 2006-09-25 23:32:59 -0700 | [diff] [blame] | 4 | #include "sysdep/archsetjmp.h" |
Jeff Dike | 1d7173b | 2006-01-18 17:42:49 -0800 | [diff] [blame] | 5 | #include "os.h" |
6 | |||||
Jeff Dike | 13c06be | 2006-09-25 23:32:59 -0700 | [diff] [blame] | 7 | extern int setjmp(jmp_buf); |
8 | extern void longjmp(jmp_buf, int); | ||||
9 | |||||
Jeff Dike | ad28e029 | 2006-04-18 22:21:41 -0700 | [diff] [blame] | 10 | #define UML_LONGJMP(buf, val) do { \ |
Jeff Dike | c83d463 | 2006-01-18 17:42:50 -0800 | [diff] [blame] | 11 | longjmp(*buf, val); \ |
Jeff Dike | 1d7173b | 2006-01-18 17:42:49 -0800 | [diff] [blame] | 12 | } while(0) |
13 | |||||
Jeff Dike | a5df0d1 | 2006-07-14 00:24:02 -0700 | [diff] [blame] | 14 | #define UML_SETJMP(buf) ({ \ |
Paolo 'Blaisorblade' Giarrusso | b5cdb57 | 2006-10-11 01:21:34 -0700 | [diff] [blame] | 15 | int n; \ |
16 | volatile int enable; \ | ||||
Jeff Dike | 1d7173b | 2006-01-18 17:42:49 -0800 | [diff] [blame] | 17 | enable = get_signals(); \ |
Jeff Dike | c83d463 | 2006-01-18 17:42:50 -0800 | [diff] [blame] | 18 | n = setjmp(*buf); \ |
Jeff Dike | 1d7173b | 2006-01-18 17:42:49 -0800 | [diff] [blame] | 19 | if(n != 0) \ |
20 | set_signals(enable); \ | ||||
21 | n; }) | ||||
22 | |||||
23 | #endif |