xref: /freebsd/sys/amd64/linux/linux_locore.asm (revision 9768746b)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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	49, L_SC_RFLAGS
64	.cfi_offset	%cs, L_SC_CS
65	.cfi_offset	%rsp, L_SC_RSP
66
67	movq	%rsp, %rbx			/* rt_sigframe for rt_sigreturn */
68	call	*%rcx				/* call signal handler */
69	movq	$LINUX_SYS_linux_rt_sigreturn, %rax
70	syscall
710:	hlt
72	jmp	0b
73	.cfi_endproc
74END(linux_rt_sigcode)
75
76#if 0
77	.section .note.Linux, "a",@note
78	.long 2f - 1f		/* namesz */
79	.balign 4
80	.long 4f - 3f		/* descsz */
81	.long 0
821:
83	.asciz "Linux"
842:
85	.balign 4
863:
87	.long LINUX_VERSION_CODE
884:
89	.balign 4
90	.previous
91#endif
92