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 */
20NON_GPROF_ENTRY(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
35NON_GPROF_ENTRY(__vdso_clock_gettime)
36	movq	$LINUX_SYS_linux_clock_gettime,%rax
37	syscall
38	ret
39.weak clock_gettime
40.set clock_gettime, __vdso_clock_gettime
41
42NON_GPROF_ENTRY(__vdso_time)
43	movq	$LINUX_SYS_linux_time,%rax
44	syscall
45	ret
46.weak time
47.set time, __vdso_time
48
49NON_GPROF_ENTRY(__vdso_gettimeofday)
50	movq	$LINUX_SYS_gettimeofday,%rax
51	syscall
52	ret
53.weak gettimeofday
54.set gettimeofday, __vdso_gettimeofday
55
56NON_GPROF_ENTRY(__vdso_getcpu)
57	movq	$-38,%rax	/* not implemented */
58	ret
59.weak getcpu
60.set getcpu, __vdso_getcpu
61
62#if 0
63	.section .note.Linux, "a",@note
64	.long 2f - 1f		/* namesz */
65	.balign 4
66	.long 4f - 3f		/* descsz */
67	.long 0
681:
69	.asciz "Linux"
702:
71	.balign 4
723:
73	.long LINUX_VERSION_CODE
744:
75	.balign 4
76	.previous
77#endif
78
79	.section .eh_frame,"a",@progbits
80.LSTARTFRAMEDLSI0:
81	.long .LENDCIEDLSI0-.LSTARTCIEDLSI0
82.LSTARTCIEDLSI0:
83	.long 0					/* CIE ID */
84	.byte 1					/* Version number */
85	.string "zR"				/* NULL-terminated
86						 * augmentation string
87						 */
88	.uleb128 1				/* Code alignment factor */
89	.sleb128 -4				/* Data alignment factor */
90	.byte 8					/* Return address register column */
91	.uleb128 1				/* Augmentation value length */
92	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
93	.byte 0x0c				/* DW_CFA_def_cfa */
94	.uleb128 4
95	.uleb128 4
96	.byte 0x88				/* DW_CFA_offset, column 0x8 */
97	.uleb128 1
98	.align 4
99.LENDCIEDLSI0:
100	.long .LENDFDEDLSI0-.LSTARTFDEDLSI0	/* Length FDE */
101.LSTARTFDEDLSI0:
102	.long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0	/* CIE pointer */
103	.long .startrtsigcode-.			/* PC-relative start address */
104	.long .endrtsigcode-.startrtsigcode
105	.uleb128 0
106	.align 4
107.LENDFDEDLSI0:
108	.previous
109