aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorGuoqi Chen <chenguoqi@loongson.cn>2025-09-04 17:02:01 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-09-05 18:11:42 -0700
commite8126bce9e511b92b914643d30f96846bbc5c783 (patch)
tree065833e47442d95cd372c0b9280c4525314b0964 /src/runtime
parentd767064170aa3469404d25608d9ff9fa48962337 (diff)
downloadgo-e8126bce9e511b92b914643d30f96846bbc5c783.tar.xz
runtime/cgo: save and restore R31 for crosscall1 on loong64
According to the Loong64 procedure call standard [1], R31 is a static register and therefore needs to be saved and restored. Also, the R2 (thread pointer) register has been removed here, as it is not involved in allocation. [1]: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc Change-Id: I02e5d4bedf131e491f1a262aa3cbc0896cbc9488 Reviewed-on: https://go-review.googlesource.com/c/go/+/700817 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/cgo/gcc_loong64.S42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/runtime/cgo/gcc_loong64.S b/src/runtime/cgo/gcc_loong64.S
index c84a3715b2..d2b062f49f 100644
--- a/src/runtime/cgo/gcc_loong64.S
+++ b/src/runtime/cgo/gcc_loong64.S
@@ -8,23 +8,23 @@
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
*
* Calling into the gc tool chain, where all registers are caller save.
- * Called from standard lp64d ABI, where $r1, $r3, $r23-$r30, and $f24-$f31
+ * Called from standard lp64d ABI, where $r1, $r3, $r22-$r31, and $f24-$f31
* are callee-save, so they must be saved explicitly, along with $r1 (LR).
*/
.globl crosscall1
crosscall1:
addi.d $r3, $r3, -160
st.d $r1, $r3, 0
- st.d $r23, $r3, 8
- st.d $r24, $r3, 16
- st.d $r25, $r3, 24
- st.d $r26, $r3, 32
- st.d $r27, $r3, 40
- st.d $r28, $r3, 48
- st.d $r29, $r3, 56
- st.d $r30, $r3, 64
- st.d $r2, $r3, 72
- st.d $r22, $r3, 80
+ st.d $r22, $r3, 8
+ st.d $r23, $r3, 16
+ st.d $r24, $r3, 24
+ st.d $r25, $r3, 32
+ st.d $r26, $r3, 40
+ st.d $r27, $r3, 48
+ st.d $r28, $r3, 56
+ st.d $r29, $r3, 64
+ st.d $r30, $r3, 72
+ st.d $r31, $r3, 80
fst.d $f24, $r3, 88
fst.d $f25, $r3, 96
fst.d $f26, $r3, 104
@@ -40,16 +40,16 @@ crosscall1:
jirl $r1, $r5, 0 // call setg_gcc (clobbers R4)
jirl $r1, $r23, 0 // call fn
- ld.d $r23, $r3, 8
- ld.d $r24, $r3, 16
- ld.d $r25, $r3, 24
- ld.d $r26, $r3, 32
- ld.d $r27, $r3, 40
- ld.d $r28, $r3, 48
- ld.d $r29, $r3, 56
- ld.d $r30, $r3, 64
- ld.d $r2, $r3, 72
- ld.d $r22, $r3, 80
+ ld.d $r22, $r3, 8
+ ld.d $r23, $r3, 16
+ ld.d $r24, $r3, 24
+ ld.d $r25, $r3, 32
+ ld.d $r26, $r3, 40
+ ld.d $r27, $r3, 48
+ ld.d $r28, $r3, 56
+ ld.d $r29, $r3, 64
+ ld.d $r30, $r3, 72
+ ld.d $r31, $r3, 80
fld.d $f24, $r3, 88
fld.d $f25, $r3, 96
fld.d $f26, $r3, 104