1/* $FreeBSD$ */
2
3#include "linux32_assym.h"			/* system definitions */
4#include <machine/asmacros.h>			/* miscellaneous asm macros */
5
6#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */
7
8.data
9
10	.globl linux_platform
11linux_platform:
12	.asciz "i686"
13
14.text
15.code32
16
17ENTRY(linux32_vdso_sigcode)
18	.cfi_startproc
19	.cfi_signal_frame
20	.cfi_def_cfa	%esp, LINUX_SIGF_SC
21	.cfi_offset	%gs, L_SC_GS
22	.cfi_offset	%fs, L_SC_FS
23	.cfi_offset	%es, L_SC_ES
24	.cfi_offset	%ds, L_SC_DS
25	.cfi_offset	%cs, L_SC_CS
26	.cfi_offset	%ss, L_SC_SS
27#ifdef __clang__
28	.cfi_offset	%flags, L_SC_EFLAGS
29#else
30	.cfi_offset	%eflags, L_SC_EFLAGS
31#endif
32	.cfi_offset	%edi, L_SC_EDI
33	.cfi_offset	%esi, L_SC_ESI
34	.cfi_offset	%ebp, L_SC_EBP
35	.cfi_offset	%ebx, L_SC_EBX
36	.cfi_offset	%edx, L_SC_EDX
37	.cfi_offset	%ecx, L_SC_ECX
38	.cfi_offset	%eax, L_SC_EAX
39	.cfi_offset	%eip, L_SC_EIP
40	.cfi_offset	%esp, L_SC_ESP
41
42	movl	%esp, %ebx			/* sigframe for sigreturn */
43	call	*%edi				/* call signal handler */
44	popl	%eax				/* gcc unwind code need this */
45	.cfi_def_cfa	%esp, LINUX_SIGF_SC-4
46	movl	$LINUX32_SYS_linux_sigreturn, %eax
47	int	$0x80
480:	jmp	0b
49	.cfi_endproc
50END(linux32_vdso_sigcode)
51
52
53ENTRY(linux32_vdso_rt_sigcode)
54	.cfi_startproc
55	.cfi_signal_frame
56	.cfi_def_cfa	%esp, LINUX_RT_SIGF_UC + LINUX_RT_SIGF_SC
57	.cfi_offset	%gs, L_SC_GS
58	.cfi_offset	%fs, L_SC_FS
59	.cfi_offset	%es, L_SC_ES
60	.cfi_offset	%ds, L_SC_DS
61	.cfi_offset	%cs, L_SC_CS
62	.cfi_offset	%ss, L_SC_SS
63#ifdef __clang__
64	.cfi_offset	%flags, L_SC_EFLAGS
65#else
66	.cfi_offset	%eflags, L_SC_EFLAGS
67#endif
68	.cfi_offset	%edi, L_SC_EDI
69	.cfi_offset	%esi, L_SC_ESI
70	.cfi_offset	%ebp, L_SC_EBP
71	.cfi_offset	%ebx, L_SC_EBX
72	.cfi_offset	%edx, L_SC_EDX
73	.cfi_offset	%ecx, L_SC_ECX
74	.cfi_offset	%eax, L_SC_EAX
75	.cfi_offset	%eip, L_SC_EIP
76	.cfi_offset	%esp, L_SC_ESP
77
78	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
79	call	*%edi				/* call signal handler */
80	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
81	int	$0x80
820:	jmp	0b
83	.cfi_endproc
84END(linux32_vdso_rt_sigcode)
85
86ENTRY(__kernel_sigreturn)
87	.cfi_startproc
88	.cfi_signal_frame
89	movl	%esp, %ebx			/* sigframe for sigreturn */
90	call	*%edi				/* call signal handler */
91	popl	%eax				/* gcc unwind code need this */
92	movl	$LINUX32_SYS_linux_sigreturn, %eax
93	int	$0x80
940:	jmp	0b
95	.cfi_endproc
96END(__kernel_sigreturn)
97
98ENTRY(__kernel_rt_sigreturn)
99	.cfi_startproc
100	.cfi_signal_frame
101	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
102	call	*%edi				/* call signal handler */
103	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
104	int	$0x80
1050:	jmp	0b
106	.cfi_endproc
107END(__kernel_rt_sigreturn)
108
109ENTRY(__kernel_vsyscall)
110	.cfi_startproc
111	int $0x80
112	ret
113	.cfi_endproc
114END(__kernel_vsyscall)
115
116#if 0
117	.section .note.Linux, "a",@note
118	.long 2f - 1f		/* namesz */
119	.balign 4
120	.long 4f - 3f		/* descsz */
121	.long 0
1221:
123	.asciz "Linux"
1242:
125	.balign 4
1263:
127	.long LINUX_VERSION_CODE
1284:
129	.balign 4
130	.previous
131#endif
132