Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/openzfs/module/lua/setjmp/setjmp_sparc64.S
48534 views
1
// SPDX-License-Identifier: BSD-3-Clause
2
/*
3
* Copyright (c) 1992, 1993
4
* The Regents of the University of California. All rights reserved.
5
*
6
* This software was developed by the Computer Systems Engineering group
7
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
8
* contributed to Berkeley.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
* 1. Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in the
17
* documentation and/or other materials provided with the distribution.
18
* 4. Neither the name of the University nor the names of its contributors
19
* may be used to endorse or promote products derived from this software
20
* without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32
* SUCH DAMAGE.
33
*
34
* $Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp
35
*/
36
37
#if defined(LIBC_SCCS) && !defined(lint)
38
#if 0
39
.asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
40
#else
41
RCSID("$NetBSD: _setjmp.S,v 1.4 1998/10/08 02:27:59 eeh Exp $")
42
#endif
43
#endif /* LIBC_SCCS and not lint */
44
45
#define _JB_FP 0x0
46
#define _JB_PC 0x8
47
#define _JB_SP 0x10
48
49
.register %g2,#ignore
50
.register %g3,#ignore
51
52
#define ENTRY(x) \
53
.text ; \
54
.balign 32 ; \
55
.globl x ; \
56
.type x,@function ; \
57
x:
58
59
#define END(x) \
60
.size x, . - x
61
62
/*
63
* C library -- setjmp, longjmp
64
*
65
* longjmp(a,v)
66
* will generate a "return(v?v:1)" from
67
* the last call to
68
* setjmp(a)
69
* by restoring the previous context.
70
*/
71
72
ENTRY(setjmp)
73
stx %sp, [%o0 + _JB_SP]
74
stx %o7, [%o0 + _JB_PC]
75
stx %fp, [%o0 + _JB_FP]
76
retl
77
clr %o0
78
END(setjmp)
79
80
ENTRY(longjmp)
81
mov 1, %g1
82
movrnz %o1, %o1, %g1
83
mov %o0, %g2
84
ldx [%g2 + _JB_FP], %g3
85
1: cmp %fp, %g3
86
bl,a 1b
87
restore
88
be,a 2f
89
ldx [%g2 + _JB_SP], %o0
90
91
.Lbotch:
92
illtrap
93
94
2: cmp %o0, %sp
95
bge,a 3f
96
mov %o0, %sp
97
b,a .Lbotch
98
nop
99
3: ldx [%g2 + _JB_PC], %o7
100
retl
101
mov %g1, %o0
102
END(longjmp)
103
104
#ifdef __ELF__
105
.section .note.GNU-stack,"",%progbits
106
#endif
107
108