xref: /freebsd/sys/amd64/linux32/linux32_locore.asm (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2#include "linux32_assym.h"			/* system definitions */
3#include <machine/asmacros.h>			/* miscellaneous asm macros */
4
5#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */
6
7.data
8
9	.globl linux_platform
10linux_platform:
11	.asciz "i686"
12
13.text
14.code32
15
16ENTRY(linux32_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	$LINUX32_SYS_linux_sigreturn, %eax
46	int	$0x80
470:	jmp	0b
48	.cfi_endproc
49END(linux32_vdso_sigcode)
50
51
52ENTRY(linux32_vdso_rt_sigcode)
53	.cfi_startproc
54	.cfi_signal_frame
55	.cfi_def_cfa	%esp, LINUX_RT_SIGF_UC + LINUX_RT_SIGF_SC
56	.cfi_offset	%gs, L_SC_GS
57	.cfi_offset	%fs, L_SC_FS
58	.cfi_offset	%es, L_SC_ES
59	.cfi_offset	%ds, L_SC_DS
60	.cfi_offset	%cs, L_SC_CS
61	.cfi_offset	%ss, L_SC_SS
62#ifdef __clang__
63	.cfi_offset	%flags, L_SC_EFLAGS
64#else
65	.cfi_offset	%eflags, L_SC_EFLAGS
66#endif
67	.cfi_offset	%edi, L_SC_EDI
68	.cfi_offset	%esi, L_SC_ESI
69	.cfi_offset	%ebp, L_SC_EBP
70	.cfi_offset	%ebx, L_SC_EBX
71	.cfi_offset	%edx, L_SC_EDX
72	.cfi_offset	%ecx, L_SC_ECX
73	.cfi_offset	%eax, L_SC_EAX
74	.cfi_offset	%eip, L_SC_EIP
75	.cfi_offset	%esp, L_SC_ESP
76
77	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
78	call	*%edi				/* call signal handler */
79	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
80	int	$0x80
810:	jmp	0b
82	.cfi_endproc
83END(linux32_vdso_rt_sigcode)
84
85ENTRY(__kernel_sigreturn)
86	.cfi_startproc
87	.cfi_signal_frame
88	movl	%esp, %ebx			/* sigframe for sigreturn */
89	call	*%edi				/* call signal handler */
90	popl	%eax				/* gcc unwind code need this */
91	movl	$LINUX32_SYS_linux_sigreturn, %eax
92	int	$0x80
930:	jmp	0b
94	.cfi_endproc
95END(__kernel_sigreturn)
96
97ENTRY(__kernel_rt_sigreturn)
98	.cfi_startproc
99	.cfi_signal_frame
100	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
101	call	*%edi				/* call signal handler */
102	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
103	int	$0x80
1040:	jmp	0b
105	.cfi_endproc
106END(__kernel_rt_sigreturn)
107
108ENTRY(__kernel_vsyscall)
109	.cfi_startproc
110	int $0x80
111	ret
112	.cfi_endproc
113END(__kernel_vsyscall)
114
115#if 0
116	.section .note.Linux, "a",@note
117	.long 2f - 1f		/* namesz */
118	.balign 4
119	.long 4f - 3f		/* descsz */
120	.long 0
1211:
122	.asciz "Linux"
1232:
124	.balign 4
1253:
126	.long LINUX_VERSION_CODE
1274:
128	.balign 4
129	.previous
130#endif
131