1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <asm/thread_info.h>
3 #include <asm/trap_block.h>
4 #include <asm/spitfire.h>
5 #include <asm/ptrace.h>
10 .globl user_rtt_fill_fixup_common
11 user_rtt_fill_fixup_common:
18 wrpr %g2, 0x0, %wstate
20 /* We know %canrestore and %otherwin are both zero. */
22 sethi %hi(sparc64_kern_pri_context), %g2
23 ldx [%g2 + %lo(sparc64_kern_pri_context)], %g2
24 mov PRIMARY_CONTEXT, %g1
26 661: stxa %g2, [%g1] ASI_DMMU
27 .section .sun4v_1insn_patch, "ax"
29 stxa %g2, [%g1] ASI_MMU
32 sethi %hi(KERNBASE), %g1
40 or %g4, FAULT_CODE_WINFIXUP, %g4
41 stb %g4, [%g6 + TI_FAULT_CODE]
42 stx %g5, [%g6 + TI_FAULT_ADDR]
48 .section .sun4v_1insn_patch, "ax"
53 661: wrpr %g0, RTRAP_PSTATE, %pstate
54 .section .sun_m7_1insn_patch, "ax"
56 /* Re-enable PSTATE.mcde to maintain ADI security */
57 wrpr %g0, RTRAP_PSTATE|PSTATE_MCDE, %pstate
61 ldx [%g6 + TI_TASK], %g4
62 LOAD_PER_CPU_BASE(%g5, %g6, %g1, %g2, %g3)
68 add %sp, PTREGS_OFF, %o0
76 sethi %hi(tlb_type), %g1
77 lduw [%g1 + %lo(tlb_type)], %g1
80 add %sp, PTREGS_OFF, %o0
87 call mem_address_unaligned
91 2: sethi %hi(tlb_type), %g1
93 lduw [%g1 + %lo(tlb_type)], %g1
97 add %sp, PTREGS_OFF, %o0
98 call sun4v_data_access_exception
103 1: call spitfire_data_access_exception