Author: mcayland Date: Mon Aug 19 14:58:06 2013 New Revision: 1221 URL: http://tracker.coreboot.org/trac/openbios/changeset/1221
Log: SPARC32: handle data faults for peek/poke
Signed-off-by: Bob Breuer breuerr@mc.net Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc32/init.fs trunk/openbios-devel/arch/sparc32/lib.c
Modified: trunk/openbios-devel/arch/sparc32/init.fs ============================================================================== --- trunk/openbios-devel/arch/sparc32/init.fs Mon Aug 19 14:58:03 2013 (r1220) +++ trunk/openbios-devel/arch/sparc32/init.fs Mon Aug 19 14:58:06 2013 (r1221) @@ -46,6 +46,36 @@ 0 ;
+\ (peek) and (poke) implementation +defer sfsr@ +defer ignore-dfault + +:noname + \ ( addr xt -- false | value true ) + sfsr@ drop \ Clear any existing MMU fault status + + -1 ignore-dfault ! \ Disable data fault trap + execute + 0 ignore-dfault ! \ Enable data fault trap + + sfsr@ 0= if + true + else + drop false \ Failed, drop the read value + then +; to (peek) + +:noname + \ ( value addr xt -- okay? ) + sfsr@ drop \ Clear any existing MMU fault status + + -1 ignore-dfault ! \ Disable data fault trap + execute + 0 ignore-dfault ! \ Enable data fault trap + + sfsr@ 0= \ true if no fault +; to (poke) + \ Load TCX FCode driver blob [IFDEF] CONFIG_DRIVER_SBUS -1 value tcx-driver-fcode
Modified: trunk/openbios-devel/arch/sparc32/lib.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/lib.c Mon Aug 19 14:58:03 2013 (r1220) +++ trunk/openbios-devel/arch/sparc32/lib.c Mon Aug 19 14:58:06 2013 (r1221) @@ -302,6 +302,22 @@ DPRINTF("obp_dumb_memfree 0x%p (size %d)\n", va, sz); }
+/* Data fault handling routines */ + +extern unsigned int ignore_dfault; + +/* ( -- reg ) */ +static void srmmu_get_sfsr(void) +{ + PUSH(srmmu_get_fstatus()); +} + +/* ( -- addr ) */ +static void ignore_dfault_addr(void) +{ + PUSH(pointer2cell(&ignore_dfault)); +} + void ob_init_mmu(void) { @@ -360,6 +376,12 @@ bind_func("pgmap@", pgmap_fetch); bind_func("pgmap!", pgmap_store); bind_func("map-pages", ob_map_pages); + + /* Install data fault handler words for cpeek etc. */ + PUSH_xt(bind_noname_func(srmmu_get_sfsr)); + feval("to sfsr@"); + PUSH_xt(bind_noname_func(ignore_dfault_addr)); + feval("to ignore-dfault"); }
/*