188794Sjake/*- 288794Sjake * Copyright (c) 2001 Jake Burkholder. 388794Sjake * All rights reserved. 488794Sjake * 588794Sjake * Redistribution and use in source and binary forms, with or without 688794Sjake * modification, are permitted provided that the following conditions 788794Sjake * are met: 888794Sjake * 1. Redistributions of source code must retain the above copyright 988794Sjake * notice, this list of conditions and the following disclaimer. 1088794Sjake * 2. Redistributions in binary form must reproduce the above copyright 1188794Sjake * notice, this list of conditions and the following disclaimer in the 1288794Sjake * documentation and/or other materials provided with the distribution. 1388794Sjake * 1488794Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1588794Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1688794Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1788794Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1888794Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1988794Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2088794Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2188794Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2288794Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2388794Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2488794Sjake * SUCH DAMAGE. 2588794Sjake */ 2688794Sjake 2799116Sobrien#include <machine/asm.h> 2899116Sobrien__FBSDID("$FreeBSD: releng/10.3/lib/libc/sparc64/sys/__sparc_utrap_gen.S 221869 2011-05-14 01:53:38Z attilio $"); 2988794Sjake 3088794Sjake .register %g2, #ignore 3188794Sjake .register %g3, #ignore 3288794Sjake .register %g6, #ignore 3388794Sjake .register %g7, #ignore 3488794Sjake 3591159Sjake#include <machine/tstate.h> 3688794Sjake#include <machine/utrap.h> 3788794Sjake 3888794Sjake#include "assym.s" 3988794Sjake 4088794SjakeENTRY(__sparc_utrap_gen) 4191159Sjake sub %sp, UF_SIZEOF, %sp 4288794Sjake 4388794Sjake stx %o0, [%sp + SPOFF + CCFSZ + UF_TYPE] 4488794Sjake stx %o3, [%sp + SPOFF + CCFSZ + UF_TAR] 4588794Sjake stx %o4, [%sp + SPOFF + CCFSZ + UF_SFAR] 4688794Sjake stx %o5, [%sp + SPOFF + CCFSZ + UF_SFSR] 4788794Sjake 4891159Sjake stx %l4, [%sp + SPOFF + CCFSZ + UF_FSR] 4991159Sjake stx %l5, [%sp + SPOFF + CCFSZ + UF_STATE] 5088794Sjake stx %l6, [%sp + SPOFF + CCFSZ + UF_PC] 5188794Sjake stx %l7, [%sp + SPOFF + CCFSZ + UF_NPC] 5288794Sjake 5388794Sjake stx %g1, [%sp + SPOFF + CCFSZ + UF_G1] 5488794Sjake stx %g2, [%sp + SPOFF + CCFSZ + UF_G2] 5588794Sjake stx %g3, [%sp + SPOFF + CCFSZ + UF_G3] 5688794Sjake stx %g4, [%sp + SPOFF + CCFSZ + UF_G4] 5788794Sjake stx %g5, [%sp + SPOFF + CCFSZ + UF_G5] 5888794Sjake stx %g6, [%sp + SPOFF + CCFSZ + UF_G6] 5988794Sjake stx %g7, [%sp + SPOFF + CCFSZ + UF_G7] 6088794Sjake 6188794Sjake stx %i0, [%sp + SPOFF + CCFSZ + UF_O0] 6288794Sjake stx %i1, [%sp + SPOFF + CCFSZ + UF_O1] 6388794Sjake stx %i2, [%sp + SPOFF + CCFSZ + UF_O2] 6488794Sjake stx %i3, [%sp + SPOFF + CCFSZ + UF_O3] 6588794Sjake stx %i4, [%sp + SPOFF + CCFSZ + UF_O4] 6688794Sjake stx %i5, [%sp + SPOFF + CCFSZ + UF_O5] 6788794Sjake stx %i6, [%sp + SPOFF + CCFSZ + UF_O6] 6888794Sjake stx %i7, [%sp + SPOFF + CCFSZ + UF_O7] 6988794Sjake 7092049Stmm rd %y, %l6 7192049Stmm 7288794Sjake call __sparc_utrap 7388794Sjake add %sp, SPOFF + CCFSZ, %o0 7488794Sjake 7592049Stmm wr %l6, 0, %y 7692049Stmm 7788794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G1], %g1 7888794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G2], %g2 7988794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G3], %g3 8088794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G4], %g4 8188794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G5], %g5 8288794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G6], %g6 8388794Sjake ldx [%sp + SPOFF + CCFSZ + UF_G7], %g7 8488794Sjake 8588794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O0], %i0 8688794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O1], %i1 8788794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O2], %i2 8888794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O3], %i3 8988794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O4], %i4 9088794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O5], %i5 9188794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O6], %i6 9288794Sjake ldx [%sp + SPOFF + CCFSZ + UF_O7], %i7 9388794Sjake 9491159Sjake ldx [%sp + SPOFF + CCFSZ + UF_STATE], %l5 9591159Sjake ! Restore %asi and %ccr from the passed tstate 9691159Sjake srlx %l5, TSTATE_CCR_SHIFT, %l4 9791159Sjake and %l4, CCR_MASK, %l4 9891159Sjake wr %l4, 0, %ccr 9991159Sjake srlx %l5, TSTATE_ASI_SHIFT, %l4 10091159Sjake and %l4, ASI_MASK, %l4 10191159Sjake wr %l4, 0, %asi 10288794Sjake ldx [%sp + SPOFF + CCFSZ + UF_PC], %l6 10388794Sjake ldx [%sp + SPOFF + CCFSZ + UF_NPC], %l7 10488794Sjake 10588794Sjake jmpl %l6, %g0 10688794Sjake return %l7 10788794SjakeEND(__sparc_utrap_gen) 108