Date: Fri, 10 Mar 2006 09:09:15 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93104 for review Message-ID: <200603100909.k2A99Fa3085808@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93104 Change 93104 by kmacy@kmacy_storage:sun4v_work on 2006/03/10 09:08:23 be more aggressive about exiting on failure set tag values up for reading in trap(...) so that fault in actually appears to work we currently die in user_rtt because %l7 isn't set to the trapframe Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#23 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#23 (text+ko) ==== @@ -54,7 +54,8 @@ #define SPILL_FILL_MAGIC_TRAP_ON nop #define SPILL_FILL_MAGIC_TRAP_OFF nop #define MAGIC_TRAP_ON ta 0x77 -#define MAGIC_TRAP_OFF ta 0x78 +#define MAGIC_TRAP_OFF ta 0x78 +#define MAGIC_EXIT ta 0x71 /*#define MAGIC_TRAP_OFF nop */ #else #define SPILL_FILL_MAGIC_TRAP_ON nop @@ -225,7 +226,7 @@ #if 0 tl0_gen T_RESERVED #else - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT .align 32 #endif @@ -239,7 +240,7 @@ wrpr %g1, WSTATE_NESTED, %wstate save %sp, -(CCFSZ + TF_SIZEOF), %sp #endif - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT .endm .macro tl1_setup type @@ -264,15 +265,15 @@ .macro insn_excptn MAGIC_TRAP_ON MAGIC_TRAP_ON - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT .align 32 .endm .macro insn_miss GET_MMFSA_SCRATCH(%g1) - mov MMFSA_D_TYPE, %g2 - mov MMFSA_D_ADDR, %g3 - mov MMFSA_D_CTX, %g7 + mov MMFSA_I_TYPE, %g2 + mov MMFSA_I_ADDR, %g3 + mov MMFSA_I_CTX, %g7 ldxa [%g1 + %g2]ASI_REAL, %g4 ldxa [%g1 + %g3]ASI_REAL, %g5 ba,pt %xcc, tsb_miss_handler @@ -282,7 +283,7 @@ .macro data_excptn MAGIC_TRAP_ON - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT .align 32 .endm @@ -312,7 +313,7 @@ MAGIC_TRAP_ON MAGIC_TRAP_ON MAGIC_TRAP_ON - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT .align 32 .endm @@ -1026,6 +1027,7 @@ nop #endif stx %l4, [%l7 + TF_TYPE] ! save trap type + stx %l5, [%l7 + TF_TAR] ! save mem info jmpl %l3, %o7 ! call trap handler mov %l7, %o0 #if 0 @@ -1034,6 +1036,7 @@ #endif ! MAGIC_TRAP_ON ENTRY(krtt) + MAGIC_TRAP_ON GET_PCPU_SCRATCH common_rtt: ! @@ -1083,6 +1086,7 @@ ! rdpr %cwp, %g1 wrpr %g1, %g4, %tstate + MAGIC_TRAP_OFF retry END(krtt) END(ktl0) @@ -1095,9 +1099,10 @@ save %sp, -(CCFSZ + TF_SIZEOF), %sp - mov %g2, %l3 ! set trap/interrupt for tl0 - or %g1, T_KERNEL, %l4 ! pil/trap type - + mov %g2, %l3 ! set trap/interrupt for tl0 + or %g1, T_KERNEL, %l4 ! pil/trap type + mov %g6, %l5 ! fault info if set + ! if the kwbuf is full we need to save to the stack now ld [PCPU_REG + PC_KWBUF_FULL], %o0 brz,pt %o0, 1f @@ -1126,7 +1131,6 @@ ! assumes %g3 - %g5 are free ! %g1 == pil that we came in on ! %g2 == interrupt handler - ! %g6 == PCB ! %g7 == PCPU ! %g3-%g5 temporaries ENTRY(tl0_trap) @@ -1137,7 +1141,7 @@ bnz,pn %xcc, tl0_ktrap wrpr %g0, %g4, %cwp ENTRY(tl0_utrap) - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT win_saved: ! @@ -1183,12 +1187,12 @@ ! %g6==context,hash size, temp ! %g7 temp ENTRY(tsb_miss_handler) - MAGIC_TRAP_ON ldxa [%g1 + %g7]ASI_REAL, %g6 ! load in the context cmp %g6, %g0 ! kernel? be,pn %xcc, 1f - srlx %g5, TTARGET_VA_SHIFT, %g1 + srlx %g5, TTARGET_VA_SHIFT, %g1 + MAGIC_TRAP_ON GET_HASH_SCRATCH_USER(%g2) ba,pt %xcc, 2f sllx %g6, TTARGET_CTX_SHIFT, %g6 @@ -1208,7 +1212,7 @@ bne,pt %xcc, 3f nop tsb_miss_null_deref: - illtrap ! give up + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT ! give up 3: #endif sethi %hi(PAGE_SIZE), %g7 @@ -1228,11 +1232,11 @@ ! %g2==entry base add %g2, %g4, %g2 ! base + offset == entry base - + mov %g5, %g7 ! entry 0 ! %g1 == abs index %g2 == THE pointer %g3 == flags ! %g4 <- tag %g5 <- data - ! %g6 == search tag %g7 == PAGE_MASK + ! %g6 == search tag %g7 == fault addr tsb_miss_lookup_0: ldda [%g2 + %g0]ASI_LDTD_N, %g4 cmp %g4, %g0 ! entry tag == 0 ? @@ -1275,16 +1279,22 @@ 4: ! not found ! we need to jump to tl0_trap to drop us back down to tl0 ! and take us to trap(...) to service the fault - mov T_DATA_MISS, %g1 - sethi %hi(trap), %g2 + + srlx %g6, TTARGET_CTX_SHIFT, %g4 ! recover context + or %g4, %g7, %g6 + mov T_DATA_MISS, %g1 + sethi %hi(trap), %g2 ba %xcc, tl0_trap - or %g2, %lo(trap), %g2 + or %g2, %lo(trap), %g2 tsb_miss_found: 5: !found ! %g1 == abs index %g2 == THE pointer %g3 == flags ! %g4 == tag %g5 == data %g7 == PAGE_MASK ! %g3 <- TSB RA %g6 <- TSB size, TTE RA + + sethi %hi(PAGE_SIZE), %g7 srlx %g6, TTARGET_CTX_SHIFT, %g6 + sub %g7, 1, %g7 ! %g7==PAGE_MASK andcc %g5, %g3, %g0 ! already set bnz,pt %xcc, 7f @@ -1302,7 +1312,7 @@ be,pn %xcc, 8f nop GET_TSB_SCRATCH_USER(%g3) ! %g3 == TSB (RA) - ba,a,pt %xcc, 9f + ba,pt %xcc, 9f and %g3, %g7, %g6 ! size of TSB in pages 8: GET_TSB_SCRATCH_KERNEL(%g3) ! %g3 == TSB (RA) @@ -1320,12 +1330,13 @@ cmp %g3, %g5 bne,pt %xcc, 10f nop - illtrap ! die if all we're doing + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT ! die if all we're doing ! is storing same data 10: #endif stxa %g4, [%g6]ASI_REAL ! store tag stxa %g5, [%g6 + %g7]ASI_REAL ! store data + MAGIC_TRAP_OFF ! XXX the following intstruction should be replaced with a ! retry on HVs that do auto-demap @@ -1335,7 +1346,7 @@ mov MMFSA_D_CTX, %g2 retry demap_begin: - GET_MMFSA_SCRATCH(%g1) + GET_MMFSA_SCRATCH(%g1) ! XXX this isn't re-entrant mov MMFSA_D_ADDR, %g3 mov %o0, %g5 mov %o1, %g6 @@ -1349,7 +1360,6 @@ mov %g5, %o0 mov %g6, %o1 mov %g7, %o2 - MAGIC_TRAP_OFF retry END(tsb_miss_handler) @@ -1358,7 +1368,7 @@ * Write to read-only page */ ENTRY(prot_fault_trap) - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT END(prot_fault_trap) @@ -1404,7 +1414,7 @@ ENTRY(tl1_trap) - illtrap + MAGIC_TRAP_ON;MAGIC_TRAP_ON;MAGIC_EXIT END(tl1_trap) /* * Initiate return to usermode.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603100909.k2A99Fa3085808>