OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [machine/] [sparc/] [setjmp.S] - Blame information for rev 345

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
 * Copyright (c) 1992, 1993
3
 *      The Regents of the University of California.  All rights reserved.
4
 *
5
 *  Modified for incorporation into newlib by Joel Sherrill
6
 *  (joel@OARcorp.com), On-Line Applications Research, 1995.
7
 *  Did the following:
8
 *     + merged in DEFS.h
9
 *     + removed error check since it prevented using this setjmp
10
 *       to "context switch"
11
 *     + added the support for the "user label" and "register" prefix
12
 *
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.
16
 *
17
 * Redistribution and use in source and binary forms, with or without
18
 * modification, are permitted provided that the following conditions
19
 * are met:
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.
32
 *
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
43
 * SUCH DAMAGE.
44
 *
45
 * from: $Header: /cvs/cvsfiles/devo/newlib/libc/machine/sparc/setjmp.S,v 1.1 1997/06/25 07:19:16 marka Exp $
46
 */
47
 
48
#if defined(LIBC_SCCS) && !defined(lint)
49
        .asciz "@(#)_setjmp.s   8.1 (Berkeley) 6/4/93"
50
#endif /* LIBC_SCCS and not lint */
51
 
52
/*
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.
57
 */
58
 
59
#ifndef __USER_LABEL_PREFIX__
60
#define __USER_LABEL_PREFIX__ _
61
#endif
62
 
63
#ifndef __REGISTER_PREFIX__
64
#define __REGISTER_PREFIX__
65
#endif
66
 
67
/* ANSI concatenation macros.  */
68
 
69
#define CONCAT1(a, b) CONCAT2(a, b)
70
#define CONCAT2(a, b) a ## b
71
 
72
/* Use the right prefix for global labels.  */
73
 
74
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
75
 
76
/*********************************************************************
77
 *********************************************************************
78
 *                       Contents of DEFS.h                          *
79
 *********************************************************************
80
 *********************************************************************/
81
 
82
#ifdef PROF
83
#define ENTRY(x) \
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
87
#else
88
#define ENTRY(x) \
89
        .align 4; .globl SYM(x); .proc 1; SYM(x):
90
#endif
91
 
92
 
93
 
94
/*********************************************************************
95
 *********************************************************************
96
 *                           END of DEFS.h                           *
97
 *********************************************************************
98
 *********************************************************************/
99
 
100
 
101
/*
102
 * C library -- _setjmp, _longjmp
103
 *
104
 *      _longjmp(a,v)
105
 * will generate a "return(v?v:1)" from
106
 * the last call to
107
 *      _setjmp(a)
108
 * by unwinding the call stack.
109
 * The previous signal state is NOT restored.
110
 */
111
 
112
 
113
/* #include "DEFS.h" */
114
 
115
ENTRY(setjmp)
116
ENTRY(_setjmp)
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 */
120
        st      %o7, [%o0+12]
121
        retl
122
        clr    %o0              ! return 0
123
 
124
ENTRY(longjmp)
125
ENTRY(_longjmp)
126
        ta      0x03            /* flush registers */
127
        addcc   %o1, %g0, %g6   ! compute v ? v : 1 in a global register
128
        be,a    0f
129
        mov     1, %g6
130
0:
131
        ld      [%o0], %sp      /* caller's stack pointer */
132
 
133
        ldd     [%sp], %l0
134
        ldd     [%sp+8], %l2
135
        ldd     [%sp+16], %l4
136
        ldd     [%sp+24], %l6
137
 
138
        ldd     [%sp+32], %i0
139
        ldd     [%sp+40], %i2
140
        ldd     [%sp+48], %i4
141
 
142
        ld      [%o0+4], %i7    /* caller's return pc */
143
        ld      [%o0+8], %fp    /* caller's frame pointer */
144
        ld      [%o0+12], %o7
145
 
146
        jmp     %o7 + 8         ! success, return %g6
147
        mov     %g6, %o0
148
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.