From c2a8b0a9d5f2a6523e04e77899f9039684dc2e90 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 7 Aug 2024 19:19:29 -0700 Subject: [PATCH] riscv32: fix getcontext/swapcontext return value --- arch/riscv32/getcontext.S | 5 +++-- arch/riscv32/swapcontext.S | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/riscv32/getcontext.S b/arch/riscv32/getcontext.S index 888b6ab..b3ae61d 100644 --- a/arch/riscv32/getcontext.S +++ b/arch/riscv32/getcontext.S @@ -25,8 +25,8 @@ FUNC(libucontext_getcontext) sw s1, REG_OFFSET(REG_S1)(a0) /* return register block */ - sw a0, REG_OFFSET(REG_A0)(a0) - sw a1, REG_OFFSET(REG_A1)(a0) + sw x0, REG_OFFSET(REG_A0)(a0) + sw x0, REG_OFFSET(REG_A1)(a0) /* second saved register block */ sw s2, REG_OFFSET(REG_S2)(a0) @@ -41,5 +41,6 @@ FUNC(libucontext_getcontext) sw s11, REG_OFFSET(REG_S11)(a0) /* done saving, return */ + mv a0, x0 ret END(libucontext_getcontext) diff --git a/arch/riscv32/swapcontext.S b/arch/riscv32/swapcontext.S index a4c7138..417c0a4 100644 --- a/arch/riscv32/swapcontext.S +++ b/arch/riscv32/swapcontext.S @@ -28,8 +28,8 @@ FUNC(libucontext_swapcontext) sw s1, REG_OFFSET(REG_S1)(a0) /* return register block */ - sw a0, REG_OFFSET(REG_A0)(a0) - sw a1, REG_OFFSET(REG_A1)(a0) + sw x0, REG_OFFSET(REG_A0)(a0) + sw x0, REG_OFFSET(REG_A1)(a0) /* second saved register block */ sw s2, REG_OFFSET(REG_S2)(a0)