blob: e860bc5848e0aaff10b382f185aed8b5a4acd81e [file] [log] [blame]
Jeff Dike1d7173b2006-01-18 17:42:49 -08001#ifndef __UML_LONGJMP_H
2#define __UML_LONGJMP_H
3
Jeff Dike13c06be2006-09-25 23:32:59 -07004#include "sysdep/archsetjmp.h"
Jeff Dike1d7173b2006-01-18 17:42:49 -08005#include "os.h"
6
Jeff Dike13c06be2006-09-25 23:32:59 -07007extern int setjmp(jmp_buf);
8extern void longjmp(jmp_buf, int);
9
Jeff Dikead28e022006-04-18 22:21:41 -070010#define UML_LONGJMP(buf, val) do { \
Jeff Dikec83d4632006-01-18 17:42:50 -080011 longjmp(*buf, val); \
Jeff Dike1d7173b2006-01-18 17:42:49 -080012} while(0)
13
Jeff Dikea5df0d12006-07-14 00:24:02 -070014#define UML_SETJMP(buf) ({ \
Paolo 'Blaisorblade' Giarrussob5cdb572006-10-11 01:21:34 -070015 int n; \
16 volatile int enable; \
Jeff Dike1d7173b2006-01-18 17:42:49 -080017 enable = get_signals(); \
Jeff Dikec83d4632006-01-18 17:42:50 -080018 n = setjmp(*buf); \
Jeff Dike1d7173b2006-01-18 17:42:49 -080019 if(n != 0) \
20 set_signals(enable); \
21 n; })
22
23#endif