aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorGuoqi Chen <chenguoqi@loongson.cn>2025-02-25 10:50:50 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-02-26 17:36:57 -0800
commit01ba8bfe868df2eea10ea8dd5bfbe5af0549909d (patch)
tree42b9a7b19360301bfea841a1c3175c2e39ae73de /src/runtime
parent11c847e536bff955eab65cc0a3008557362dda22 (diff)
downloadgo-01ba8bfe868df2eea10ea8dd5bfbe5af0549909d.tar.xz
runtime/cgo: use standard ABI call setg_gcc in crosscall1 on loong64
Change-Id: Ie38583d667d579751d643b2da2aa56390b69904c Reviewed-on: https://go-review.googlesource.com/c/go/+/652255 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asm_loong64.s4
-rw-r--r--src/runtime/cgo/gcc_loong64.S7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/runtime/asm_loong64.s b/src/runtime/asm_loong64.s
index d5dc61ff68..604b1243f7 100644
--- a/src/runtime/asm_loong64.s
+++ b/src/runtime/asm_loong64.s
@@ -656,9 +656,9 @@ TEXT runtime·setg(SB), NOSPLIT, $0-8
JAL runtime·save_g(SB)
RET
-// void setg_gcc(G*); set g called from gcc with g in R19
+// void setg_gcc(G*); set g called from gcc with g in R4
TEXT setg_gcc<>(SB),NOSPLIT,$0-0
- MOVV R19, g
+ MOVV R4, g
JAL runtime·save_g(SB)
RET
diff --git a/src/runtime/cgo/gcc_loong64.S b/src/runtime/cgo/gcc_loong64.S
index 6b7668f288..c84a3715b2 100644
--- a/src/runtime/cgo/gcc_loong64.S
+++ b/src/runtime/cgo/gcc_loong64.S
@@ -34,10 +34,11 @@ crosscall1:
fst.d $f30, $r3, 136
fst.d $f31, $r3, 144
- move $r18, $r4 // save R4
- move $r19, $r6
+ // r4 = *fn, r5 = *setg_gcc, r6 = *g
+ move $r23, $r4 // save R4
+ move $r4, $r6
jirl $r1, $r5, 0 // call setg_gcc (clobbers R4)
- jirl $r1, $r18, 0 // call fn
+ jirl $r1, $r23, 0 // call fn
ld.d $r23, $r3, 8
ld.d $r24, $r3, 16