xref: /freebsd/sys/amd64/linux/linux_locore.asm (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2015-2022 Dmitry Chagin <dchagin@freeBSD.org>
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 * $FreeBSD$
28 */
29
30#include "linux_assym.h"			/* system definitions */
31#include <machine/asmacros.h>			/* miscellaneous asm macros */
32
33#include <amd64/linux/linux_syscall.h>		/* system call numbers */
34
35	.data
36
37	.globl linux_platform
38linux_platform:
39	.asciz "x86_64"
40
41	.text
42
43ENTRY(linux_rt_sigcode)
44	.cfi_startproc
45	.cfi_signal_frame
46	.cfi_def_cfa	%rsp, LINUX_RT_SIGF_SC
47	.cfi_offset	%r8, L_SC_R8
48	.cfi_offset	%r9, L_SC_R9
49	.cfi_offset	%r10, L_SC_R10
50	.cfi_offset	%r11, L_SC_R11
51	.cfi_offset	%r12, L_SC_R12
52	.cfi_offset	%r13, L_SC_R13
53	.cfi_offset	%r14, L_SC_R14
54	.cfi_offset	%r15, L_SC_R15
55	.cfi_offset	%rdi, L_SC_RDI
56	.cfi_offset	%rsi, L_SC_RSI
57	.cfi_offset	%rbp, L_SC_RBP
58	.cfi_offset	%rbx, L_SC_RBX
59	.cfi_offset	%rdx, L_SC_RDX
60	.cfi_offset	%rax, L_SC_RAX
61	.cfi_offset	%rcx, L_SC_RCX
62	.cfi_offset	%rip, L_SC_RIP
63	.cfi_offset	%rsp, L_SC_RSP
64
65	movq	%rsp, %rbx			/* rt_sigframe for rt_sigreturn */
66	call	*%rcx				/* call signal handler */
67	movq	$LINUX_SYS_linux_rt_sigreturn, %rax
68	syscall
690:	hlt
70	jmp	0b
71	.cfi_endproc
72END(linux_rt_sigcode)
73
74#if 0
75	.section .note.Linux, "a",@note
76	.long 2f - 1f		/* namesz */
77	.balign 4
78	.long 4f - 3f		/* descsz */
79	.long 0
801:
81	.asciz "Linux"
822:
83	.balign 4
843:
85	.long LINUX_VERSION_CODE
864:
87	.balign 4
88	.previous
89#endif
90