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)