summaryrefslogtreecommitdiff
path: root/arch/riscv64/pthread_arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv64/pthread_arch.h')
-rw-r--r--arch/riscv64/pthread_arch.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/riscv64/pthread_arch.h b/arch/riscv64/pthread_arch.h
new file mode 100644
index 00000000..1268b72d
--- /dev/null
+++ b/arch/riscv64/pthread_arch.h
@@ -0,0 +1,14 @@
+static inline struct pthread *__pthread_self()
+{
+ char *tp;
+ __asm__ __volatile__("mv %0, tp" : "=r"(tp));
+ return (void *)(tp - sizeof(struct pthread));
+}
+
+#define TLS_ABOVE_TP
+#define GAP_ABOVE_TP 0
+#define TP_ADJ(p) ((char *)p + sizeof(struct pthread))
+
+#define DTP_OFFSET 0x800
+
+#define MC_PC gregs[0]