urtt_fill.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #include <asm/thread_info.h>
  2. #include <asm/trap_block.h>
  3. #include <asm/spitfire.h>
  4. #include <asm/ptrace.h>
  5. #include <asm/head.h>
  6. .text
  7. .align 8
  8. .globl user_rtt_fill_fixup_common
  9. user_rtt_fill_fixup_common:
  10. rdpr %cwp, %g1
  11. add %g1, 1, %g1
  12. wrpr %g1, 0x0, %cwp
  13. rdpr %wstate, %g2
  14. sll %g2, 3, %g2
  15. wrpr %g2, 0x0, %wstate
  16. /* We know %canrestore and %otherwin are both zero. */
  17. sethi %hi(sparc64_kern_pri_context), %g2
  18. ldx [%g2 + %lo(sparc64_kern_pri_context)], %g2
  19. mov PRIMARY_CONTEXT, %g1
  20. 661: stxa %g2, [%g1] ASI_DMMU
  21. .section .sun4v_1insn_patch, "ax"
  22. .word 661b
  23. stxa %g2, [%g1] ASI_MMU
  24. .previous
  25. sethi %hi(KERNBASE), %g1
  26. flush %g1
  27. mov %g4, %l4
  28. mov %g5, %l5
  29. brnz,pn %g3, 1f
  30. mov %g3, %l3
  31. or %g4, FAULT_CODE_WINFIXUP, %g4
  32. stb %g4, [%g6 + TI_FAULT_CODE]
  33. stx %g5, [%g6 + TI_FAULT_ADDR]
  34. 1:
  35. mov %g6, %l1
  36. wrpr %g0, 0x0, %tl
  37. 661: nop
  38. .section .sun4v_1insn_patch, "ax"
  39. .word 661b
  40. SET_GL(0)
  41. .previous
  42. wrpr %g0, RTRAP_PSTATE, %pstate
  43. mov %l1, %g6
  44. ldx [%g6 + TI_TASK], %g4
  45. LOAD_PER_CPU_BASE(%g5, %g6, %g1, %g2, %g3)
  46. brnz,pn %l3, 1f
  47. nop
  48. call do_sparc64_fault
  49. add %sp, PTREGS_OFF, %o0
  50. ba,pt %xcc, rtrap
  51. nop
  52. 1: cmp %g3, 2
  53. bne,pn %xcc, 2f
  54. nop
  55. sethi %hi(tlb_type), %g1
  56. lduw [%g1 + %lo(tlb_type)], %g1
  57. cmp %g1, 3
  58. bne,pt %icc, 1f
  59. add %sp, PTREGS_OFF, %o0
  60. mov %l4, %o2
  61. call sun4v_do_mna
  62. mov %l5, %o1
  63. ba,a,pt %xcc, rtrap
  64. 1: mov %l4, %o1
  65. mov %l5, %o2
  66. call mem_address_unaligned
  67. nop
  68. ba,a,pt %xcc, rtrap
  69. 2: sethi %hi(tlb_type), %g1
  70. mov %l4, %o1
  71. lduw [%g1 + %lo(tlb_type)], %g1
  72. mov %l5, %o2
  73. cmp %g1, 3
  74. bne,pt %icc, 1f
  75. add %sp, PTREGS_OFF, %o0
  76. call sun4v_data_access_exception
  77. nop
  78. ba,a,pt %xcc, rtrap
  79. 1: call spitfire_data_access_exception
  80. nop
  81. ba,a,pt %xcc, rtrap