Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/amd64/linux/linux_locore.asm
39507 views
1
/*-
2
* SPDX-License-Identifier: BSD-2-Clause
3
*
4
* Copyright (c) 2015-2022 Dmitry Chagin <[email protected]>
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
* SUCH DAMAGE.
26
*/
27
28
#include "linux_assym.h" /* system definitions */
29
#include <machine/asmacros.h> /* miscellaneous asm macros */
30
31
#include <amd64/linux/linux_syscall.h> /* system call numbers */
32
33
.data
34
35
.globl linux_platform
36
linux_platform:
37
.asciz "x86_64"
38
39
.text
40
41
ENTRY(linux_rt_sigcode)
42
.cfi_startproc
43
.cfi_signal_frame
44
.cfi_def_cfa %rsp, LINUX_RT_SIGF_SC
45
.cfi_offset %r8, L_SC_R8
46
.cfi_offset %r9, L_SC_R9
47
.cfi_offset %r10, L_SC_R10
48
.cfi_offset %r11, L_SC_R11
49
.cfi_offset %r12, L_SC_R12
50
.cfi_offset %r13, L_SC_R13
51
.cfi_offset %r14, L_SC_R14
52
.cfi_offset %r15, L_SC_R15
53
.cfi_offset %rdi, L_SC_RDI
54
.cfi_offset %rsi, L_SC_RSI
55
.cfi_offset %rbp, L_SC_RBP
56
.cfi_offset %rbx, L_SC_RBX
57
.cfi_offset %rdx, L_SC_RDX
58
.cfi_offset %rax, L_SC_RAX
59
.cfi_offset %rcx, L_SC_RCX
60
.cfi_offset %rip, L_SC_RIP
61
.cfi_offset %rsp, L_SC_RSP
62
63
movq %rsp, %rbx /* rt_sigframe for rt_sigreturn */
64
call *%rcx /* call signal handler */
65
movq $LINUX_SYS_linux_rt_sigreturn, %rax
66
syscall
67
0: hlt
68
jmp 0b
69
.cfi_endproc
70
END(linux_rt_sigcode)
71
72
#if 0
73
.section .note.Linux, "a",@note
74
.long 2f - 1f /* namesz */
75
.balign 4
76
.long 4f - 3f /* descsz */
77
.long 0
78
1:
79
.asciz "Linux"
80
2:
81
.balign 4
82
3:
83
.long LINUX_VERSION_CODE
84
4:
85
.balign 4
86
.previous
87
#endif
88
89