0001-Revert-ARC-entry-fix-potential-EFA-clobber-when-TIF_.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From af5e43cd88d4b7d59260de6bdacbf715e2a7ff5d Mon Sep 17 00:00:00 2001
  2. From: Waldemar Brodkorb <wbx@openadk.org>
  3. Date: Fri, 16 Oct 2020 01:17:24 +0200
  4. Subject: [PATCH] Revert "ARC: entry: fix potential EFA clobber when
  5. TIF_SYSCALL_TRACE"
  6. This reverts commit 01b636cbc4c39c7073c02c2f1dfbe8c36c11938f.
  7. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  8. ---
  9. arch/arc/kernel/entry.S | 16 +++++++++++-----
  10. 1 file changed, 11 insertions(+), 5 deletions(-)
  11. diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
  12. index 705a68208423..85d9ea4a0acc 100644
  13. --- a/arch/arc/kernel/entry.S
  14. +++ b/arch/arc/kernel/entry.S
  15. @@ -156,6 +156,7 @@ END(EV_Extension)
  16. tracesys:
  17. ; save EFA in case tracer wants the PC of traced task
  18. ; using ERET won't work since next-PC has already committed
  19. + lr r12, [efa]
  20. GET_CURR_TASK_FIELD_PTR TASK_THREAD, r11
  21. st r12, [r11, THREAD_FAULT_ADDR] ; thread.fault_address
  22. @@ -198,9 +199,15 @@ tracesys_exit:
  23. ; Breakpoint TRAP
  24. ; ---------------------------------------------
  25. trap_with_param:
  26. - mov r0, r12 ; EFA in case ptracer/gdb wants stop_pc
  27. +
  28. + ; stop_pc info by gdb needs this info
  29. + lr r0, [efa]
  30. mov r1, sp
  31. + ; Now that we have read EFA, it is safe to do "fake" rtie
  32. + ; and get out of CPU exception mode
  33. + FAKE_RET_FROM_EXCPN
  34. +
  35. ; Save callee regs in case gdb wants to have a look
  36. ; SP will grow up by size of CALLEE Reg-File
  37. ; NOTE: clobbers r12
  38. @@ -227,10 +234,6 @@ ENTRY(EV_Trap)
  39. EXCEPTION_PROLOGUE
  40. - lr r12, [efa]
  41. -
  42. - FAKE_RET_FROM_EXCPN
  43. -
  44. ;============ TRAP 1 :breakpoints
  45. ; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
  46. bmsk.f 0, r9, 7
  47. @@ -238,6 +241,9 @@ ENTRY(EV_Trap)
  48. ;============ TRAP (no param): syscall top level
  49. + ; First return from Exception to pure K mode (Exception/IRQs renabled)
  50. + FAKE_RET_FROM_EXCPN
  51. +
  52. ; If syscall tracing ongoing, invoke pre-post-hooks
  53. GET_CURR_THR_INFO_FLAGS r10
  54. btst r10, TIF_SYSCALL_TRACE
  55. --
  56. 2.11.0