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