2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Modified for incorporation into newlib by Joel Sherrill
6 * (joel@OARcorp.com), On-Line Applications Research, 1995.
9 * + removed error check since it prevented using this setjmp
11 * + added the support for the "user label" and "register" prefix
13 * This software was developed by the Computer Systems Engineering group
14 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
15 * contributed to Berkeley.
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 * 3. All advertising materials mentioning features or use of this software
26 * must display the following acknowledgement:
27 * This product includes software developed by the University of
28 * California, Berkeley and its contributors.
29 * 4. Neither the name of the University nor the names of its contributors
30 * may be used to endorse or promote products derived from this software
31 * without specific prior written permission.
33 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * from: $Header: /cvs/cvsfiles/devo/newlib/libc/machine/sparc/setjmp.S,v 1.1 1997/06/25 07:19:16 marka Exp $
48 #if defined(LIBC_SCCS) && !defined(lint)
49 .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
50 #endif /* LIBC_SCCS and not lint */
53 * Recent versions of GNU cpp define variables which indicate the
54 * need for underscores and percents. If not using GNU cpp or
55 * the version does not support this, then you will obviously
56 * have to define these as appropriate.
59 #ifndef __USER_LABEL_PREFIX__
60 #define __USER_LABEL_PREFIX__ _
63 #ifndef __REGISTER_PREFIX__
64 #define __REGISTER_PREFIX__
67 /* ANSI concatenation macros. */
69 #define CONCAT1(a, b) CONCAT2(a, b)
70 #define CONCAT2(a, b) a ## b
72 /* Use the right prefix for global labels. */
74 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
76 /*********************************************************************
77 *********************************************************************
78 * Contents of DEFS.h *
79 *********************************************************************
80 *********************************************************************/
84 .align 4; .globl SYM(x); .proc 1; SYM(x):; .data; .align 4; 1: .long 0; \
85 .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
86 or %lo(1b),%o0,%o0; restore
89 .align 4; .globl SYM(x); .proc 1; SYM(x):
94 /*********************************************************************
95 *********************************************************************
97 *********************************************************************
98 *********************************************************************/
102 * C library -- _setjmp, _longjmp
105 * will generate a "return(v?v:1)" from
108 * by unwinding the call stack.
109 * The previous signal state is NOT restored.
113 /* #include "DEFS.h" */
117 st %sp, [%o0] /* caller's stack pointer */
118 st %i7, [%o0+4] /* caller's return pc */
119 st %fp, [%o0+8] /* store caller's frame pointer */
126 ta 0x03 /* flush registers */
127 addcc %o1, %g0, %g6 ! compute v ? v : 1 in a global register
131 ld [%o0], %sp /* caller's stack pointer */
142 ld [%o0+4], %i7 /* caller's return pc */
143 ld [%o0+8], %fp /* caller's frame pointer */
146 jmp %o7 + 8 ! success, return %g6