xref: /freebsd/sys/amd64/linux32/linux32_locore.asm (revision 84823cc70824c8d842f503d8c2e6d7b0c2d95b61)
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	.cfi_offset	%flags, L_SC_EFLAGS
28	.cfi_offset	%edi, L_SC_EDI
29	.cfi_offset	%esi, L_SC_ESI
30	.cfi_offset	%ebp, L_SC_EBP
31	.cfi_offset	%ebx, L_SC_EBX
32	.cfi_offset	%edx, L_SC_EDX
33	.cfi_offset	%ecx, L_SC_ECX
34	.cfi_offset	%eax, L_SC_EAX
35	.cfi_offset	%eip, L_SC_EIP
36	.cfi_offset	%esp, L_SC_ESP
37
38	movl	%esp, %ebx			/* sigframe for sigreturn */
39	call	*%edi				/* call signal handler */
40	popl	%eax				/* gcc unwind code need this */
41	.cfi_def_cfa	%esp, LINUX_SIGF_SC-4
42	movl	$LINUX32_SYS_linux_sigreturn, %eax
43	int	$0x80
440:	jmp	0b
45	.cfi_endproc
46END(linux32_vdso_sigcode)
47
48
49ENTRY(linux32_vdso_rt_sigcode)
50	.cfi_startproc
51	.cfi_signal_frame
52	.cfi_def_cfa	%esp, LINUX_RT_SIGF_UC + LINUX_RT_SIGF_SC
53	.cfi_offset	%gs, L_SC_GS
54	.cfi_offset	%fs, L_SC_FS
55	.cfi_offset	%es, L_SC_ES
56	.cfi_offset	%ds, L_SC_DS
57	.cfi_offset	%cs, L_SC_CS
58	.cfi_offset	%ss, L_SC_SS
59	.cfi_offset	%flags, L_SC_EFLAGS
60	.cfi_offset	%edi, L_SC_EDI
61	.cfi_offset	%esi, L_SC_ESI
62	.cfi_offset	%ebp, L_SC_EBP
63	.cfi_offset	%ebx, L_SC_EBX
64	.cfi_offset	%edx, L_SC_EDX
65	.cfi_offset	%ecx, L_SC_ECX
66	.cfi_offset	%eax, L_SC_EAX
67	.cfi_offset	%eip, L_SC_EIP
68	.cfi_offset	%esp, L_SC_ESP
69
70	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
71	call	*%edi				/* call signal handler */
72	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
73	int	$0x80
740:	jmp	0b
75	.cfi_endproc
76END(linux32_vdso_rt_sigcode)
77
78ENTRY(__kernel_sigreturn)
79	.cfi_startproc
80	.cfi_signal_frame
81	movl	%esp, %ebx			/* sigframe for sigreturn */
82	call	*%edi				/* call signal handler */
83	popl	%eax				/* gcc unwind code need this */
84	movl	$LINUX32_SYS_linux_sigreturn, %eax
85	int	$0x80
860:	jmp	0b
87	.cfi_endproc
88END(__kernel_sigreturn)
89
90ENTRY(__kernel_rt_sigreturn)
91	.cfi_startproc
92	.cfi_signal_frame
93	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
94	call	*%edi				/* call signal handler */
95	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
96	int	$0x80
970:	jmp	0b
98	.cfi_endproc
99END(__kernel_rt_sigreturn)
100
101ENTRY(__kernel_vsyscall)
102	.cfi_startproc
103	int $0x80
104	ret
105	.cfi_endproc
106END(__kernel_vsyscall)
107
108#if 0
109	.section .note.Linux, "a",@note
110	.long 2f - 1f		/* namesz */
111	.balign 4
112	.long 4f - 3f		/* descsz */
113	.long 0
1141:
115	.asciz "Linux"
1162:
117	.balign 4
1183:
119	.long LINUX_VERSION_CODE
1204:
121	.balign 4
122	.previous
123#endif
124