Module Name: src Committed By: palle Date: Fri May 13 21:48:15 UTC 2016
Modified Files: src/sys/arch/sparc64/sparc64: locore.s Log Message: sun4v: add missing implementation of sun4v_datatrap_tl0 so data_access_fault() is called - mostly from OpenBSD To generate a diff of this commit: cvs rdiff -u -r1.392 -r1.393 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.392 src/sys/arch/sparc64/sparc64/locore.s:1.393 --- src/sys/arch/sparc64/sparc64/locore.s:1.392 Fri May 13 21:21:25 2016 +++ src/sys/arch/sparc64/sparc64/locore.s Fri May 13 21:48:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.392 2016/05/13 21:21:25 nakayama Exp $ */ +/* $NetBSD: locore.s,v 1.393 2016/05/13 21:48:15 palle Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -2829,9 +2829,66 @@ sun4v_datatrap: ! branch further based nop ba sun4v_datatrap_tl1 nop + sun4v_datatrap_tl0: - /* XXX missing implementaion */ - sir + GET_MMFSA %g3 ! MMU Fault status area + add %g3, 0x48, %g1 + LDPTRA [%g1] ASI_PHYS_CACHED, %g1 ! Data fault address + add %g3, 0x50, %g2 + LDPTRA [%g2] ASI_PHYS_CACHED, %g2 ! Data fault context + + TRAP_SETUP(-CC64FSZ-TF_SIZE) + or %g1, %g2, %o3 + mov %g1, %o4 + + rdpr %tt, %g4 + rdpr %tstate, %g1 + rdpr %tpc, %g2 + rdpr %tnpc, %g3 + + stx %g1, [%sp + CC64FSZ + BIAS + TF_TSTATE] + mov %g4, %o1 ! (type) + stx %g2, [%sp + CC64FSZ + BIAS + TF_PC] + rd %y, %g5 + stx %g3, [%sp + CC64FSZ + BIAS + TF_NPC] + st %g5, [%sp + CC64FSZ + BIAS + TF_Y] + mov %g2, %o2 ! (pc) + sth %o1, [%sp + CC64FSZ + BIAS + TF_TT]! debug + + cmp %o1, T_FDMMU_PROT + bne,pn %icc, 1f + mov SFSR_FV, %o5 + or %o5, SFSR_W, %o5 + +1: + NORMAL_GLOBALS_SUN4V + + stx %g1, [%sp + CC64FSZ + BIAS + TF_G + (1*8)] + stx %g2, [%sp + CC64FSZ + BIAS + TF_G + (2*8)] + add %sp, CC64FSZ + BIAS, %o0 ! (&tf) + stx %g3, [%sp + CC64FSZ + BIAS + TF_G + (3*8)] + stx %g4, [%sp + CC64FSZ + BIAS + TF_G + (4*8)] + stx %g5, [%sp + CC64FSZ + BIAS + TF_G + (5*8)] + rdpr %pil, %g5 + stx %g6, [%sp + CC64FSZ + BIAS + TF_G + (6*8)] + stx %g7, [%sp + CC64FSZ + BIAS + TF_G + (7*8)] + stb %g5, [%sp + CC64FSZ + BIAS + TF_PIL] + stb %g5, [%sp + CC64FSZ + BIAS + TF_OLDPIL] + + /* + * Phew, ready to enable traps and call C code. + */ + wrpr %g0, 0, %tl + + wr %g0, ASI_PRIMARY_NOFAULT, %asi ! Restore default ASI + wrpr %g0, PSTATE_INTR, %pstate ! traps on again + call _C_LABEL(data_access_fault) ! data_acces_fault(tf, type, ...) + nop + + ba,a,pt %icc, return_from_trap + nop + NOTREACHED + sun4v_datatrap_tl1: /* XXX missing implementaion */ sir