0003-RISC-V-Fix-syscall_cp-on-riscv64-32.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From e257365645012bc47a4273eeb2224451b656a3ad Mon Sep 17 00:00:00 2001
  2. From: Drew DeVault <sir@cmpwn.com>
  3. Date: Fri, 14 Dec 2018 20:32:12 -0500
  4. Subject: [PATCH 3/5] RISC-V: Fix syscall_cp on riscv64/32
  5. Thanks to Rich Felker for pointing out this error on the musl list. In
  6. addition to fixing the labels, this loads the cancel flag with lw
  7. instead of ld.
  8. ---
  9. src/thread/riscv32/syscall_cp.s | 4 ++--
  10. src/thread/riscv64/syscall_cp.s | 6 +++---
  11. 2 files changed, 5 insertions(+), 5 deletions(-)
  12. diff --git a/src/thread/riscv32/syscall_cp.s b/src/thread/riscv32/syscall_cp.s
  13. index 71bf6d3e..9c450402 100644
  14. --- a/src/thread/riscv32/syscall_cp.s
  15. +++ b/src/thread/riscv32/syscall_cp.s
  16. @@ -23,7 +23,7 @@ __cp_begin:
  17. lw a6, 0(sp)
  18. mv a7, t0
  19. scall
  20. -__cp_cancel:
  21. - ret
  22. __cp_end:
  23. + ret
  24. +__cp_cancel:
  25. j __cancel
  26. diff --git a/src/thread/riscv64/syscall_cp.s b/src/thread/riscv64/syscall_cp.s
  27. index c745b328..65cf722f 100644
  28. --- a/src/thread/riscv64/syscall_cp.s
  29. +++ b/src/thread/riscv64/syscall_cp.s
  30. @@ -10,7 +10,7 @@
  31. .type __syscall_cp_asm, %function
  32. __syscall_cp_asm:
  33. __cp_begin:
  34. - ld t0, 0(a0)
  35. + lw t0, 0(a0)
  36. bnez t0, __cp_cancel
  37. mv t0, a1
  38. @@ -23,7 +23,7 @@ __cp_begin:
  39. ld a6, 0(sp)
  40. mv a7, t0
  41. scall
  42. -__cp_cancel:
  43. - ret
  44. __cp_end:
  45. + ret
  46. +__cp_cancel:
  47. j __cancel
  48. --
  49. 2.20.1