* ========== Copyright Header Begin ==========================================
* Hypervisor Software File: traps.s
* 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 ============================================
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
.ident "@(#)traps.s 1.10 07/04/22 SMI"
#include <sys/privregs.h>
#include <sys/asm_linkage.h>
save %sp, -SA(MINFRAME+(30*8)), %sp ! Room for uint64_t n[30]
rdpr %tpc, %o0; stx %o0, [%o6+STACK_BIAS+MINFRAME+(8*24)] ! %TPC
rdpr %tnpc, %o0; stx %o0, [%o6+STACK_BIAS+MINFRAME+(8*25)] ! %TNPC
rdpr %tstate, %o0; stx %o0, [%o6+STACK_BIAS+MINFRAME+(8*26)] ! %TSTATE
rdpr %tl, %o0; stb %o0, [%o6+STACK_BIAS+MINFRAME+(8*27)+0] ! %TL
rdpr %tt, %o0; stb %o0, [%o6+STACK_BIAS+MINFRAME+(8*27)+1] ! %TT
rdpr %pil, %o0; stb %o0, [%o6+STACK_BIAS+MINFRAME+(8*27)+2] ! %PIL
rdpr %gl, %o0; stb %o0, [%o6+STACK_BIAS+MINFRAME+(8*27)+3] ! %GL
stx %g0, [%o6+STACK_BIAS+MINFRAME+(8*16)]
stx %g1, [%o6+STACK_BIAS+MINFRAME+(8*17)]
stx %g2, [%o6+STACK_BIAS+MINFRAME+(8*18)]
stx %g3, [%o6+STACK_BIAS+MINFRAME+(8*19)]
stx %g4, [%o6+STACK_BIAS+MINFRAME+(8*20)]
stx %g5, [%o6+STACK_BIAS+MINFRAME+(8*21)]
stx %g6, [%o6+STACK_BIAS+MINFRAME+(8*22)]
stx %g7, [%o6+STACK_BIAS+MINFRAME+(8*23)]
0: stx %g0, [%o6+STACK_BIAS+MINFRAME+(8* 8)]
stx %g1, [%o6+STACK_BIAS+MINFRAME+(8* 9)]
stx %g2, [%o6+STACK_BIAS+MINFRAME+(8*10)]
stx %g3, [%o6+STACK_BIAS+MINFRAME+(8*11)]
stx %g4, [%o6+STACK_BIAS+MINFRAME+(8*12)]
stx %g5, [%o6+STACK_BIAS+MINFRAME+(8*13)]
stx %g6, [%o6+STACK_BIAS+MINFRAME+(8*14)]
stx %g7, [%o6+STACK_BIAS+MINFRAME+(8*15)]
stx %g0, [%o6+STACK_BIAS+MINFRAME+(8*0)]
stx %g1, [%o6+STACK_BIAS+MINFRAME+(8*1)]
stx %g2, [%o6+STACK_BIAS+MINFRAME+(8*2)]
stx %g3, [%o6+STACK_BIAS+MINFRAME+(8*3)]
stx %g4, [%o6+STACK_BIAS+MINFRAME+(8*4)]
stx %g5, [%o6+STACK_BIAS+MINFRAME+(8*5)]
stx %g6, [%o6+STACK_BIAS+MINFRAME+(8*6)]
stx %g7, [%o6+STACK_BIAS+MINFRAME+(8*7)]
add %o6, STACK_BIAS+MINFRAME, %o0
ldub [%o0+(8*27)+0], %o1; wrpr %o1, %tl
ldub [%o0+(8*27)+3], %o1; wrpr %o1, %gl
ldx [%o0+(8*24)], %o1; wrpr %o1, %tpc
ldx [%o0+(8*25)], %o1; wrpr %o1, %tnpc
ldx [%o0+(8*26)], %o1; wrpr %o1, %tstate
wrpr %g0, NWINDOWS-2, %cansave
wrpr %g0, NWINDOWS-1, %cleanwin
setn traptable0, %g2, %g1
sub %g3, %g1, %g1 ! %g1 = RA base
! Setup env. for C and goto main()