/* SPDX-License-Identifier: GPL-2.0 */1/*2* dtlb_prot.S: DTLB protection trap strategy.3* This is included directly into the trap table.4*5* Copyright (C) 1996,1998 David S. Miller ([email protected])6* Copyright (C) 1997,1998 Jakub Jelinek ([email protected])7*/89/* Ways we can get here:10*11* [TL == 0] 1) User stores to readonly pages.12* [TL == 0] 2) Nucleus stores to user readonly pages.13* [TL > 0] 3) Nucleus stores to user readonly stack frame.14*/1516/* PROT ** ICACHE line 1: User DTLB protection trap */17mov TLB_SFSR, %g118stxa %g0, [%g1] ASI_DMMU ! Clear FaultValid bit19membar #Sync ! Synchronize stores20rdpr %pstate, %g5 ! Move into alt-globals21wrpr %g5, PSTATE_AG|PSTATE_MG, %pstate22rdpr %tl, %g1 ! Need a winfixup?23cmp %g1, 1 ! Trap level >1?24mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr2526/* PROT ** ICACHE line 2: More real fault processing */27ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g528srlx %g5, PAGE_SHIFT, %g529sllx %g5, PAGE_SHIFT, %g5 ! Clear context ID bits30bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup31mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g432ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault33nop34nop3536/* PROT ** ICACHE line 3: Unused... */37nop38nop39nop40nop41nop42nop43nop44nop4546/* PROT ** ICACHE line 4: Unused... */47nop48nop49nop50nop51nop52nop53nop54nop555657