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_arm.S
48534 views
1
// SPDX-License-Identifier: BSD-2-Clause
2
/*-
3
* Copyright 2004-2014 Olivier Houchard <[email protected]>
4
* Copyright 2012-2014 Ian Lepore <[email protected]>
5
* Copyright 2013-2014 Andrew Turner <[email protected]>
6
* Copyright 2014 Svatopluk Kraus <[email protected]>
7
* Copyright 2014 Michal Meloun <[email protected]>
8
* All rights reserved.
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
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
* SUCH DAMAGE.
30
*/
31
32
33
#if defined(__arm__) && !defined(__aarch64__)
34
35
#if defined(__thumb2__)
36
#define _FUNC_MODE .code 16; .thumb_func
37
#else
38
#define _FUNC_MODE .code 32
39
#endif
40
41
#define ENTRY(x) \
42
.text; \
43
.syntax unified; \
44
.balign 2; \
45
.global x; \
46
.type x,#function; \
47
_FUNC_MODE; \
48
x:
49
50
#define END(x) \
51
.size x, . - x;
52
53
#define RET bx lr
54
55
56
/*
57
* setjump + longjmp
58
*/
59
ENTRY(setjmp)
60
#if defined(__thumb2__)
61
mov ip, sp
62
stmia r0, {r4-r12,r14}
63
#else
64
stmia r0, {r4-r14}
65
#endif
66
mov r0, #0x00000000
67
RET
68
END(setjmp)
69
70
ENTRY(longjmp)
71
#if defined(__thumb2__)
72
ldmia r0, {r4-r12,r14}
73
mov sp, ip
74
#else
75
ldmia r0, {r4-r14}
76
#endif
77
mov r0, #0x00000001
78
RET
79
END(longjmp)
80
81
#ifdef __ELF__
82
.section .note.GNU-stack,"",%progbits
83
#endif
84
85
#endif
86
87