aboutsummaryrefslogtreecommitdiff
path: root/FreeRTOS/riscv64/include/emu.h
blob: 060b350238072c4b3fca1b15b80a05543aaa389e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * system- and machine-specific declarations for emu:
 * floating-point save and restore, signal handling primitive, and
 * implementation of the current-process variable `up'.
 */

#ifndef _EMU_H_
#define _EMU_H_

/*
 * This structure must agree with FPsave and FPrestore asm routines
 */
typedef struct FPU FPU;
struct FPU
{
	uchar	env[28];
};


#ifndef USE_PTHREADS
#define KSTACK (16 * 1024)	/* must be power of two */
static __inline Proc *getup(void) {
	Proc *p;
	__asm__(	"mov	%0, %%sp;" 
			: "=r" (p) 
 	); 
	return *(Proc **)((uintptr)p & ~(KSTACK - 1));
}
#else
#define KSTACK (32 * 1024)	/* need not be power of two */
extern	Proc*	getup(void);
#endif

#define	up	(getup())

//typedef sigjmp_buf osjmpbuf;
//#define	ossetjmp(buf)	sigsetjmp(buf, 1)
typedef jmp_buf osjmpbuf;
#define	ossetjmp(buf)	setjmp(buf)

#endif //_EMU_H_