1/*- 2 * Copyright (c) 2001 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <machine/asm.h> 28__FBSDID("$FreeBSD: releng/10.3/lib/libc/sparc64/sys/__sparc_utrap_gen.S 221869 2011-05-14 01:53:38Z attilio $"); 29 30 .register %g2, #ignore 31 .register %g3, #ignore 32 .register %g6, #ignore 33 .register %g7, #ignore 34 35#include <machine/tstate.h> 36#include <machine/utrap.h> 37 38#include "assym.s" 39 40ENTRY(__sparc_utrap_gen) 41 sub %sp, UF_SIZEOF, %sp 42 43 stx %o0, [%sp + SPOFF + CCFSZ + UF_TYPE] 44 stx %o3, [%sp + SPOFF + CCFSZ + UF_TAR] 45 stx %o4, [%sp + SPOFF + CCFSZ + UF_SFAR] 46 stx %o5, [%sp + SPOFF + CCFSZ + UF_SFSR] 47 48 stx %l4, [%sp + SPOFF + CCFSZ + UF_FSR] 49 stx %l5, [%sp + SPOFF + CCFSZ + UF_STATE] 50 stx %l6, [%sp + SPOFF + CCFSZ + UF_PC] 51 stx %l7, [%sp + SPOFF + CCFSZ + UF_NPC] 52 53 stx %g1, [%sp + SPOFF + CCFSZ + UF_G1] 54 stx %g2, [%sp + SPOFF + CCFSZ + UF_G2] 55 stx %g3, [%sp + SPOFF + CCFSZ + UF_G3] 56 stx %g4, [%sp + SPOFF + CCFSZ + UF_G4] 57 stx %g5, [%sp + SPOFF + CCFSZ + UF_G5] 58 stx %g6, [%sp + SPOFF + CCFSZ + UF_G6] 59 stx %g7, [%sp + SPOFF + CCFSZ + UF_G7] 60 61 stx %i0, [%sp + SPOFF + CCFSZ + UF_O0] 62 stx %i1, [%sp + SPOFF + CCFSZ + UF_O1] 63 stx %i2, [%sp + SPOFF + CCFSZ + UF_O2] 64 stx %i3, [%sp + SPOFF + CCFSZ + UF_O3] 65 stx %i4, [%sp + SPOFF + CCFSZ + UF_O4] 66 stx %i5, [%sp + SPOFF + CCFSZ + UF_O5] 67 stx %i6, [%sp + SPOFF + CCFSZ + UF_O6] 68 stx %i7, [%sp + SPOFF + CCFSZ + UF_O7] 69 70 rd %y, %l6 71 72 call __sparc_utrap 73 add %sp, SPOFF + CCFSZ, %o0 74 75 wr %l6, 0, %y 76 77 ldx [%sp + SPOFF + CCFSZ + UF_G1], %g1 78 ldx [%sp + SPOFF + CCFSZ + UF_G2], %g2 79 ldx [%sp + SPOFF + CCFSZ + UF_G3], %g3 80 ldx [%sp + SPOFF + CCFSZ + UF_G4], %g4 81 ldx [%sp + SPOFF + CCFSZ + UF_G5], %g5 82 ldx [%sp + SPOFF + CCFSZ + UF_G6], %g6 83 ldx [%sp + SPOFF + CCFSZ + UF_G7], %g7 84 85 ldx [%sp + SPOFF + CCFSZ + UF_O0], %i0 86 ldx [%sp + SPOFF + CCFSZ + UF_O1], %i1 87 ldx [%sp + SPOFF + CCFSZ + UF_O2], %i2 88 ldx [%sp + SPOFF + CCFSZ + UF_O3], %i3 89 ldx [%sp + SPOFF + CCFSZ + UF_O4], %i4 90 ldx [%sp + SPOFF + CCFSZ + UF_O5], %i5 91 ldx [%sp + SPOFF + CCFSZ + UF_O6], %i6 92 ldx [%sp + SPOFF + CCFSZ + UF_O7], %i7 93 94 ldx [%sp + SPOFF + CCFSZ + UF_STATE], %l5 95 ! Restore %asi and %ccr from the passed tstate 96 srlx %l5, TSTATE_CCR_SHIFT, %l4 97 and %l4, CCR_MASK, %l4 98 wr %l4, 0, %ccr 99 srlx %l5, TSTATE_ASI_SHIFT, %l4 100 and %l4, ASI_MASK, %l4 101 wr %l4, 0, %asi 102 ldx [%sp + SPOFF + CCFSZ + UF_PC], %l6 103 ldx [%sp + SPOFF + CCFSZ + UF_NPC], %l7 104 105 jmpl %l6, %g0 106 return %l7 107END(__sparc_utrap_gen) 108