summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-10 20:18:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-10 20:18:50 -0700
commit8c9a6b896ef0cef0cbef7696b30015aba2ed2ae5 (patch)
tree81814f5e494194105c01dce28d11eb16eabac563
parent7a027d8127514c143b25f58666c1df9bff46517a (diff)
downloadtxr-8c9a6b896ef0cef0cbef7696b30015aba2ed2ae5.tar.gz
txr-8c9a6b896ef0cef0cbef7696b30015aba2ed2ae5.tar.bz2
txr-8c9a6b896ef0cef0cbef7696b30015aba2ed2ae5.zip
Support Loongarch.
* jmp.S (jmp_save, jmp_restore): Define for Loongarch. * unwind.h (struct jmp): Likewise.
-rw-r--r--jmp.S54
-rw-r--r--unwind.h27
2 files changed, 81 insertions, 0 deletions
diff --git a/jmp.S b/jmp.S
index 9acee8a9..d426990f 100644
--- a/jmp.S
+++ b/jmp.S
@@ -486,6 +486,60 @@ DEFUN(jmp_restore)
mv a0, a1
ret
+#elif __loongarch64
+
+DEFUN(jmp_save)
+ st.d $ra, $a0, 0
+ st.d $sp, $a0, 8
+ st.d $fp, $a0, 16
+ st.d $s0, $a0, 24
+ st.d $s1, $a0, 32
+ st.d $s2, $a0, 40
+ st.d $s3, $a0, 48
+ st.d $s4, $a0, 56
+ st.d $s5, $a0, 64
+ st.d $s6, $a0, 72
+ st.d $s7, $a0, 80
+ st.d $s8, $a0, 88
+#if 0 && !__loongarch64_soft_float
+ fst.d $fs0, $a0, 96
+ fst.d $fs1, $a0, 104
+ fst.d $fs2, $a0, 112
+ fst.d $fs3, $a0, 120
+ fst.d $fs4, $a0, 128
+ fst.d $fs5, $a0, 136
+ fst.d $fs6, $a0, 144
+ fst.d $fs7, $a0, 152
+#endif
+ xor $v0, $v0, $v0
+ jirl $zero, $ra, 0
+
+DEFUN(jmp_restore)
+ ld.d $ra, $a0, 0
+ ld.d $sp, $a0, 8
+ ld.d $fp, $a0, 16
+ ld.d $s0, $a0, 24
+ ld.d $s1, $a0, 32
+ ld.d $s2, $a0, 40
+ ld.d $s3, $a0, 48
+ ld.d $s4, $a0, 56
+ ld.d $s5, $a0, 64
+ ld.d $s6, $a0, 72
+ ld.d $s7, $a0, 80
+ ld.d $s8, $a0, 88
+#if 0 && !__loongarch64_soft_float
+ fld.d $fs0, $a0, 96
+ fld.d $fs1, $a0, 104
+ fld.d $fs2, $a0, 112
+ fld.d $fs3, $a0, 120
+ fld.d $fs4, $a0, 128
+ fld.d $fs5, $a0, 136
+ fld.d $fs6, $a0, 144
+ fld.d $fs7, $a0, 152
+#endif
+ add.d $v0, $a1, $zero
+ jirl $zero, $ra, 0
+
#else
#error port me!
#endif
diff --git a/unwind.h b/unwind.h
index ea9bd9a6..69a7e135 100644
--- a/unwind.h
+++ b/unwind.h
@@ -192,6 +192,33 @@ struct jmp {
#endif
};
+#elif __loongarch64
+
+struct jmp {
+ unsigned long ra;
+ unsigned long sp;
+ unsigned long fp;
+ unsigned long s0;
+ unsigned long s1;
+ unsigned long s2;
+ unsigned long s3;
+ unsigned long s4;
+ unsigned long s5;
+ unsigned long s6;
+ unsigned long s7;
+ unsigned long s8;
+#if 0 && !__loongarch64_soft_float
+ double fs0;
+ double fs1;
+ double fs2;
+ double fs3;
+ double fs4;
+ double fs5;
+ double fs6;
+ double fs7;
+#endif
+};
+
#else
#error port me!
#endif