xref: /inferno-os/Linux/386/include/emu.h (revision 2b69dba5038ffd0b59cf30a4c44bce549e5097f8)
1 /*
2  * system- and machine-specific declarations for emu:
3  * floating-point save and restore, signal handling primitive, and
4  * implementation of the current-process variable `up'.
5  */
6 
7 /*
8  * This structure must agree with FPsave and FPrestore asm routines
9  */
10 typedef struct FPU FPU;
11 struct FPU
12 {
13 	uchar	env[28];
14 };
15 
16 #define KSTACK (16 * 1024)
17 
18 #ifndef USE_PTHREADS
19 static __inline Proc *getup(void) {
20 	Proc *p;
21 	__asm__(	"movl	%%esp, %%eax\n\t"
22 			: "=a" (p)
23 	);
24 	return *(Proc **)((uintptr)p & ~(KSTACK - 1));
25 };
26 #else
27 extern	Proc*	getup(void);
28 #endif
29 
30 #define	up	(getup())
31 
32 typedef sigjmp_buf osjmpbuf;
33 #define	ossetjmp(buf)	sigsetjmp(buf, 1)
34