aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/linux32/linux32_locore.asm
blob: 4b77bd32600e782e99563349e711314c93e1351d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

#include "linux32_assym.h"			/* system definitions */
#include <machine/asmacros.h>			/* miscellaneous asm macros */

#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */

.data

	.globl linux_platform
linux_platform:
	.asciz "i686"

.text
.code32

ENTRY(linux32_vdso_sigcode)
	.cfi_startproc
	.cfi_signal_frame
	.cfi_def_cfa	%esp, LINUX_SIGF_SC
	.cfi_offset	%gs, L_SC_GS
	.cfi_offset	%fs, L_SC_FS
	.cfi_offset	%es, L_SC_ES
	.cfi_offset	%ds, L_SC_DS
	.cfi_offset	%cs, L_SC_CS
	.cfi_offset	%ss, L_SC_SS
#ifdef __clang__
	.cfi_offset	%flags, L_SC_EFLAGS
#else
	.cfi_offset	%eflags, L_SC_EFLAGS
#endif
	.cfi_offset	%edi, L_SC_EDI
	.cfi_offset	%esi, L_SC_ESI
	.cfi_offset	%ebp, L_SC_EBP
	.cfi_offset	%ebx, L_SC_EBX
	.cfi_offset	%edx, L_SC_EDX
	.cfi_offset	%ecx, L_SC_ECX
	.cfi_offset	%eax, L_SC_EAX
	.cfi_offset	%eip, L_SC_EIP
	.cfi_offset	%esp, L_SC_ESP

	movl	%esp, %ebx			/* sigframe for sigreturn */
	call	*%edi				/* call signal handler */
	popl	%eax				/* gcc unwind code need this */
	.cfi_def_cfa	%esp, LINUX_SIGF_SC-4
	movl	$LINUX32_SYS_linux_sigreturn, %eax
	int	$0x80
0:	jmp	0b
	.cfi_endproc
END(linux32_vdso_sigcode)


ENTRY(linux32_vdso_rt_sigcode)
	.cfi_startproc
	.cfi_signal_frame
	.cfi_def_cfa	%esp, LINUX_RT_SIGF_UC + LINUX_RT_SIGF_SC
	.cfi_offset	%gs, L_SC_GS
	.cfi_offset	%fs, L_SC_FS
	.cfi_offset	%es, L_SC_ES
	.cfi_offset	%ds, L_SC_DS
	.cfi_offset	%cs, L_SC_CS
	.cfi_offset	%ss, L_SC_SS
#ifdef __clang__
	.cfi_offset	%flags, L_SC_EFLAGS
#else
	.cfi_offset	%eflags, L_SC_EFLAGS
#endif
	.cfi_offset	%edi, L_SC_EDI
	.cfi_offset	%esi, L_SC_ESI
	.cfi_offset	%ebp, L_SC_EBP
	.cfi_offset	%ebx, L_SC_EBX
	.cfi_offset	%edx, L_SC_EDX
	.cfi_offset	%ecx, L_SC_ECX
	.cfi_offset	%eax, L_SC_EAX
	.cfi_offset	%eip, L_SC_EIP
	.cfi_offset	%esp, L_SC_ESP

	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
	call	*%edi				/* call signal handler */
	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
	int	$0x80
0:	jmp	0b
	.cfi_endproc
END(linux32_vdso_rt_sigcode)

ENTRY(__kernel_sigreturn)
	.cfi_startproc
	.cfi_signal_frame
	movl	%esp, %ebx			/* sigframe for sigreturn */
	call	*%edi				/* call signal handler */
	popl	%eax				/* gcc unwind code need this */
	movl	$LINUX32_SYS_linux_sigreturn, %eax
	int	$0x80
0:	jmp	0b
	.cfi_endproc
END(__kernel_sigreturn)

ENTRY(__kernel_rt_sigreturn)
	.cfi_startproc
	.cfi_signal_frame
	leal	LINUX_RT_SIGF_UC(%esp), %ebx	/* linux ucontext for rt_sigreturn */
	call	*%edi				/* call signal handler */
	movl	$LINUX32_SYS_linux_rt_sigreturn, %eax
	int	$0x80
0:	jmp	0b
	.cfi_endproc
END(__kernel_rt_sigreturn)

ENTRY(__kernel_vsyscall)
	.cfi_startproc
	int $0x80
	ret
	.cfi_endproc
END(__kernel_vsyscall)

#if 0
	.section .note.Linux, "a",@note
	.long 2f - 1f		/* namesz */
	.balign 4
	.long 4f - 3f		/* descsz */
	.long 0
1:
	.asciz "Linux"
2:
	.balign 4
3:
	.long LINUX_VERSION_CODE
4:
	.balign 4
	.previous
#endif