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_x86_64.S
48535 views
1
// SPDX-License-Identifier: CDDL-1.0
2
/*
3
* CDDL HEADER START
4
*
5
* The contents of this file are subject to the terms of the
6
* Common Development and Distribution License (the "License").
7
* You may not use this file except in compliance with the License.
8
*
9
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
* or https://opensource.org/licenses/CDDL-1.0.
11
* See the License for the specific language governing permissions
12
* and limitations under the License.
13
*
14
* When distributing Covered Code, include this CDDL HEADER in each
15
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16
* If applicable, add the following below this CDDL HEADER, with the
17
* fields enclosed by brackets "[]" replaced with your own identifying
18
* information: Portions Copyright [yyyy] [name of copyright owner]
19
*
20
* CDDL HEADER END
21
*/
22
23
/*
24
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
25
*/
26
27
#if defined(_KERNEL) && defined(__linux__)
28
#include <linux/linkage.h>
29
#endif
30
31
/*
32
* Setjmp and longjmp implement non-local gotos using state vectors
33
* type label_t.
34
*/
35
#ifdef __x86_64__
36
37
#define _ASM
38
#include <sys/asm_linkage.h>
39
40
ENTRY_ALIGN(setjmp, 8)
41
movq %rsp, 0(%rdi)
42
movq %rbp, 8(%rdi)
43
movq %rbx, 16(%rdi)
44
movq %r12, 24(%rdi)
45
movq %r13, 32(%rdi)
46
movq %r14, 40(%rdi)
47
movq %r15, 48(%rdi)
48
movq 0(%rsp), %rdx /* return address */
49
movq %rdx, 56(%rdi) /* rip */
50
xorl %eax, %eax /* return 0 */
51
RET
52
SET_SIZE(setjmp)
53
54
ENTRY_ALIGN(longjmp, 8)
55
movq 0(%rdi), %rsp
56
movq 8(%rdi), %rbp
57
movq 16(%rdi), %rbx
58
movq 24(%rdi), %r12
59
movq 32(%rdi), %r13
60
movq 40(%rdi), %r14
61
movq 48(%rdi), %r15
62
movq 56(%rdi), %rdx /* return address */
63
movq %rdx, 0(%rsp)
64
xorl %eax, %eax
65
incl %eax /* return 1 */
66
RET
67
SET_SIZE(longjmp)
68
69
#ifdef __ELF__
70
.section .note.GNU-stack,"",%progbits
71
#endif
72
73
#endif /* __x86_64__ */
74
75