xref: /freebsd/sys/amd64/linux/linux_locore.asm (revision 53b70c86)
1/* $FreeBSD$ */
2
3#include "linux_assym.h"			/* system definitions */
4#include <machine/asmacros.h>			/* miscellaneous asm macros */
5
6#include <amd64/linux/linux_syscall.h>		/* system call numbers */
7
8	.data
9
10	.globl linux_platform
11linux_platform:
12	.asciz "x86_64"
13
14
15	.text
16/*
17 * To avoid excess stack frame the signal trampoline code emulates
18 * the 'call' instruction.
19 */
20ENTRY(linux_rt_sigcode)
21	movq	%rsp, %rbx			/* preserve sigframe */
22	call	.getip
23.getip:
24	popq	%rax
25	add	$.startrtsigcode-.getip, %rax	/* ret address */
26	pushq	%rax
27	jmp	*LINUX_RT_SIGF_HANDLER(%rbx)
28.startrtsigcode:
29	movq	$LINUX_SYS_linux_rt_sigreturn,%rax   /* linux_rt_sigreturn() */
30	syscall					/* enter kernel with args */
31	hlt
32.endrtsigcode:
330:	jmp	0b
34
35
36#if 0
37	.section .note.Linux, "a",@note
38	.long 2f - 1f		/* namesz */
39	.balign 4
40	.long 4f - 3f		/* descsz */
41	.long 0
421:
43	.asciz "Linux"
442:
45	.balign 4
463:
47	.long LINUX_VERSION_CODE
484:
49	.balign 4
50	.previous
51#endif
52
53	.section .eh_frame,"a",@progbits
54.LSTARTFRAMEDLSI0:
55	.long .LENDCIEDLSI0-.LSTARTCIEDLSI0
56.LSTARTCIEDLSI0:
57	.long 0					/* CIE ID */
58	.byte 1					/* Version number */
59	.string "zR"				/* NULL-terminated
60						 * augmentation string
61						 */
62	.uleb128 1				/* Code alignment factor */
63	.sleb128 -4				/* Data alignment factor */
64	.byte 8					/* Return address register column */
65	.uleb128 1				/* Augmentation value length */
66	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
67	.byte 0x0c				/* DW_CFA_def_cfa */
68	.uleb128 4
69	.uleb128 4
70	.byte 0x88				/* DW_CFA_offset, column 0x8 */
71	.uleb128 1
72	.align 4
73.LENDCIEDLSI0:
74	.long .LENDFDEDLSI0-.LSTARTFDEDLSI0	/* Length FDE */
75.LSTARTFDEDLSI0:
76	.long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0	/* CIE pointer */
77	.long .startrtsigcode-.			/* PC-relative start address */
78	.long .endrtsigcode-.startrtsigcode
79	.uleb128 0
80	.align 4
81.LENDFDEDLSI0:
82	.previous
83