\ ========== Copyright Header Begin ==========================================
\ Hypervisor Software File: forthint.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: @(#)forthint.fth 1.3 07/06/22
copyright: Copyright 2007 Sun Microsystems, Inc. All rights reserved.
copyright: Use is subject to license terms.
code interrupt-return ( abort? -- )
%g1 0 %r21 wrasr \ Clear SOFT INT. Reg
h# 10001 %g4 set \ STICK | TICK
h# 10001 %g4 set \ STICK | TICK
\ Only re-arm alarms if we arent aborted.
%g4 up %g4 nget \ Get interval incr
%r24 %g7 rdasr \ get Stick
%g7 %g0 %r25 wrasr \ Set StickCompare
%l5 %g0 h# 20 %l5 ldxa \ CPU struct PA
%l0 %l5 %g5 add \ CPU save area
restore-cpu-state 0= brif \ Not aborted resume
%g0 2 %g4 add \ restore and cont.
restore-cpu-state always brif
%g0 2 wrgl \ ok goto savestate
small-forth-save-state always brif
my-self >r \ XXX Need this??
r> is my-self \ XXX Need this??
aborted? @ interrupt-return
%g1 %g0 h# 20 %g1 ldxa \ CPU struct PA
%g5 %g1 %g5 add \ DMMU stacks
%g0 %g6 move \ Small Save
save-cpu-state always brif
\ We are now in a normal TL=0, IE=1, CWP=0 environment
'body interrupt-handler %l7 set
setup-small-forth-engine always brif nop
system-tick-speed d# 100 / dup to tick-ival
stick@ -1 1 >> and + stick-compare!
' set-next-tick is rearm-alarms
interrupt-preamble h# 4e vector!
stand-init: Installing Simple Ticker
: memory-warning ( request-size -- adr actual-size false | error true )
cif: SUNW,heartbeat ( msecs -- abort? )
check-alarm aborted? @ 0<>
defer guest-state-boot-hook ( -- ) ' noop is guest-state-boot-hook
: set-trap-table ( [mmu-area-ra] virt -- )
obp-control-relinquished? 0= if client-starting-chain then
\ Save current %pstate and %pil
1 d# 63 << stick-compare! ( virt )
-1 clear-softint! ( virt )
\ we don't permit more dynamic allocation.
['] memory-warning is more-memory
\ Client has now officially "taken over"
true to obp-control-relinquished?
\ Restore previous %pil and %pstate
cif: SUNW,sun4v-set-trap-table ( [mmu-area-ra] virt -- ) set-trap-table ;
cif: SUNW,set-trap-table ( [mmu-area-ra] virt -- ) set-trap-table ;