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