xref: /freebsd/sys/amd64/linux/linux_locore.asm (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
18f9635dcSDmitry Chagin/*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
38f9635dcSDmitry Chagin *
48f9635dcSDmitry Chagin * Copyright (c) 2015-2022 Dmitry Chagin <dchagin@freeBSD.org>
58f9635dcSDmitry Chagin *
68f9635dcSDmitry Chagin * Redistribution and use in source and binary forms, with or without
78f9635dcSDmitry Chagin * modification, are permitted provided that the following conditions
88f9635dcSDmitry Chagin * are met:
98f9635dcSDmitry Chagin * 1. Redistributions of source code must retain the above copyright
108f9635dcSDmitry Chagin *    notice, this list of conditions and the following disclaimer.
118f9635dcSDmitry Chagin * 2. Redistributions in binary form must reproduce the above copyright
128f9635dcSDmitry Chagin *    notice, this list of conditions and the following disclaimer in the
138f9635dcSDmitry Chagin *    documentation and/or other materials provided with the distribution.
148f9635dcSDmitry Chagin *
158f9635dcSDmitry Chagin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
168f9635dcSDmitry Chagin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
178f9635dcSDmitry Chagin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
188f9635dcSDmitry Chagin * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
198f9635dcSDmitry Chagin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
208f9635dcSDmitry Chagin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
218f9635dcSDmitry Chagin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
228f9635dcSDmitry Chagin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
238f9635dcSDmitry Chagin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
248f9635dcSDmitry Chagin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
258f9635dcSDmitry Chagin * SUCH DAMAGE.
268f9635dcSDmitry Chagin */
27305b9efeSEd Maste
28305b9efeSEd Maste#include "linux_assym.h"			/* system definitions */
29305b9efeSEd Maste#include <machine/asmacros.h>			/* miscellaneous asm macros */
30305b9efeSEd Maste
31305b9efeSEd Maste#include <amd64/linux/linux_syscall.h>		/* system call numbers */
32305b9efeSEd Maste
33305b9efeSEd Maste	.data
34305b9efeSEd Maste
35305b9efeSEd Maste	.globl linux_platform
36305b9efeSEd Mastelinux_platform:
37305b9efeSEd Maste	.asciz "x86_64"
38305b9efeSEd Maste
39305b9efeSEd Maste	.text
40ba279bcdSDmitry Chagin
41aa3ea612SKonstantin BelousovENTRY(linux_rt_sigcode)
428f9635dcSDmitry Chagin	.cfi_startproc
438f9635dcSDmitry Chagin	.cfi_signal_frame
448f9635dcSDmitry Chagin	.cfi_def_cfa	%rsp, LINUX_RT_SIGF_SC
458f9635dcSDmitry Chagin	.cfi_offset	%r8, L_SC_R8
468f9635dcSDmitry Chagin	.cfi_offset	%r9, L_SC_R9
478f9635dcSDmitry Chagin	.cfi_offset	%r10, L_SC_R10
488f9635dcSDmitry Chagin	.cfi_offset	%r11, L_SC_R11
498f9635dcSDmitry Chagin	.cfi_offset	%r12, L_SC_R12
508f9635dcSDmitry Chagin	.cfi_offset	%r13, L_SC_R13
518f9635dcSDmitry Chagin	.cfi_offset	%r14, L_SC_R14
528f9635dcSDmitry Chagin	.cfi_offset	%r15, L_SC_R15
538f9635dcSDmitry Chagin	.cfi_offset	%rdi, L_SC_RDI
548f9635dcSDmitry Chagin	.cfi_offset	%rsi, L_SC_RSI
558f9635dcSDmitry Chagin	.cfi_offset	%rbp, L_SC_RBP
568f9635dcSDmitry Chagin	.cfi_offset	%rbx, L_SC_RBX
578f9635dcSDmitry Chagin	.cfi_offset	%rdx, L_SC_RDX
588f9635dcSDmitry Chagin	.cfi_offset	%rax, L_SC_RAX
598f9635dcSDmitry Chagin	.cfi_offset	%rcx, L_SC_RCX
608f9635dcSDmitry Chagin	.cfi_offset	%rip, L_SC_RIP
618f9635dcSDmitry Chagin	.cfi_offset	%rsp, L_SC_RSP
628f9635dcSDmitry Chagin
63ba279bcdSDmitry Chagin	movq	%rsp, %rbx			/* rt_sigframe for rt_sigreturn */
64ba279bcdSDmitry Chagin	call	*%rcx				/* call signal handler */
65ba279bcdSDmitry Chagin	movq	$LINUX_SYS_linux_rt_sigreturn, %rax
66ba279bcdSDmitry Chagin	syscall
678f9635dcSDmitry Chagin0:	hlt
688f9635dcSDmitry Chagin	jmp	0b
698f9635dcSDmitry Chagin	.cfi_endproc
708f9635dcSDmitry ChaginEND(linux_rt_sigcode)
71305b9efeSEd Maste
72305b9efeSEd Maste#if 0
73305b9efeSEd Maste	.section .note.Linux, "a",@note
74305b9efeSEd Maste	.long 2f - 1f		/* namesz */
75305b9efeSEd Maste	.balign 4
76305b9efeSEd Maste	.long 4f - 3f		/* descsz */
77305b9efeSEd Maste	.long 0
78305b9efeSEd Maste1:
79305b9efeSEd Maste	.asciz "Linux"
80305b9efeSEd Maste2:
81305b9efeSEd Maste	.balign 4
82305b9efeSEd Maste3:
83305b9efeSEd Maste	.long LINUX_VERSION_CODE
84305b9efeSEd Maste4:
85305b9efeSEd Maste	.balign 4
86305b9efeSEd Maste	.previous
87305b9efeSEd Maste#endif
88