From e603fd72394d828f3774cf8ed7bcaeb8d85491df Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 7 Aug 2024 19:15:42 -0700 Subject: [PATCH] riscv64: fix getcontext/swapcontext return values --- arch/riscv64/getcontext.S | 5 +++-- arch/riscv64/swapcontext.S | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/riscv64/getcontext.S b/arch/riscv64/getcontext.S index 99a9c9a..0992bd9 100644 --- a/arch/riscv64/getcontext.S +++ b/arch/riscv64/getcontext.S @@ -25,8 +25,8 @@ FUNC(libucontext_getcontext) sd s1, REG_OFFSET(REG_S1)(a0) /* return register block */ - sd a0, REG_OFFSET(REG_A0)(a0) - sd a1, REG_OFFSET(REG_A1)(a0) + sd x0, REG_OFFSET(REG_A0)(a0) + sd x0, REG_OFFSET(REG_A1)(a0) /* second saved register block */ sd s2, REG_OFFSET(REG_S2)(a0) @@ -41,5 +41,6 @@ FUNC(libucontext_getcontext) sd s11, REG_OFFSET(REG_S11)(a0) /* done saving, return */ + mv a0, x0 ret END(libucontext_getcontext) diff --git a/arch/riscv64/swapcontext.S b/arch/riscv64/swapcontext.S index a2b013e..ee2139a 100644 --- a/arch/riscv64/swapcontext.S +++ b/arch/riscv64/swapcontext.S @@ -28,8 +28,8 @@ FUNC(libucontext_swapcontext) sd s1, REG_OFFSET(REG_S1)(a0) /* return register block */ - sd a0, REG_OFFSET(REG_A0)(a0) - sd a1, REG_OFFSET(REG_A1)(a0) + sd x0, REG_OFFSET(REG_A0)(a0) + sd x0, REG_OFFSET(REG_A1)(a0) /* second saved register block */ sd s2, REG_OFFSET(REG_S2)(a0)