aboutsummaryrefslogtreecommitdiff
path: root/FreeRTOS/riscv64/include/emu.h
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/riscv64/include/emu.h')
-rw-r--r--FreeRTOS/riscv64/include/emu.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/FreeRTOS/riscv64/include/emu.h b/FreeRTOS/riscv64/include/emu.h
new file mode 100644
index 0000000..060b350
--- /dev/null
+++ b/FreeRTOS/riscv64/include/emu.h
@@ -0,0 +1,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_ \ No newline at end of file