xref: /inferno-os/Linux/386/include/emu.h (revision 70847ce7c3d2ee9800014eb328f362b8e335ac76)
190ccc69fSforsyth /*
290ccc69fSforsyth  * system- and machine-specific declarations for emu:
390ccc69fSforsyth  * floating-point save and restore, signal handling primitive, and
490ccc69fSforsyth  * implementation of the current-process variable `up'.
590ccc69fSforsyth  */
690ccc69fSforsyth 
790ccc69fSforsyth /*
890ccc69fSforsyth  * This structure must agree with FPsave and FPrestore asm routines
990ccc69fSforsyth  */
1090ccc69fSforsyth typedef struct FPU FPU;
1190ccc69fSforsyth struct FPU
1290ccc69fSforsyth {
1390ccc69fSforsyth 	uchar	env[28];
1490ccc69fSforsyth };
1590ccc69fSforsyth 
161eacf117Sforsyth #define KSTACK (32 * 1024)
1790ccc69fSforsyth 
1890ccc69fSforsyth #ifndef USE_PTHREADS
getup(void)1990ccc69fSforsyth static __inline Proc *getup(void) {
2090ccc69fSforsyth 	Proc *p;
2190ccc69fSforsyth 	__asm__(	"movl	%%esp, %%eax\n\t"
2290ccc69fSforsyth 			: "=a" (p)
2390ccc69fSforsyth 	);
2490ccc69fSforsyth 	return *(Proc **)((uintptr)p & ~(KSTACK - 1));
25*70847ce7Sforsyth }
2690ccc69fSforsyth #else
2790ccc69fSforsyth extern	Proc*	getup(void);
2890ccc69fSforsyth #endif
2990ccc69fSforsyth 
3090ccc69fSforsyth #define	up	(getup())
3190ccc69fSforsyth 
3290ccc69fSforsyth typedef sigjmp_buf osjmpbuf;
3390ccc69fSforsyth #define	ossetjmp(buf)	sigsetjmp(buf, 1)
34