\ ========== Copyright Header Begin ==========================================
\ Hypervisor Software File: mmuregs.fth
\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
\ - Do no alter or remove copyright notices
\ - Redistribution and use of this software in source and binary forms, with
\ or without modification, are permitted provided that the following
\ - Redistribution of source code must retain the above copyright notice,
\ this list of conditions and the following disclaimer.
\ - Redistribution in binary form must reproduce the above copyright notice,
\ this list of conditions and the following disclaimer in the
\ documentation and/or other materials provided with the distribution.
\ Neither the name of Sun Microsystems, Inc. or the names of contributors
\ may be used to endorse or promote products derived from this software
\ without specific prior written permission.
\ This software is provided "AS IS," without a warranty of any kind.
\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\ You acknowledge that this software is not designed, licensed or
\ intended for use in the design, construction, operation or maintenance of
\ ========== Copyright Header End ============================================
id: @(#)mmuregs.fth 1.1 06/02/22
copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
copyright: Use is subject to license terms.
1 d# 57 lshift 1- d# 26 >> d# 26 << constant afsr-mask
: mmureg!: ( adr asi -- ) \ name ( n -- )
\itc sc1 /token scr add \ >body
scr 1 sc1 ldub \ c@ ( adr )
scr 0 sc2 ldub \ c@ ( asi )
%r3 sc3 rdasr \ save %asi in sc3
sc2 0 %r3 wrasr \ set %asi
sc3 0 %r3 wrasr \ restore %asi
: mmureg@: ( adr asi -- ) \ name ( -- n )
\itc sc1 /token scr add \ >body
scr 1 sc1 ldub \ c@ ( adr )
scr 0 sc2 ldub \ c@ ( asi )
%r3 sc3 rdasr \ save %asi in sc3
sc2 0 %r3 wrasr \ set %asi
sc3 0 %r3 wrasr \ restore %asi
38 20 mmureg@: scratch7@ \ RA of cpu struct
alias cpu-error-enable@ 0 ( -- n )
alias cpu-error-enable! drop ( n -- )
alias cpu-afsr@ 0 ( -- n )
alias cpu-afsr! drop ( n -- )
also assembler definitions
code set-softint! ( n -- )
code clear-softint! ( n -- )
code tick-compare@ ( -- n )
code tick-compare! ( n -- )
code stick-compare@ ( -- n )
code stick-compare! ( n -- )
afsr-mask cpu-afsr! \ CPU AFSR
: clr-cpu-error-enable ( bit -- )
1 swap << invert cpu-error-enable@ and cpu-error-enable!
: set-cpu-error-enable ( bit -- )
1 swap << cpu-error-enable@ or cpu-error-enable!
: ce-off ( -- ) 0 clr-cpu-error-enable ;
: ce-on ( -- ) 0 set-cpu-error-enable ;
: ecache-ecc-on ( -- ) 3 set-cpu-error-enable ;
: ecache-ecc-off ( -- ) 3 clr-cpu-error-enable ;
: ecc-off ( -- ) 1 clr-cpu-error-enable ;
: ecc-on ( -- ) init-cpu-errs 1 set-cpu-error-enable ;
\ berr cannot disable ECC, because doind so means we don't take the probe traps
\ we do need to disable bit 21 or the machine will take a fatal reset though
: berr-off ( -- ) d# 21 clr-cpu-error-enable ;
: berr-on ( -- ) ecc-on d# 21 set-cpu-error-enable ;
: disable-cpu-errors ( -- )
ecache-ecc-off ce-off ecc-off berr-off
: enable-cpu-errors ( -- )
init-cpu-errs \ start with a clean slate
h# 1.00d0.0014 \ Enable All errors!
: 1bits ( mask #bits -- mask' bits ) 1 bits ;
: 8bits ( mask #bits -- mask' bits ) 8 bits ;
\ XXXX THIS FILE IS NOT REALLY THE BEST PLACE FOR THIS XXXX
\ XXXX BUT FORM NOW IT'LL HAVE TO DO I GUESS XXXX
\ Secondary Asi DUMP and DIS
\ The dump utility gives you a formatted hex dump with the ascii
\ text corresponding to the bytes on the right hand side of the
only forth also hidden also definitions
: (asi-secondary-c@) ( padr -- byte ) h# 81 spacec@ ;
: sdump (s addr len -- ) ['] (asi-secondary-c@) is dc@ (dump) ;
: sdu (s addr -- addr+64 ) dup d# 64 sdump d# 64 + ;
previous previous definitions
also disassembler also definitions
: (sinst@ ( adr -- opcode ) h# 81 spacel@ ;
??cr ['] (sinst@ is inst@
pc@ +offset udis. 4 spaces #out @ start-column !
begin sdis1 end-found @ exit? or until
sdis1 \ Disassemble the delay instruction too
: sdis ( adr -- ) pc! +sdis ;
previous previous also definitions