From e07c8d0ac5fc1f7fdf0aa36d14da93bb573c01c3 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 7 Aug 2024 20:28:53 -0700 Subject: [PATCH] loongarch64: fix return values from getcontext/swapcontext --- arch/loongarch64/getcontext.S | 3 +++ arch/loongarch64/swapcontext.S | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/loongarch64/getcontext.S b/arch/loongarch64/getcontext.S index 49c90a9..27f4d36 100644 --- a/arch/loongarch64/getcontext.S +++ b/arch/loongarch64/getcontext.S @@ -35,11 +35,14 @@ FUNC(libucontext_getcontext) st.d $s8, $a0, REG_OFFSET(31) st.d $a2, $a0, REG_OFFSET(3) + st.d $zero, $a0, REG_OFFSET(4) st.d $a3, $a0, REG_OFFSET(22) st.d $ra, $a0, REG_OFFSET(1) st.d $ra, $a0, (MCONTEXT_PC) + move $a0, $zero + POP_FRAME(libucontext_getcontext) jr $ra diff --git a/arch/loongarch64/swapcontext.S b/arch/loongarch64/swapcontext.S index 6cde30e..0d589a4 100644 --- a/arch/loongarch64/swapcontext.S +++ b/arch/loongarch64/swapcontext.S @@ -39,6 +39,7 @@ FUNC(libucontext_swapcontext) st.d $s8, $t5, REG_OFFSET(31) st.d $a3, $t5, REG_OFFSET(3) + st.d $zero, $t5, REG_OFFSET(4) st.d $a4, $t5, REG_OFFSET(22) st.d $ra, $t5, REG_OFFSET(1)