Blame view
arch/x86/kernel/entry_32.S
31.8 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
* * Copyright (C) 1991, 1992 Linus Torvalds */ /* * entry.S contains the system-call and fault low-level handling routines. * This also contains the timer-interrupt handler, as well as all interrupts * and faults that can result in a task-switch. * * NOTE: This code handles signal-recognition, which happens every time * after a timer-interrupt and after each system call. * * I changed all the .align's to 4 (16 byte alignment), as that's faster * on a 486. * |
889f21ce2 [PATCH] i386: fix... |
17 |
* Stack layout in 'syscall_exit': |
1da177e4c Linux-2.6.12-rc2 |
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
* ptrace needs to have all regs on the stack. * if the order here is changed, it needs to be * updated in fork.c:copy_process, signal.c:do_signal, * ptrace.c and ptrace.h * * 0(%esp) - %ebx * 4(%esp) - %ecx * 8(%esp) - %edx * C(%esp) - %esi * 10(%esp) - %edi * 14(%esp) - %ebp * 18(%esp) - %eax * 1C(%esp) - %ds * 20(%esp) - %es |
464d1a78f [PATCH] i386: Con... |
32 |
* 24(%esp) - %fs |
ccbeed3a0 x86: make lazy %g... |
33 34 35 36 37 38 39 |
* 28(%esp) - %gs saved iff !CONFIG_X86_32_LAZY_GS * 2C(%esp) - orig_eax * 30(%esp) - %eip * 34(%esp) - %cs * 38(%esp) - %eflags * 3C(%esp) - %oldesp * 40(%esp) - %oldss |
1da177e4c Linux-2.6.12-rc2 |
40 41 42 |
* * "current" is in register %ebx during any slow entries. */ |
1da177e4c Linux-2.6.12-rc2 |
43 44 |
#include <linux/linkage.h> #include <asm/thread_info.h> |
55f327fa9 [PATCH] lockdep: ... |
45 |
#include <asm/irqflags.h> |
1da177e4c Linux-2.6.12-rc2 |
46 47 48 |
#include <asm/errno.h> #include <asm/segment.h> #include <asm/smp.h> |
0341c14da x86: use _types.h... |
49 |
#include <asm/page_types.h> |
be44d2aab [PATCH] i386: esp... |
50 |
#include <asm/percpu.h> |
fe7cacc1c [PATCH] i386: rel... |
51 |
#include <asm/dwarf2.h> |
ab68ed98f x86: entry_32.S -... |
52 |
#include <asm/processor-flags.h> |
395a59d0f ftrace: store mco... |
53 |
#include <asm/ftrace.h> |
9b7dc567d x86: unify interr... |
54 |
#include <asm/irq_vectors.h> |
40d2e7631 x86-32: Rework ca... |
55 |
#include <asm/cpufeature.h> |
b4ca46e4e x86-32: Fix boot ... |
56 |
#include <asm/alternative-asm.h> |
1da177e4c Linux-2.6.12-rc2 |
57 |
|
af0575bba i386 syscall audi... |
58 59 60 61 62 63 64 65 66 |
/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ #include <linux/elf-em.h> #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) #define __AUDIT_ARCH_LE 0x40000000 #ifndef CONFIG_AUDITSYSCALL #define sysenter_audit syscall_trace_entry #define sysexit_audit syscall_exit_work #endif |
ea7145477 x86: Separate out... |
67 |
.section .entry.text, "ax" |
139ec7c41 [PATCH] paravirt:... |
68 69 70 71 72 |
/* * We use macros for low-level operations which need to be overridden * for paravirtualization. The following will never clobber any registers: * INTERRUPT_RETURN (aka. "iret") * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax") |
d75cd22fd x86/paravirt: spl... |
73 |
* ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit"). |
139ec7c41 [PATCH] paravirt:... |
74 75 76 77 78 79 |
* * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY). * Allowing a register to be clobbered can shrink the paravirt replacement * enough to patch inline, increasing performance. */ |
1da177e4c Linux-2.6.12-rc2 |
80 |
#define nr_syscalls ((syscall_table_size)/4) |
1da177e4c Linux-2.6.12-rc2 |
81 |
#ifdef CONFIG_PREEMPT |
139ec7c41 [PATCH] paravirt:... |
82 |
#define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
83 |
#else |
139ec7c41 [PATCH] paravirt:... |
84 |
#define preempt_stop(clobbers) |
2e04bc765 i386: fix return ... |
85 |
#define resume_kernel restore_all |
1da177e4c Linux-2.6.12-rc2 |
86 |
#endif |
55f327fa9 [PATCH] lockdep: ... |
87 88 |
.macro TRACE_IRQS_IRET #ifdef CONFIG_TRACE_IRQFLAGS |
ab68ed98f x86: entry_32.S -... |
89 |
testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off? |
55f327fa9 [PATCH] lockdep: ... |
90 91 92 93 94 |
jz 1f TRACE_IRQS_ON 1: #endif .endm |
4031ff388 [PATCH] fix broke... |
95 96 97 98 99 |
#ifdef CONFIG_VM86 #define resume_userspace_sig check_userspace #else #define resume_userspace_sig resume_userspace #endif |
ccbeed3a0 x86: make lazy %g... |
100 101 102 103 104 105 106 107 108 109 110 111 112 |
/* * User gs save/restore * * %gs is used for userland TLS and kernel only uses it for stack * canary which is required to be at %gs:20 by gcc. Read the comment * at the top of stackprotector.h for more info. * * Local labels 98 and 99 are used. */ #ifdef CONFIG_X86_32_LAZY_GS /* unfortunately push/pop can't be no-op */ .macro PUSH_GS |
df5d1874c x86: Use {push,po... |
113 |
pushl_cfi $0 |
ccbeed3a0 x86: make lazy %g... |
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
.endm .macro POP_GS pop=0 addl $(4 + \pop), %esp CFI_ADJUST_CFA_OFFSET -(4 + \pop) .endm .macro POP_GS_EX .endm /* all the rest are no-op */ .macro PTGS_TO_GS .endm .macro PTGS_TO_GS_EX .endm .macro GS_TO_REG reg .endm .macro REG_TO_PTGS reg .endm .macro SET_KERNEL_GS reg .endm #else /* CONFIG_X86_32_LAZY_GS */ .macro PUSH_GS |
df5d1874c x86: Use {push,po... |
137 |
pushl_cfi %gs |
ccbeed3a0 x86: make lazy %g... |
138 139 140 141 |
/*CFI_REL_OFFSET gs, 0*/ .endm .macro POP_GS pop=0 |
df5d1874c x86: Use {push,po... |
142 |
98: popl_cfi %gs |
ccbeed3a0 x86: make lazy %g... |
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
/*CFI_RESTORE gs*/ .if \pop <> 0 add $\pop, %esp CFI_ADJUST_CFA_OFFSET -\pop .endif .endm .macro POP_GS_EX .pushsection .fixup, "ax" 99: movl $0, (%esp) jmp 98b .section __ex_table, "a" .align 4 .long 98b, 99b .popsection .endm .macro PTGS_TO_GS 98: mov PT_GS(%esp), %gs .endm .macro PTGS_TO_GS_EX .pushsection .fixup, "ax" 99: movl $0, PT_GS(%esp) jmp 98b .section __ex_table, "a" .align 4 .long 98b, 99b .popsection .endm .macro GS_TO_REG reg movl %gs, \reg /*CFI_REGISTER gs, \reg*/ .endm .macro REG_TO_PTGS reg movl \reg, PT_GS(%esp) /*CFI_REL_OFFSET gs, PT_GS*/ .endm .macro SET_KERNEL_GS reg |
60a5317ff x86: implement x8... |
181 |
movl $(__KERNEL_STACK_CANARY), \reg |
ccbeed3a0 x86: make lazy %g... |
182 183 184 185 |
movl \reg, %gs .endm #endif /* CONFIG_X86_32_LAZY_GS */ |
f0d96110f x86: use asm .mac... |
186 187 |
.macro SAVE_ALL cld |
ccbeed3a0 x86: make lazy %g... |
188 |
PUSH_GS |
df5d1874c x86: Use {push,po... |
189 |
pushl_cfi %fs |
f0d96110f x86: use asm .mac... |
190 |
/*CFI_REL_OFFSET fs, 0;*/ |
df5d1874c x86: Use {push,po... |
191 |
pushl_cfi %es |
f0d96110f x86: use asm .mac... |
192 |
/*CFI_REL_OFFSET es, 0;*/ |
df5d1874c x86: Use {push,po... |
193 |
pushl_cfi %ds |
f0d96110f x86: use asm .mac... |
194 |
/*CFI_REL_OFFSET ds, 0;*/ |
df5d1874c x86: Use {push,po... |
195 |
pushl_cfi %eax |
f0d96110f x86: use asm .mac... |
196 |
CFI_REL_OFFSET eax, 0 |
df5d1874c x86: Use {push,po... |
197 |
pushl_cfi %ebp |
f0d96110f x86: use asm .mac... |
198 |
CFI_REL_OFFSET ebp, 0 |
df5d1874c x86: Use {push,po... |
199 |
pushl_cfi %edi |
f0d96110f x86: use asm .mac... |
200 |
CFI_REL_OFFSET edi, 0 |
df5d1874c x86: Use {push,po... |
201 |
pushl_cfi %esi |
f0d96110f x86: use asm .mac... |
202 |
CFI_REL_OFFSET esi, 0 |
df5d1874c x86: Use {push,po... |
203 |
pushl_cfi %edx |
f0d96110f x86: use asm .mac... |
204 |
CFI_REL_OFFSET edx, 0 |
df5d1874c x86: Use {push,po... |
205 |
pushl_cfi %ecx |
f0d96110f x86: use asm .mac... |
206 |
CFI_REL_OFFSET ecx, 0 |
df5d1874c x86: Use {push,po... |
207 |
pushl_cfi %ebx |
f0d96110f x86: use asm .mac... |
208 209 210 211 212 |
CFI_REL_OFFSET ebx, 0 movl $(__USER_DS), %edx movl %edx, %ds movl %edx, %es movl $(__KERNEL_PERCPU), %edx |
464d1a78f [PATCH] i386: Con... |
213 |
movl %edx, %fs |
ccbeed3a0 x86: make lazy %g... |
214 |
SET_KERNEL_GS %edx |
f0d96110f x86: use asm .mac... |
215 |
.endm |
1da177e4c Linux-2.6.12-rc2 |
216 |
|
f0d96110f x86: use asm .mac... |
217 |
.macro RESTORE_INT_REGS |
df5d1874c x86: Use {push,po... |
218 |
popl_cfi %ebx |
f0d96110f x86: use asm .mac... |
219 |
CFI_RESTORE ebx |
df5d1874c x86: Use {push,po... |
220 |
popl_cfi %ecx |
f0d96110f x86: use asm .mac... |
221 |
CFI_RESTORE ecx |
df5d1874c x86: Use {push,po... |
222 |
popl_cfi %edx |
f0d96110f x86: use asm .mac... |
223 |
CFI_RESTORE edx |
df5d1874c x86: Use {push,po... |
224 |
popl_cfi %esi |
f0d96110f x86: use asm .mac... |
225 |
CFI_RESTORE esi |
df5d1874c x86: Use {push,po... |
226 |
popl_cfi %edi |
f0d96110f x86: use asm .mac... |
227 |
CFI_RESTORE edi |
df5d1874c x86: Use {push,po... |
228 |
popl_cfi %ebp |
f0d96110f x86: use asm .mac... |
229 |
CFI_RESTORE ebp |
df5d1874c x86: Use {push,po... |
230 |
popl_cfi %eax |
fe7cacc1c [PATCH] i386: rel... |
231 |
CFI_RESTORE eax |
f0d96110f x86: use asm .mac... |
232 |
.endm |
1da177e4c Linux-2.6.12-rc2 |
233 |
|
ccbeed3a0 x86: make lazy %g... |
234 |
.macro RESTORE_REGS pop=0 |
f0d96110f x86: use asm .mac... |
235 |
RESTORE_INT_REGS |
df5d1874c x86: Use {push,po... |
236 |
1: popl_cfi %ds |
f0d96110f x86: use asm .mac... |
237 |
/*CFI_RESTORE ds;*/ |
df5d1874c x86: Use {push,po... |
238 |
2: popl_cfi %es |
f0d96110f x86: use asm .mac... |
239 |
/*CFI_RESTORE es;*/ |
df5d1874c x86: Use {push,po... |
240 |
3: popl_cfi %fs |
f0d96110f x86: use asm .mac... |
241 |
/*CFI_RESTORE fs;*/ |
ccbeed3a0 x86: make lazy %g... |
242 |
POP_GS \pop |
f0d96110f x86: use asm .mac... |
243 244 245 246 247 248 249 250 251 252 253 254 |
.pushsection .fixup, "ax" 4: movl $0, (%esp) jmp 1b 5: movl $0, (%esp) jmp 2b 6: movl $0, (%esp) jmp 3b .section __ex_table, "a" .align 4 .long 1b, 4b .long 2b, 5b .long 3b, 6b |
f95d47caa [PATCH] i386: Use... |
255 |
.popsection |
ccbeed3a0 x86: make lazy %g... |
256 |
POP_GS_EX |
f0d96110f x86: use asm .mac... |
257 |
.endm |
1da177e4c Linux-2.6.12-rc2 |
258 |
|
f0d96110f x86: use asm .mac... |
259 260 261 262 263 |
.macro RING0_INT_FRAME CFI_STARTPROC simple CFI_SIGNAL_FRAME CFI_DEF_CFA esp, 3*4 /*CFI_OFFSET cs, -2*4;*/ |
fe7cacc1c [PATCH] i386: rel... |
264 |
CFI_OFFSET eip, -3*4 |
f0d96110f x86: use asm .mac... |
265 |
.endm |
fe7cacc1c [PATCH] i386: rel... |
266 |
|
f0d96110f x86: use asm .mac... |
267 268 269 270 271 |
.macro RING0_EC_FRAME CFI_STARTPROC simple CFI_SIGNAL_FRAME CFI_DEF_CFA esp, 4*4 /*CFI_OFFSET cs, -2*4;*/ |
fe7cacc1c [PATCH] i386: rel... |
272 |
CFI_OFFSET eip, -3*4 |
f0d96110f x86: use asm .mac... |
273 |
.endm |
fe7cacc1c [PATCH] i386: rel... |
274 |
|
f0d96110f x86: use asm .mac... |
275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
.macro RING0_PTREGS_FRAME CFI_STARTPROC simple CFI_SIGNAL_FRAME CFI_DEF_CFA esp, PT_OLDESP-PT_EBX /*CFI_OFFSET cs, PT_CS-PT_OLDESP;*/ CFI_OFFSET eip, PT_EIP-PT_OLDESP /*CFI_OFFSET es, PT_ES-PT_OLDESP;*/ /*CFI_OFFSET ds, PT_DS-PT_OLDESP;*/ CFI_OFFSET eax, PT_EAX-PT_OLDESP CFI_OFFSET ebp, PT_EBP-PT_OLDESP CFI_OFFSET edi, PT_EDI-PT_OLDESP CFI_OFFSET esi, PT_ESI-PT_OLDESP CFI_OFFSET edx, PT_EDX-PT_OLDESP CFI_OFFSET ecx, PT_ECX-PT_OLDESP |
eb5b7b9d8 [PATCH] i386: Use... |
289 |
CFI_OFFSET ebx, PT_EBX-PT_OLDESP |
f0d96110f x86: use asm .mac... |
290 |
.endm |
1da177e4c Linux-2.6.12-rc2 |
291 292 |
ENTRY(ret_from_fork) |
fe7cacc1c [PATCH] i386: rel... |
293 |
CFI_STARTPROC |
df5d1874c x86: Use {push,po... |
294 |
pushl_cfi %eax |
1da177e4c Linux-2.6.12-rc2 |
295 296 |
call schedule_tail GET_THREAD_INFO(%ebp) |
df5d1874c x86: Use {push,po... |
297 298 299 |
popl_cfi %eax pushl_cfi $0x0202 # Reset kernel eflags popfl_cfi |
1da177e4c Linux-2.6.12-rc2 |
300 |
jmp syscall_exit |
fe7cacc1c [PATCH] i386: rel... |
301 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
302 |
END(ret_from_fork) |
1da177e4c Linux-2.6.12-rc2 |
303 304 |
/* |
a00e817f4 kprobes/x86-32: M... |
305 306 307 308 |
* Interrupt exit functions should be protected against kprobes */ .pushsection .kprobes.text, "ax" /* |
1da177e4c Linux-2.6.12-rc2 |
309 310 311 312 313 314 315 316 |
* Return to user mode is not as complex as all this looks, * but we want the default path for a system call return to * go as quickly as possible which is why some of this is * less clear than it otherwise should be. */ # userspace resumption stub bypassing syscall exit tracing ALIGN |
fe7cacc1c [PATCH] i386: rel... |
317 |
RING0_PTREGS_FRAME |
1da177e4c Linux-2.6.12-rc2 |
318 |
ret_from_exception: |
139ec7c41 [PATCH] paravirt:... |
319 |
preempt_stop(CLBR_ANY) |
1da177e4c Linux-2.6.12-rc2 |
320 321 |
ret_from_intr: GET_THREAD_INFO(%ebp) |
4031ff388 [PATCH] fix broke... |
322 |
check_userspace: |
eb5b7b9d8 [PATCH] i386: Use... |
323 324 |
movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS movb PT_CS(%esp), %al |
ab68ed98f x86: entry_32.S -... |
325 |
andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax |
78be3706b [PATCH] i386: All... |
326 327 |
cmpl $USER_RPL, %eax jb resume_kernel # not returning to v8086 or userspace |
f95d47caa [PATCH] i386: Use... |
328 |
|
1da177e4c Linux-2.6.12-rc2 |
329 |
ENTRY(resume_userspace) |
c7e872e7d lockdep: i386: co... |
330 |
LOCKDEP_SYS_EXIT |
139ec7c41 [PATCH] paravirt:... |
331 |
DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt |
1da177e4c Linux-2.6.12-rc2 |
332 333 |
# setting need_resched or sigpending # between sampling and the iret |
e32e58a96 x86: fix lockdep ... |
334 |
TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
335 336 337 338 339 |
movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done on # int/exception return? jne work_pending jmp restore_all |
47a55cd79 [PATCH] i386: ent... |
340 |
END(ret_from_exception) |
1da177e4c Linux-2.6.12-rc2 |
341 342 343 |
#ifdef CONFIG_PREEMPT ENTRY(resume_kernel) |
139ec7c41 [PATCH] paravirt:... |
344 |
DISABLE_INTERRUPTS(CLBR_ANY) |
1da177e4c Linux-2.6.12-rc2 |
345 |
cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? |
2e04bc765 i386: fix return ... |
346 |
jnz restore_all |
1da177e4c Linux-2.6.12-rc2 |
347 348 349 350 |
need_resched: movl TI_flags(%ebp), %ecx # need_resched set ? testb $_TIF_NEED_RESCHED, %cl jz restore_all |
ab68ed98f x86: entry_32.S -... |
351 |
testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ? |
1da177e4c Linux-2.6.12-rc2 |
352 353 354 |
jz restore_all call preempt_schedule_irq jmp need_resched |
47a55cd79 [PATCH] i386: ent... |
355 |
END(resume_kernel) |
1da177e4c Linux-2.6.12-rc2 |
356 |
#endif |
fe7cacc1c [PATCH] i386: rel... |
357 |
CFI_ENDPROC |
a00e817f4 kprobes/x86-32: M... |
358 359 360 361 |
/* * End of kprobes section */ .popsection |
1da177e4c Linux-2.6.12-rc2 |
362 363 364 365 366 |
/* SYSENTER_RETURN points to after the "sysenter" instruction in the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ # sysenter call handler stub |
0aa97fb22 x86 vDSO: ia32_sy... |
367 |
ENTRY(ia32_sysenter_target) |
fe7cacc1c [PATCH] i386: rel... |
368 |
CFI_STARTPROC simple |
adf142369 [PATCH] i386/x86-... |
369 |
CFI_SIGNAL_FRAME |
fe7cacc1c [PATCH] i386: rel... |
370 371 |
CFI_DEF_CFA esp, 0 CFI_REGISTER esp, ebp |
faca62273 x86: use generic ... |
372 |
movl TSS_sysenter_sp0(%esp),%esp |
1da177e4c Linux-2.6.12-rc2 |
373 |
sysenter_past_esp: |
55f327fa9 [PATCH] lockdep: ... |
374 |
/* |
d93c870ba x86: only enable ... |
375 376 377 |
* Interrupts are disabled here, but we can't trace it until * enough kernel state to call TRACE_IRQS_OFF can be called - but * we immediately enable interrupts at that point anyway. |
55f327fa9 [PATCH] lockdep: ... |
378 |
*/ |
3234282f3 x86, asm: Fix CFI... |
379 |
pushl_cfi $__USER_DS |
fe7cacc1c [PATCH] i386: rel... |
380 |
/*CFI_REL_OFFSET ss, 0*/ |
df5d1874c x86: Use {push,po... |
381 |
pushl_cfi %ebp |
fe7cacc1c [PATCH] i386: rel... |
382 |
CFI_REL_OFFSET esp, 0 |
df5d1874c x86: Use {push,po... |
383 |
pushfl_cfi |
d93c870ba x86: only enable ... |
384 |
orl $X86_EFLAGS_IF, (%esp) |
3234282f3 x86, asm: Fix CFI... |
385 |
pushl_cfi $__USER_CS |
fe7cacc1c [PATCH] i386: rel... |
386 |
/*CFI_REL_OFFSET cs, 0*/ |
e6e5494cb [PATCH] vdso: ran... |
387 388 389 390 391 |
/* * Push current_thread_info()->sysenter_return to the stack. * A tiny bit of offset fixup is necessary - 4*4 means the 4 words * pushed above; +8 corresponds to copy_thread's esp0 setting. */ |
7bf04be8f x86, asm: Cleanup... |
392 |
pushl_cfi ((TI_sysenter_return)-THREAD_SIZE+8+4*4)(%esp) |
fe7cacc1c [PATCH] i386: rel... |
393 |
CFI_REL_OFFSET eip, 0 |
1da177e4c Linux-2.6.12-rc2 |
394 |
|
df5d1874c x86: Use {push,po... |
395 |
pushl_cfi %eax |
d93c870ba x86: only enable ... |
396 397 |
SAVE_ALL ENABLE_INTERRUPTS(CLBR_NONE) |
1da177e4c Linux-2.6.12-rc2 |
398 399 400 401 402 403 404 |
/* * Load the potential sixth argument from user stack. * Careful about security. */ cmpl $__PAGE_OFFSET-3,%ebp jae syscall_fault 1: movl (%ebp),%ebp |
d93c870ba x86: only enable ... |
405 |
movl %ebp,PT_EBP(%esp) |
1da177e4c Linux-2.6.12-rc2 |
406 407 408 409 |
.section __ex_table,"a" .align 4 .long 1b,syscall_fault .previous |
1da177e4c Linux-2.6.12-rc2 |
410 |
GET_THREAD_INFO(%ebp) |
88200bc28 x86: entry_32.S f... |
411 |
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) |
af0575bba i386 syscall audi... |
412 413 |
jnz sysenter_audit sysenter_do_call: |
1da177e4c Linux-2.6.12-rc2 |
414 415 416 |
cmpl $(nr_syscalls), %eax jae syscall_badsys call *sys_call_table(,%eax,4) |
eb5b7b9d8 [PATCH] i386: Use... |
417 |
movl %eax,PT_EAX(%esp) |
c7e872e7d lockdep: i386: co... |
418 |
LOCKDEP_SYS_EXIT |
42c24fa22 [PATCH] i386: PAR... |
419 |
DISABLE_INTERRUPTS(CLBR_ANY) |
55f327fa9 [PATCH] lockdep: ... |
420 |
TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
421 |
movl TI_flags(%ebp), %ecx |
88200bc28 x86: entry_32.S f... |
422 |
testl $_TIF_ALLWORK_MASK, %ecx |
af0575bba i386 syscall audi... |
423 424 |
jne sysexit_audit sysenter_exit: |
1da177e4c Linux-2.6.12-rc2 |
425 |
/* if something modifies registers it must also disable sysexit */ |
eb5b7b9d8 [PATCH] i386: Use... |
426 427 |
movl PT_EIP(%esp), %edx movl PT_OLDESP(%esp), %ecx |
1da177e4c Linux-2.6.12-rc2 |
428 |
xorl %ebp,%ebp |
55f327fa9 [PATCH] lockdep: ... |
429 |
TRACE_IRQS_ON |
464d1a78f [PATCH] i386: Con... |
430 |
1: mov PT_FS(%esp), %fs |
ccbeed3a0 x86: make lazy %g... |
431 |
PTGS_TO_GS |
d75cd22fd x86/paravirt: spl... |
432 |
ENABLE_INTERRUPTS_SYSEXIT |
af0575bba i386 syscall audi... |
433 434 435 |
#ifdef CONFIG_AUDITSYSCALL sysenter_audit: |
88200bc28 x86: entry_32.S f... |
436 |
testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
af0575bba i386 syscall audi... |
437 438 439 440 441 442 443 444 445 446 |
jnz syscall_trace_entry addl $4,%esp CFI_ADJUST_CFA_OFFSET -4 /* %esi already in 8(%esp) 6th arg: 4th syscall arg */ /* %edx already in 4(%esp) 5th arg: 3rd syscall arg */ /* %ecx already in 0(%esp) 4th arg: 2nd syscall arg */ movl %ebx,%ecx /* 3rd arg: 1st syscall arg */ movl %eax,%edx /* 2nd arg: syscall number */ movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */ call audit_syscall_entry |
df5d1874c x86: Use {push,po... |
447 |
pushl_cfi %ebx |
af0575bba i386 syscall audi... |
448 449 450 451 |
movl PT_EAX(%esp),%eax /* reload syscall number */ jmp sysenter_do_call sysexit_audit: |
88200bc28 x86: entry_32.S f... |
452 |
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx |
af0575bba i386 syscall audi... |
453 454 455 456 457 458 459 460 461 462 463 464 |
jne syscall_exit_work TRACE_IRQS_ON ENABLE_INTERRUPTS(CLBR_ANY) movl %eax,%edx /* second arg, syscall return value */ cmpl $0,%eax /* is it < 0? */ setl %al /* 1 if so, 0 if not */ movzbl %al,%eax /* zero-extend that */ inc %eax /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */ call audit_syscall_exit DISABLE_INTERRUPTS(CLBR_ANY) TRACE_IRQS_OFF movl TI_flags(%ebp), %ecx |
88200bc28 x86: entry_32.S f... |
465 |
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx |
af0575bba i386 syscall audi... |
466 467 468 469 |
jne syscall_exit_work movl PT_EAX(%esp),%eax /* reload syscall return value */ jmp sysenter_exit #endif |
fe7cacc1c [PATCH] i386: rel... |
470 |
CFI_ENDPROC |
f95d47caa [PATCH] i386: Use... |
471 |
.pushsection .fixup,"ax" |
464d1a78f [PATCH] i386: Con... |
472 |
2: movl $0,PT_FS(%esp) |
f95d47caa [PATCH] i386: Use... |
473 474 475 476 477 |
jmp 1b .section __ex_table,"a" .align 4 .long 1b,2b .popsection |
ccbeed3a0 x86: make lazy %g... |
478 |
PTGS_TO_GS_EX |
0aa97fb22 x86 vDSO: ia32_sy... |
479 |
ENDPROC(ia32_sysenter_target) |
1da177e4c Linux-2.6.12-rc2 |
480 |
|
a00e817f4 kprobes/x86-32: M... |
481 482 483 484 |
/* * syscall stub including irq exit should be protected against kprobes */ .pushsection .kprobes.text, "ax" |
1da177e4c Linux-2.6.12-rc2 |
485 486 |
# system call handler stub ENTRY(system_call) |
fe7cacc1c [PATCH] i386: rel... |
487 |
RING0_INT_FRAME # can't unwind into user space anyway |
df5d1874c x86: Use {push,po... |
488 |
pushl_cfi %eax # save orig_eax |
1da177e4c Linux-2.6.12-rc2 |
489 490 |
SAVE_ALL GET_THREAD_INFO(%ebp) |
ed75e8d58 [PATCH] UML Suppo... |
491 |
# system call tracing in operation / emulation |
88200bc28 x86: entry_32.S f... |
492 |
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) |
1da177e4c Linux-2.6.12-rc2 |
493 494 495 496 497 |
jnz syscall_trace_entry cmpl $(nr_syscalls), %eax jae syscall_badsys syscall_call: call *sys_call_table(,%eax,4) |
eb5b7b9d8 [PATCH] i386: Use... |
498 |
movl %eax,PT_EAX(%esp) # store the return value |
1da177e4c Linux-2.6.12-rc2 |
499 |
syscall_exit: |
c7e872e7d lockdep: i386: co... |
500 |
LOCKDEP_SYS_EXIT |
139ec7c41 [PATCH] paravirt:... |
501 |
DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt |
1da177e4c Linux-2.6.12-rc2 |
502 503 |
# setting need_resched or sigpending # between sampling and the iret |
55f327fa9 [PATCH] lockdep: ... |
504 |
TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
505 |
movl TI_flags(%ebp), %ecx |
88200bc28 x86: entry_32.S f... |
506 |
testl $_TIF_ALLWORK_MASK, %ecx # current->work |
1da177e4c Linux-2.6.12-rc2 |
507 508 509 |
jne syscall_exit_work restore_all: |
2e04bc765 i386: fix return ... |
510 511 |
TRACE_IRQS_IRET restore_all_notrace: |
eb5b7b9d8 [PATCH] i386: Use... |
512 513 |
movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS # Warning: PT_OLDSS(%esp) contains the wrong/random values if we |
5df240826 [PATCH] fix crash... |
514 515 |
# are returning to the kernel. # See comments in process.c:copy_thread() for details. |
eb5b7b9d8 [PATCH] i386: Use... |
516 517 |
movb PT_OLDSS(%esp), %ah movb PT_CS(%esp), %al |
ab68ed98f x86: entry_32.S -... |
518 |
andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax |
78be3706b [PATCH] i386: All... |
519 |
cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax |
fe7cacc1c [PATCH] i386: rel... |
520 |
CFI_REMEMBER_STATE |
1da177e4c Linux-2.6.12-rc2 |
521 522 |
je ldt_ss # returning to user-space with LDT SS restore_nocheck: |
ccbeed3a0 x86: make lazy %g... |
523 |
RESTORE_REGS 4 # skip orig_eax/error_code |
f7f3d791e x86: don't make i... |
524 |
irq_return: |
3701d863b x86: fixup more p... |
525 |
INTERRUPT_RETURN |
1da177e4c Linux-2.6.12-rc2 |
526 |
.section .fixup,"ax" |
90e9f5366 xen: make sure ir... |
527 |
ENTRY(iret_exc) |
a879cbbb3 x86: make traps o... |
528 529 530 |
pushl $0 # no error code pushl $do_iret_error jmp error_code |
1da177e4c Linux-2.6.12-rc2 |
531 532 533 |
.previous .section __ex_table,"a" .align 4 |
3701d863b x86: fixup more p... |
534 |
.long irq_return,iret_exc |
1da177e4c Linux-2.6.12-rc2 |
535 |
.previous |
fe7cacc1c [PATCH] i386: rel... |
536 |
CFI_RESTORE_STATE |
1da177e4c Linux-2.6.12-rc2 |
537 |
ldt_ss: |
eb5b7b9d8 [PATCH] i386: Use... |
538 |
larl PT_OLDSS(%esp), %eax |
1da177e4c Linux-2.6.12-rc2 |
539 540 541 |
jnz restore_nocheck testl $0x00400000, %eax # returning to 32bit stack? jnz restore_nocheck # allright, normal return |
d3561b7fa [PATCH] paravirt:... |
542 543 544 545 546 547 548 549 550 551 |
#ifdef CONFIG_PARAVIRT /* * The kernel can't run on a non-flat stack if paravirt mode * is active. Rather than try to fixup the high bits of * ESP, bypass this code entirely. This may break DOSemu * and/or Wine support in a paravirt VM, although the option * is still available to implement the setting of the high * 16-bits in the INTERRUPT_RETURN paravirt-op. */ |
93b1eab3d paravirt: refacto... |
552 |
cmpl $0, pv_info+PARAVIRT_enabled |
d3561b7fa [PATCH] paravirt:... |
553 554 |
jne restore_nocheck #endif |
dc4c2a0ae i386: fix/simplif... |
555 556 557 558 559 560 561 562 563 564 565 |
/* * Setup and switch to ESPFIX stack * * We're returning to userspace with a 16 bit stack. The CPU will not * restore the high word of ESP for us on executing iret... This is an * "official" bug of all the x86-compatible CPUs, which we can work * around to make dosemu and wine happy. We do this by preloading the * high word of ESP with the high word of the userspace ESP while * compensating for the offset by changing to the ESPFIX segment with * a base address that matches for the difference. */ |
72c511dd5 x86-32, asm: Dire... |
566 |
#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8) |
dc4c2a0ae i386: fix/simplif... |
567 568 569 570 |
mov %esp, %edx /* load kernel esp */ mov PT_OLDESP(%esp), %eax /* load userspace esp */ mov %dx, %ax /* eax: new kernel esp */ sub %eax, %edx /* offset (low word is 0) */ |
dc4c2a0ae i386: fix/simplif... |
571 |
shr $16, %edx |
72c511dd5 x86-32, asm: Dire... |
572 573 |
mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */ mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */ |
df5d1874c x86: Use {push,po... |
574 575 |
pushl_cfi $__ESPFIX_SS pushl_cfi %eax /* new kernel esp */ |
2e04bc765 i386: fix return ... |
576 577 578 |
/* Disable interrupts, but do not irqtrace this section: we * will soon execute iret and the tracer was already set to * the irqstate after the iret */ |
139ec7c41 [PATCH] paravirt:... |
579 |
DISABLE_INTERRUPTS(CLBR_EAX) |
dc4c2a0ae i386: fix/simplif... |
580 |
lss (%esp), %esp /* switch to espfix segment */ |
be44d2aab [PATCH] i386: esp... |
581 582 |
CFI_ADJUST_CFA_OFFSET -8 jmp restore_nocheck |
fe7cacc1c [PATCH] i386: rel... |
583 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
584 |
ENDPROC(system_call) |
1da177e4c Linux-2.6.12-rc2 |
585 586 587 |
# perform work that needs to be done immediately before resumption ALIGN |
fe7cacc1c [PATCH] i386: rel... |
588 |
RING0_PTREGS_FRAME # can't unwind into user space anyway |
1da177e4c Linux-2.6.12-rc2 |
589 590 591 592 593 |
work_pending: testb $_TIF_NEED_RESCHED, %cl jz work_notifysig work_resched: call schedule |
c7e872e7d lockdep: i386: co... |
594 |
LOCKDEP_SYS_EXIT |
139ec7c41 [PATCH] paravirt:... |
595 |
DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt |
1da177e4c Linux-2.6.12-rc2 |
596 597 |
# setting need_resched or sigpending # between sampling and the iret |
55f327fa9 [PATCH] lockdep: ... |
598 |
TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
599 600 601 602 603 604 605 606 607 |
movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done other # than syscall tracing? jz restore_all testb $_TIF_NEED_RESCHED, %cl jnz work_resched work_notifysig: # deal with pending signals and # notify-resume requests |
74b47a784 [PATCH] i386: Fix... |
608 |
#ifdef CONFIG_VM86 |
ab68ed98f x86: entry_32.S -... |
609 |
testl $X86_EFLAGS_VM, PT_EFLAGS(%esp) |
1da177e4c Linux-2.6.12-rc2 |
610 611 612 |
movl %esp, %eax jne work_notifysig_v86 # returning to kernel-space or # vm86-space |
3596ff4e6 x86: Call do_noti... |
613 614 |
TRACE_IRQS_ON ENABLE_INTERRUPTS(CLBR_NONE) |
1da177e4c Linux-2.6.12-rc2 |
615 616 |
xorl %edx, %edx call do_notify_resume |
4031ff388 [PATCH] fix broke... |
617 |
jmp resume_userspace_sig |
1da177e4c Linux-2.6.12-rc2 |
618 619 620 |
ALIGN work_notifysig_v86: |
df5d1874c x86: Use {push,po... |
621 |
pushl_cfi %ecx # save ti_flags for do_notify_resume |
1da177e4c Linux-2.6.12-rc2 |
622 |
call save_v86_state # %eax contains pt_regs pointer |
df5d1874c x86: Use {push,po... |
623 |
popl_cfi %ecx |
1da177e4c Linux-2.6.12-rc2 |
624 |
movl %eax, %esp |
74b47a784 [PATCH] i386: Fix... |
625 626 627 |
#else movl %esp, %eax #endif |
3596ff4e6 x86: Call do_noti... |
628 629 |
TRACE_IRQS_ON ENABLE_INTERRUPTS(CLBR_NONE) |
1da177e4c Linux-2.6.12-rc2 |
630 631 |
xorl %edx, %edx call do_notify_resume |
4031ff388 [PATCH] fix broke... |
632 |
jmp resume_userspace_sig |
47a55cd79 [PATCH] i386: ent... |
633 |
END(work_pending) |
1da177e4c Linux-2.6.12-rc2 |
634 635 636 637 |
# perform syscall exit tracing ALIGN syscall_trace_entry: |
eb5b7b9d8 [PATCH] i386: Use... |
638 |
movl $-ENOSYS,PT_EAX(%esp) |
1da177e4c Linux-2.6.12-rc2 |
639 |
movl %esp, %eax |
d4d671501 x86 ptrace: unify... |
640 641 |
call syscall_trace_enter /* What it returned is what we'll actually use. */ |
1da177e4c Linux-2.6.12-rc2 |
642 643 644 |
cmpl $(nr_syscalls), %eax jnae syscall_call jmp syscall_exit |
47a55cd79 [PATCH] i386: ent... |
645 |
END(syscall_trace_entry) |
1da177e4c Linux-2.6.12-rc2 |
646 647 648 649 |
# perform syscall exit tracing ALIGN syscall_exit_work: |
88200bc28 x86: entry_32.S f... |
650 |
testl $_TIF_WORK_SYSCALL_EXIT, %ecx |
1da177e4c Linux-2.6.12-rc2 |
651 |
jz work_pending |
55f327fa9 [PATCH] lockdep: ... |
652 |
TRACE_IRQS_ON |
d4d671501 x86 ptrace: unify... |
653 |
ENABLE_INTERRUPTS(CLBR_ANY) # could let syscall_trace_leave() call |
1da177e4c Linux-2.6.12-rc2 |
654 655 |
# schedule() instead movl %esp, %eax |
d4d671501 x86 ptrace: unify... |
656 |
call syscall_trace_leave |
1da177e4c Linux-2.6.12-rc2 |
657 |
jmp resume_userspace |
47a55cd79 [PATCH] i386: ent... |
658 |
END(syscall_exit_work) |
fe7cacc1c [PATCH] i386: rel... |
659 |
CFI_ENDPROC |
1da177e4c Linux-2.6.12-rc2 |
660 |
|
fe7cacc1c [PATCH] i386: rel... |
661 |
RING0_INT_FRAME # can't unwind into user space anyway |
1da177e4c Linux-2.6.12-rc2 |
662 |
syscall_fault: |
1da177e4c Linux-2.6.12-rc2 |
663 |
GET_THREAD_INFO(%ebp) |
eb5b7b9d8 [PATCH] i386: Use... |
664 |
movl $-EFAULT,PT_EAX(%esp) |
1da177e4c Linux-2.6.12-rc2 |
665 |
jmp resume_userspace |
47a55cd79 [PATCH] i386: ent... |
666 |
END(syscall_fault) |
1da177e4c Linux-2.6.12-rc2 |
667 |
|
1da177e4c Linux-2.6.12-rc2 |
668 |
syscall_badsys: |
eb5b7b9d8 [PATCH] i386: Use... |
669 |
movl $-ENOSYS,PT_EAX(%esp) |
1da177e4c Linux-2.6.12-rc2 |
670 |
jmp resume_userspace |
47a55cd79 [PATCH] i386: ent... |
671 |
END(syscall_badsys) |
fe7cacc1c [PATCH] i386: rel... |
672 |
CFI_ENDPROC |
a00e817f4 kprobes/x86-32: M... |
673 674 675 676 |
/* * End of kprobes section */ .popsection |
1da177e4c Linux-2.6.12-rc2 |
677 |
|
253f29a4a x86: pass in pt_r... |
678 679 680 |
/* * System calls that need a pt_regs pointer. */ |
e258e4e0b x86-32: Add new p... |
681 |
#define PTREGSCALL0(name) \ |
253f29a4a x86: pass in pt_r... |
682 683 684 685 |
ALIGN; \ ptregs_##name: \ leal 4(%esp),%eax; \ jmp sys_##name; |
e258e4e0b x86-32: Add new p... |
686 687 688 689 |
#define PTREGSCALL1(name) \ ALIGN; \ ptregs_##name: \ leal 4(%esp),%edx; \ |
ce9119ad9 x86-32: Avoid pip... |
690 |
movl (PT_EBX+4)(%esp),%eax; \ |
e258e4e0b x86-32: Add new p... |
691 692 693 694 695 696 |
jmp sys_##name; #define PTREGSCALL2(name) \ ALIGN; \ ptregs_##name: \ leal 4(%esp),%ecx; \ |
ce9119ad9 x86-32: Avoid pip... |
697 698 |
movl (PT_ECX+4)(%esp),%edx; \ movl (PT_EBX+4)(%esp),%eax; \ |
e258e4e0b x86-32: Add new p... |
699 700 701 702 703 |
jmp sys_##name; #define PTREGSCALL3(name) \ ALIGN; \ ptregs_##name: \ |
a34107b55 i386: Add unwind ... |
704 |
CFI_STARTPROC; \ |
e258e4e0b x86-32: Add new p... |
705 |
leal 4(%esp),%eax; \ |
a34107b55 i386: Add unwind ... |
706 |
pushl_cfi %eax; \ |
e258e4e0b x86-32: Add new p... |
707 708 709 710 711 |
movl PT_EDX(%eax),%ecx; \ movl PT_ECX(%eax),%edx; \ movl PT_EBX(%eax),%eax; \ call sys_##name; \ addl $4,%esp; \ |
a34107b55 i386: Add unwind ... |
712 713 714 715 |
CFI_ADJUST_CFA_OFFSET -4; \ ret; \ CFI_ENDPROC; \ ENDPROC(ptregs_##name) |
e258e4e0b x86-32: Add new p... |
716 |
|
27f59559d x86: Merge sys_iopl |
717 |
PTREGSCALL1(iopl) |
e258e4e0b x86-32: Add new p... |
718 |
PTREGSCALL0(fork) |
e258e4e0b x86-32: Add new p... |
719 |
PTREGSCALL0(vfork) |
11cf88bd0 x86: Merge sys_ex... |
720 |
PTREGSCALL3(execve) |
052acad48 x86: Merge sys_si... |
721 |
PTREGSCALL2(sigaltstack) |
e258e4e0b x86-32: Add new p... |
722 723 |
PTREGSCALL0(sigreturn) PTREGSCALL0(rt_sigreturn) |
f1382f157 x86, 32-bit: Conv... |
724 725 |
PTREGSCALL2(vm86) PTREGSCALL1(vm86old) |
253f29a4a x86: pass in pt_r... |
726 |
|
f839bbc5c x86: Merge sys_clone |
727 728 729 |
/* Clone is an oddball. The 4th arg is in %edi */ ALIGN; ptregs_clone: |
a34107b55 i386: Add unwind ... |
730 |
CFI_STARTPROC |
f839bbc5c x86: Merge sys_clone |
731 |
leal 4(%esp),%eax |
a34107b55 i386: Add unwind ... |
732 733 |
pushl_cfi %eax pushl_cfi PT_EDI(%eax) |
f839bbc5c x86: Merge sys_clone |
734 735 736 737 738 |
movl PT_EDX(%eax),%ecx movl PT_ECX(%eax),%edx movl PT_EBX(%eax),%eax call sys_clone addl $8,%esp |
a34107b55 i386: Add unwind ... |
739 |
CFI_ADJUST_CFA_OFFSET -8 |
f839bbc5c x86: Merge sys_clone |
740 |
ret |
a34107b55 i386: Add unwind ... |
741 742 |
CFI_ENDPROC ENDPROC(ptregs_clone) |
f839bbc5c x86: Merge sys_clone |
743 |
|
f0d96110f x86: use asm .mac... |
744 |
.macro FIXUP_ESPFIX_STACK |
dc4c2a0ae i386: fix/simplif... |
745 746 747 748 749 750 751 752 |
/* * Switch back for ESPFIX stack to the normal zerobased stack * * We can't call C functions using the ESPFIX stack. This code reads * the high word of the segment base from the GDT and swiches to the * normal stack and adjusts ESP with the matching offset. */ /* fixup the stack */ |
72c511dd5 x86-32, asm: Dire... |
753 754 |
mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */ |
dc4c2a0ae i386: fix/simplif... |
755 756 |
shl $16, %eax addl %esp, %eax /* the adjusted stack pointer */ |
df5d1874c x86: Use {push,po... |
757 758 |
pushl_cfi $__KERNEL_DS pushl_cfi %eax |
dc4c2a0ae i386: fix/simplif... |
759 |
lss (%esp), %esp /* switch to the normal stack segment */ |
f0d96110f x86: use asm .mac... |
760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
CFI_ADJUST_CFA_OFFSET -8 .endm .macro UNWIND_ESPFIX_STACK movl %ss, %eax /* see if on espfix stack */ cmpw $__ESPFIX_SS, %ax jne 27f movl $__KERNEL_DS, %eax movl %eax, %ds movl %eax, %es /* switch to normal stack */ FIXUP_ESPFIX_STACK 27: .endm |
1da177e4c Linux-2.6.12-rc2 |
774 775 |
/* |
b7c6244f1 x86: 32 bits: shr... |
776 777 778 |
* Build the entry stubs and pointer table with some assembler magic. * We pack 7 stubs into a single 32-byte chunk, which will fit in a * single cache line on all modern x86 implementations. |
1da177e4c Linux-2.6.12-rc2 |
779 |
*/ |
4687518c4 x86: 32 bit: inte... |
780 |
.section .init.rodata,"a" |
1da177e4c Linux-2.6.12-rc2 |
781 |
ENTRY(interrupt) |
ea7145477 x86: Separate out... |
782 |
.section .entry.text, "ax" |
b7c6244f1 x86: 32 bits: shr... |
783 784 |
.p2align 5 .p2align CONFIG_X86_L1_CACHE_SHIFT |
1da177e4c Linux-2.6.12-rc2 |
785 |
ENTRY(irq_entries_start) |
fe7cacc1c [PATCH] i386: rel... |
786 |
RING0_INT_FRAME |
4687518c4 x86: 32 bit: inte... |
787 |
vector=FIRST_EXTERNAL_VECTOR |
b7c6244f1 x86: 32 bits: shr... |
788 789 790 791 |
.rept (NR_VECTORS-FIRST_EXTERNAL_VECTOR+6)/7 .balign 32 .rept 7 .if vector < NR_VECTORS |
8665596ec x86: fix up the n... |
792 |
.if vector <> FIRST_EXTERNAL_VECTOR |
fe7cacc1c [PATCH] i386: rel... |
793 |
CFI_ADJUST_CFA_OFFSET -4 |
b7c6244f1 x86: 32 bits: shr... |
794 |
.endif |
df5d1874c x86: Use {push,po... |
795 |
1: pushl_cfi $(~vector+0x80) /* Note: always in signed byte range */ |
8665596ec x86: fix up the n... |
796 |
.if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6 |
b7c6244f1 x86: 32 bits: shr... |
797 798 799 |
jmp 2f .endif .previous |
1da177e4c Linux-2.6.12-rc2 |
800 |
.long 1b |
ea7145477 x86: Separate out... |
801 |
.section .entry.text, "ax" |
1da177e4c Linux-2.6.12-rc2 |
802 |
vector=vector+1 |
b7c6244f1 x86: 32 bits: shr... |
803 804 805 |
.endif .endr 2: jmp common_interrupt |
1da177e4c Linux-2.6.12-rc2 |
806 |
.endr |
47a55cd79 [PATCH] i386: ent... |
807 808 809 810 811 |
END(irq_entries_start) .previous END(interrupt) .previous |
1da177e4c Linux-2.6.12-rc2 |
812 |
|
55f327fa9 [PATCH] lockdep: ... |
813 814 815 816 |
/* * the CPU automatically disables interrupts when executing an IRQ vector, * so IRQ-flags tracing has to follow that: */ |
b7c6244f1 x86: 32 bits: shr... |
817 |
.p2align CONFIG_X86_L1_CACHE_SHIFT |
1da177e4c Linux-2.6.12-rc2 |
818 |
common_interrupt: |
b7c6244f1 x86: 32 bits: shr... |
819 |
addl $-0x80,(%esp) /* Adjust vector into the [-256,-1] range */ |
1da177e4c Linux-2.6.12-rc2 |
820 |
SAVE_ALL |
55f327fa9 [PATCH] lockdep: ... |
821 |
TRACE_IRQS_OFF |
1da177e4c Linux-2.6.12-rc2 |
822 823 824 |
movl %esp,%eax call do_IRQ jmp ret_from_intr |
47a55cd79 [PATCH] i386: ent... |
825 |
ENDPROC(common_interrupt) |
fe7cacc1c [PATCH] i386: rel... |
826 |
CFI_ENDPROC |
1da177e4c Linux-2.6.12-rc2 |
827 |
|
a00e817f4 kprobes/x86-32: M... |
828 829 830 831 |
/* * Irq entries should be protected against kprobes */ .pushsection .kprobes.text, "ax" |
02cf94c37 x86: make x86_32 ... |
832 |
#define BUILD_INTERRUPT3(name, nr, fn) \ |
1da177e4c Linux-2.6.12-rc2 |
833 |
ENTRY(name) \ |
fe7cacc1c [PATCH] i386: rel... |
834 |
RING0_INT_FRAME; \ |
df5d1874c x86: Use {push,po... |
835 |
pushl_cfi $~(nr); \ |
fe7cacc1c [PATCH] i386: rel... |
836 |
SAVE_ALL; \ |
55f327fa9 [PATCH] lockdep: ... |
837 |
TRACE_IRQS_OFF \ |
1da177e4c Linux-2.6.12-rc2 |
838 |
movl %esp,%eax; \ |
02cf94c37 x86: make x86_32 ... |
839 |
call fn; \ |
55f327fa9 [PATCH] lockdep: ... |
840 |
jmp ret_from_intr; \ |
47a55cd79 [PATCH] i386: ent... |
841 842 |
CFI_ENDPROC; \ ENDPROC(name) |
1da177e4c Linux-2.6.12-rc2 |
843 |
|
02cf94c37 x86: make x86_32 ... |
844 |
#define BUILD_INTERRUPT(name, nr) BUILD_INTERRUPT3(name, nr, smp_##name) |
1da177e4c Linux-2.6.12-rc2 |
845 |
/* The include is where all of the SMP etc. interrupts come from */ |
1164dd009 x86: move mach-de... |
846 |
#include <asm/entry_arch.h> |
1da177e4c Linux-2.6.12-rc2 |
847 |
|
1da177e4c Linux-2.6.12-rc2 |
848 |
ENTRY(coprocessor_error) |
fe7cacc1c [PATCH] i386: rel... |
849 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
850 851 |
pushl_cfi $0 pushl_cfi $do_coprocessor_error |
1da177e4c Linux-2.6.12-rc2 |
852 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
853 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
854 |
END(coprocessor_error) |
1da177e4c Linux-2.6.12-rc2 |
855 856 |
ENTRY(simd_coprocessor_error) |
fe7cacc1c [PATCH] i386: rel... |
857 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
858 |
pushl_cfi $0 |
40d2e7631 x86-32: Rework ca... |
859 860 |
#ifdef CONFIG_X86_INVD_BUG /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ |
df5d1874c x86: Use {push,po... |
861 |
661: pushl_cfi $do_general_protection |
40d2e7631 x86-32: Rework ca... |
862 863 |
662: .section .altinstructions,"a" |
b4ca46e4e x86-32: Fix boot ... |
864 |
altinstruction_entry 661b, 663f, X86_FEATURE_XMM, 662b-661b, 664f-663f |
40d2e7631 x86-32: Rework ca... |
865 866 867 868 869 870 |
.previous .section .altinstr_replacement,"ax" 663: pushl $do_simd_coprocessor_error 664: .previous #else |
df5d1874c x86: Use {push,po... |
871 |
pushl_cfi $do_simd_coprocessor_error |
40d2e7631 x86-32: Rework ca... |
872 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
873 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
874 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
875 |
END(simd_coprocessor_error) |
1da177e4c Linux-2.6.12-rc2 |
876 877 |
ENTRY(device_not_available) |
fe7cacc1c [PATCH] i386: rel... |
878 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
879 880 |
pushl_cfi $-1 # mark this as an int pushl_cfi $do_device_not_available |
7643e9b93 i386: convert har... |
881 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
882 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
883 |
END(device_not_available) |
1da177e4c Linux-2.6.12-rc2 |
884 |
|
d3561b7fa [PATCH] paravirt:... |
885 886 |
#ifdef CONFIG_PARAVIRT ENTRY(native_iret) |
3701d863b x86: fixup more p... |
887 |
iret |
d3561b7fa [PATCH] paravirt:... |
888 889 |
.section __ex_table,"a" .align 4 |
3701d863b x86: fixup more p... |
890 |
.long native_iret, iret_exc |
d3561b7fa [PATCH] paravirt:... |
891 |
.previous |
47a55cd79 [PATCH] i386: ent... |
892 |
END(native_iret) |
d3561b7fa [PATCH] paravirt:... |
893 |
|
d75cd22fd x86/paravirt: spl... |
894 |
ENTRY(native_irq_enable_sysexit) |
d3561b7fa [PATCH] paravirt:... |
895 896 |
sti sysexit |
d75cd22fd x86/paravirt: spl... |
897 |
END(native_irq_enable_sysexit) |
d3561b7fa [PATCH] paravirt:... |
898 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
899 |
ENTRY(overflow) |
fe7cacc1c [PATCH] i386: rel... |
900 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
901 902 |
pushl_cfi $0 pushl_cfi $do_overflow |
1da177e4c Linux-2.6.12-rc2 |
903 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
904 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
905 |
END(overflow) |
1da177e4c Linux-2.6.12-rc2 |
906 907 |
ENTRY(bounds) |
fe7cacc1c [PATCH] i386: rel... |
908 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
909 910 |
pushl_cfi $0 pushl_cfi $do_bounds |
1da177e4c Linux-2.6.12-rc2 |
911 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
912 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
913 |
END(bounds) |
1da177e4c Linux-2.6.12-rc2 |
914 915 |
ENTRY(invalid_op) |
fe7cacc1c [PATCH] i386: rel... |
916 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
917 918 |
pushl_cfi $0 pushl_cfi $do_invalid_op |
1da177e4c Linux-2.6.12-rc2 |
919 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
920 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
921 |
END(invalid_op) |
1da177e4c Linux-2.6.12-rc2 |
922 923 |
ENTRY(coprocessor_segment_overrun) |
fe7cacc1c [PATCH] i386: rel... |
924 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
925 926 |
pushl_cfi $0 pushl_cfi $do_coprocessor_segment_overrun |
1da177e4c Linux-2.6.12-rc2 |
927 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
928 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
929 |
END(coprocessor_segment_overrun) |
1da177e4c Linux-2.6.12-rc2 |
930 931 |
ENTRY(invalid_TSS) |
fe7cacc1c [PATCH] i386: rel... |
932 |
RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
933 |
pushl_cfi $do_invalid_TSS |
1da177e4c Linux-2.6.12-rc2 |
934 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
935 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
936 |
END(invalid_TSS) |
1da177e4c Linux-2.6.12-rc2 |
937 938 |
ENTRY(segment_not_present) |
fe7cacc1c [PATCH] i386: rel... |
939 |
RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
940 |
pushl_cfi $do_segment_not_present |
1da177e4c Linux-2.6.12-rc2 |
941 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
942 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
943 |
END(segment_not_present) |
1da177e4c Linux-2.6.12-rc2 |
944 945 |
ENTRY(stack_segment) |
fe7cacc1c [PATCH] i386: rel... |
946 |
RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
947 |
pushl_cfi $do_stack_segment |
1da177e4c Linux-2.6.12-rc2 |
948 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
949 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
950 |
END(stack_segment) |
1da177e4c Linux-2.6.12-rc2 |
951 |
|
1da177e4c Linux-2.6.12-rc2 |
952 |
ENTRY(alignment_check) |
fe7cacc1c [PATCH] i386: rel... |
953 |
RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
954 |
pushl_cfi $do_alignment_check |
1da177e4c Linux-2.6.12-rc2 |
955 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
956 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
957 |
END(alignment_check) |
1da177e4c Linux-2.6.12-rc2 |
958 |
|
d28c4393a [PATCH] x86: erro... |
959 960 |
ENTRY(divide_error) RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
961 962 |
pushl_cfi $0 # no error code pushl_cfi $do_divide_error |
1da177e4c Linux-2.6.12-rc2 |
963 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
964 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
965 |
END(divide_error) |
1da177e4c Linux-2.6.12-rc2 |
966 967 968 |
#ifdef CONFIG_X86_MCE ENTRY(machine_check) |
fe7cacc1c [PATCH] i386: rel... |
969 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
970 971 |
pushl_cfi $0 pushl_cfi machine_check_vector |
1da177e4c Linux-2.6.12-rc2 |
972 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
973 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
974 |
END(machine_check) |
1da177e4c Linux-2.6.12-rc2 |
975 976 977 |
#endif ENTRY(spurious_interrupt_bug) |
fe7cacc1c [PATCH] i386: rel... |
978 |
RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
979 980 |
pushl_cfi $0 pushl_cfi $do_spurious_interrupt_bug |
1da177e4c Linux-2.6.12-rc2 |
981 |
jmp error_code |
fe7cacc1c [PATCH] i386: rel... |
982 |
CFI_ENDPROC |
47a55cd79 [PATCH] i386: ent... |
983 |
END(spurious_interrupt_bug) |
a00e817f4 kprobes/x86-32: M... |
984 985 986 987 |
/* * End of kprobes section */ .popsection |
1da177e4c Linux-2.6.12-rc2 |
988 |
|
02ba1a32d [PATCH] i386: mov... |
989 990 991 |
ENTRY(kernel_thread_helper) pushl $0 # fake return address for unwinder CFI_STARTPROC |
e840227c1 x86, 32-bit: Use ... |
992 993 |
movl %edi,%eax call *%esi |
02ba1a32d [PATCH] i386: mov... |
994 |
call do_exit |
5f5db5913 x86, debug: remov... |
995 |
ud2 # padding for call trace |
02ba1a32d [PATCH] i386: mov... |
996 997 |
CFI_ENDPROC ENDPROC(kernel_thread_helper) |
5ead97c84 xen: Core Xen imp... |
998 |
#ifdef CONFIG_XEN |
e2a81baf6 xen: support syse... |
999 1000 1001 1002 1003 |
/* Xen doesn't set %esp to be precisely what the normal sysenter entrypoint expects, so fix it up before using the normal path. */ ENTRY(xen_sysenter_target) RING0_INT_FRAME addl $5*4, %esp /* remove xen-provided frame */ |
2ddf9b7b3 i386/xen: add pro... |
1004 |
CFI_ADJUST_CFA_OFFSET -5*4 |
e2a81baf6 xen: support syse... |
1005 |
jmp sysenter_past_esp |
557d7d4e2 x86: use matching... |
1006 |
CFI_ENDPROC |
e2a81baf6 xen: support syse... |
1007 |
|
5ead97c84 xen: Core Xen imp... |
1008 1009 |
ENTRY(xen_hypervisor_callback) CFI_STARTPROC |
df5d1874c x86: Use {push,po... |
1010 |
pushl_cfi $0 |
5ead97c84 xen: Core Xen imp... |
1011 1012 |
SAVE_ALL TRACE_IRQS_OFF |
9ec2b804e xen: use iret dir... |
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
/* Check to see if we got the event in the critical region in xen_iret_direct, after we've reenabled events and checked for pending events. This simulates iret instruction's behaviour where it delivers a pending interrupt when enabling interrupts. */ movl PT_EIP(%esp),%eax cmpl $xen_iret_start_crit,%eax jb 1f cmpl $xen_iret_end_crit,%eax jae 1f |
0f2c87695 xen: jump to iret... |
1024 |
jmp xen_iret_crit_fixup |
e2a81baf6 xen: support syse... |
1025 |
|
e2a81baf6 xen: support syse... |
1026 |
ENTRY(xen_do_upcall) |
b77797fb2 xen: fold xen_sys... |
1027 |
1: mov %esp, %eax |
5ead97c84 xen: Core Xen imp... |
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
call xen_evtchn_do_upcall jmp ret_from_intr CFI_ENDPROC ENDPROC(xen_hypervisor_callback) # Hypervisor uses this for application faults while it executes. # We get here for two reasons: # 1. Fault while reloading DS, ES, FS or GS # 2. Fault while executing IRET # Category 1 we fix up by reattempting the load, and zeroing the segment # register if the load fails. # Category 2 we fix up by jumping to do_iret_error. We cannot use the # normal Linux return path in this case because if we use the IRET hypercall # to pop the stack frame we end up in an infinite loop of failsafe callbacks. # We distinguish between categories by maintaining a status value in EAX. ENTRY(xen_failsafe_callback) CFI_STARTPROC |
df5d1874c x86: Use {push,po... |
1045 |
pushl_cfi %eax |
5ead97c84 xen: Core Xen imp... |
1046 1047 1048 1049 1050 1051 |
movl $1,%eax 1: mov 4(%esp),%ds 2: mov 8(%esp),%es 3: mov 12(%esp),%fs 4: mov 16(%esp),%gs testl %eax,%eax |
df5d1874c x86: Use {push,po... |
1052 |
popl_cfi %eax |
5ead97c84 xen: Core Xen imp... |
1053 1054 1055 1056 1057 |
lea 16(%esp),%esp CFI_ADJUST_CFA_OFFSET -16 jz 5f addl $16,%esp jmp iret_exc # EAX != 0 => Category 2 (Bad IRET) |
df5d1874c x86: Use {push,po... |
1058 |
5: pushl_cfi $0 # EAX == 0 => Category 1 (Bad segment) |
5ead97c84 xen: Core Xen imp... |
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
SAVE_ALL jmp ret_from_exception CFI_ENDPROC .section .fixup,"ax" 6: xorl %eax,%eax movl %eax,4(%esp) jmp 1b 7: xorl %eax,%eax movl %eax,8(%esp) jmp 2b 8: xorl %eax,%eax movl %eax,12(%esp) jmp 3b 9: xorl %eax,%eax movl %eax,16(%esp) jmp 4b .previous .section __ex_table,"a" .align 4 .long 1b,6b .long 2b,7b .long 3b,8b .long 4b,9b .previous ENDPROC(xen_failsafe_callback) |
38e20b07e x86/xen: event ch... |
1085 1086 |
BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, xen_evtchn_do_upcall) |
5ead97c84 xen: Core Xen imp... |
1087 |
#endif /* CONFIG_XEN */ |
606576ce8 ftrace: rename FT... |
1088 |
#ifdef CONFIG_FUNCTION_TRACER |
d61f82d06 ftrace: use dynam... |
1089 1090 1091 |
#ifdef CONFIG_DYNAMIC_FTRACE ENTRY(mcount) |
d61f82d06 ftrace: use dynam... |
1092 1093 1094 1095 |
ret END(mcount) ENTRY(ftrace_caller) |
60a7ecf42 ftrace: add quick... |
1096 1097 |
cmpl $0, function_trace_stop jne ftrace_stub |
d61f82d06 ftrace: use dynam... |
1098 1099 1100 1101 1102 |
pushl %eax pushl %ecx pushl %edx movl 0xc(%esp), %eax movl 0x4(%ebp), %edx |
395a59d0f ftrace: store mco... |
1103 |
subl $MCOUNT_INSN_SIZE, %eax |
d61f82d06 ftrace: use dynam... |
1104 1105 1106 1107 1108 1109 1110 1111 |
.globl ftrace_call ftrace_call: call ftrace_stub popl %edx popl %ecx popl %eax |
5a45cfe1c ftrace: use code ... |
1112 1113 1114 1115 1116 |
#ifdef CONFIG_FUNCTION_GRAPH_TRACER .globl ftrace_graph_call ftrace_graph_call: jmp ftrace_stub #endif |
d61f82d06 ftrace: use dynam... |
1117 1118 1119 1120 1121 1122 1123 |
.globl ftrace_stub ftrace_stub: ret END(ftrace_caller) #else /* ! CONFIG_DYNAMIC_FTRACE */ |
16444a8a4 ftrace: add basic... |
1124 |
ENTRY(mcount) |
60a7ecf42 ftrace: add quick... |
1125 1126 |
cmpl $0, function_trace_stop jne ftrace_stub |
16444a8a4 ftrace: add basic... |
1127 1128 |
cmpl $ftrace_stub, ftrace_trace_function jnz trace |
fb52607af tracing/function-... |
1129 |
#ifdef CONFIG_FUNCTION_GRAPH_TRACER |
c2324b694 tracing: function... |
1130 |
cmpl $ftrace_stub, ftrace_graph_return |
fb52607af tracing/function-... |
1131 |
jnz ftrace_graph_caller |
e49dc19c6 ftrace: function ... |
1132 1133 1134 |
cmpl $ftrace_graph_entry_stub, ftrace_graph_entry jnz ftrace_graph_caller |
caf4b323b tracing, x86: add... |
1135 |
#endif |
16444a8a4 ftrace: add basic... |
1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 |
.globl ftrace_stub ftrace_stub: ret /* taken from glibc */ trace: pushl %eax pushl %ecx pushl %edx movl 0xc(%esp), %eax movl 0x4(%ebp), %edx |
395a59d0f ftrace: store mco... |
1147 |
subl $MCOUNT_INSN_SIZE, %eax |
16444a8a4 ftrace: add basic... |
1148 |
|
d61f82d06 ftrace: use dynam... |
1149 |
call *ftrace_trace_function |
16444a8a4 ftrace: add basic... |
1150 1151 1152 1153 |
popl %edx popl %ecx popl %eax |
16444a8a4 ftrace: add basic... |
1154 1155 |
jmp ftrace_stub END(mcount) |
d61f82d06 ftrace: use dynam... |
1156 |
#endif /* CONFIG_DYNAMIC_FTRACE */ |
606576ce8 ftrace: rename FT... |
1157 |
#endif /* CONFIG_FUNCTION_TRACER */ |
16444a8a4 ftrace: add basic... |
1158 |
|
fb52607af tracing/function-... |
1159 1160 |
#ifdef CONFIG_FUNCTION_GRAPH_TRACER ENTRY(ftrace_graph_caller) |
e7d3737ea tracing/function-... |
1161 1162 |
cmpl $0, function_trace_stop jne ftrace_stub |
caf4b323b tracing, x86: add... |
1163 1164 1165 |
pushl %eax pushl %ecx pushl %edx |
1dc1c6adf tracing/function-... |
1166 |
movl 0xc(%esp), %edx |
caf4b323b tracing, x86: add... |
1167 |
lea 0x4(%ebp), %eax |
71e308a23 function-graph: a... |
1168 |
movl (%ebp), %ecx |
bb4304c71 ftrace: have func... |
1169 |
subl $MCOUNT_INSN_SIZE, %edx |
caf4b323b tracing, x86: add... |
1170 |
call prepare_ftrace_return |
caf4b323b tracing, x86: add... |
1171 1172 1173 |
popl %edx popl %ecx popl %eax |
e7d3737ea tracing/function-... |
1174 |
ret |
fb52607af tracing/function-... |
1175 |
END(ftrace_graph_caller) |
caf4b323b tracing, x86: add... |
1176 1177 1178 |
.globl return_to_handler return_to_handler: |
caf4b323b tracing, x86: add... |
1179 |
pushl %eax |
caf4b323b tracing, x86: add... |
1180 |
pushl %edx |
71e308a23 function-graph: a... |
1181 |
movl %ebp, %eax |
caf4b323b tracing, x86: add... |
1182 |
call ftrace_return_to_handler |
194ec3418 function-graph/x8... |
1183 |
movl %eax, %ecx |
caf4b323b tracing, x86: add... |
1184 |
popl %edx |
caf4b323b tracing, x86: add... |
1185 |
popl %eax |
194ec3418 function-graph/x8... |
1186 |
jmp *%ecx |
e7d3737ea tracing/function-... |
1187 |
#endif |
16444a8a4 ftrace: add basic... |
1188 |
|
bb152f531 [PATCH] x86/x86_6... |
1189 |
.section .rodata,"a" |
541054d93 i386: prepare sha... |
1190 |
#include "syscall_table_32.S" |
1da177e4c Linux-2.6.12-rc2 |
1191 1192 |
syscall_table_size=(.-sys_call_table) |
d211af055 i386: get rid of ... |
1193 1194 1195 1196 1197 1198 1199 1200 |
/* * Some functions should be protected against kprobes */ .pushsection .kprobes.text, "ax" ENTRY(page_fault) RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
1201 |
pushl_cfi $do_page_fault |
d211af055 i386: get rid of ... |
1202 1203 |
ALIGN error_code: |
ccbeed3a0 x86: make lazy %g... |
1204 |
/* the function address is in %gs's slot on the stack */ |
df5d1874c x86: Use {push,po... |
1205 |
pushl_cfi %fs |
ccbeed3a0 x86: make lazy %g... |
1206 |
/*CFI_REL_OFFSET fs, 0*/ |
df5d1874c x86: Use {push,po... |
1207 |
pushl_cfi %es |
d211af055 i386: get rid of ... |
1208 |
/*CFI_REL_OFFSET es, 0*/ |
df5d1874c x86: Use {push,po... |
1209 |
pushl_cfi %ds |
d211af055 i386: get rid of ... |
1210 |
/*CFI_REL_OFFSET ds, 0*/ |
df5d1874c x86: Use {push,po... |
1211 |
pushl_cfi %eax |
d211af055 i386: get rid of ... |
1212 |
CFI_REL_OFFSET eax, 0 |
df5d1874c x86: Use {push,po... |
1213 |
pushl_cfi %ebp |
d211af055 i386: get rid of ... |
1214 |
CFI_REL_OFFSET ebp, 0 |
df5d1874c x86: Use {push,po... |
1215 |
pushl_cfi %edi |
d211af055 i386: get rid of ... |
1216 |
CFI_REL_OFFSET edi, 0 |
df5d1874c x86: Use {push,po... |
1217 |
pushl_cfi %esi |
d211af055 i386: get rid of ... |
1218 |
CFI_REL_OFFSET esi, 0 |
df5d1874c x86: Use {push,po... |
1219 |
pushl_cfi %edx |
d211af055 i386: get rid of ... |
1220 |
CFI_REL_OFFSET edx, 0 |
df5d1874c x86: Use {push,po... |
1221 |
pushl_cfi %ecx |
d211af055 i386: get rid of ... |
1222 |
CFI_REL_OFFSET ecx, 0 |
df5d1874c x86: Use {push,po... |
1223 |
pushl_cfi %ebx |
d211af055 i386: get rid of ... |
1224 1225 |
CFI_REL_OFFSET ebx, 0 cld |
d211af055 i386: get rid of ... |
1226 1227 1228 |
movl $(__KERNEL_PERCPU), %ecx movl %ecx, %fs UNWIND_ESPFIX_STACK |
ccbeed3a0 x86: make lazy %g... |
1229 1230 |
GS_TO_REG %ecx movl PT_GS(%esp), %edi # get the function address |
d211af055 i386: get rid of ... |
1231 1232 |
movl PT_ORIG_EAX(%esp), %edx # get the error code movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart |
ccbeed3a0 x86: make lazy %g... |
1233 1234 |
REG_TO_PTGS %ecx SET_KERNEL_GS %ecx |
d211af055 i386: get rid of ... |
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
movl $(__USER_DS), %ecx movl %ecx, %ds movl %ecx, %es TRACE_IRQS_OFF movl %esp,%eax # pt_regs pointer call *%edi jmp ret_from_exception CFI_ENDPROC END(page_fault) /* * Debug traps and NMI can happen at the one SYSENTER instruction * that sets up the real kernel stack. Check here, since we can't * allow the wrong stack to be used. * * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have * already pushed 3 words if it hits on the sysenter instruction: * eflags, cs and eip. * * We just load the right stack, and push the three (known) values * by hand onto the new stack - while updating the return eip past * the instruction that would have done it for sysenter. */ |
f0d96110f x86: use asm .mac... |
1258 1259 1260 1261 1262 1263 1264 |
.macro FIX_STACK offset ok label cmpw $__KERNEL_CS, 4(%esp) jne \ok \label: movl TSS_sysenter_sp0 + \offset(%esp), %esp CFI_DEF_CFA esp, 0 CFI_UNDEFINED eip |
df5d1874c x86: Use {push,po... |
1265 1266 1267 |
pushfl_cfi pushl_cfi $__KERNEL_CS pushl_cfi $sysenter_past_esp |
d211af055 i386: get rid of ... |
1268 |
CFI_REL_OFFSET eip, 0 |
f0d96110f x86: use asm .mac... |
1269 |
.endm |
d211af055 i386: get rid of ... |
1270 1271 1272 1273 1274 |
ENTRY(debug) RING0_INT_FRAME cmpl $ia32_sysenter_target,(%esp) jne debug_stack_correct |
f0d96110f x86: use asm .mac... |
1275 |
FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn |
d211af055 i386: get rid of ... |
1276 |
debug_stack_correct: |
df5d1874c x86: Use {push,po... |
1277 |
pushl_cfi $-1 # mark this as an int |
d211af055 i386: get rid of ... |
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 |
SAVE_ALL TRACE_IRQS_OFF xorl %edx,%edx # error code 0 movl %esp,%eax # pt_regs pointer call do_debug jmp ret_from_exception CFI_ENDPROC END(debug) /* * NMI is doubly nasty. It can happen _while_ we're handling * a debug fault, and the debug fault hasn't yet been able to * clear up the stack. So we first check whether we got an * NMI on the sysenter entry path, but after that we need to * check whether we got an NMI on the debug path where the debug * fault happened on the sysenter path. */ ENTRY(nmi) RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
1297 |
pushl_cfi %eax |
d211af055 i386: get rid of ... |
1298 1299 |
movl %ss, %eax cmpw $__ESPFIX_SS, %ax |
df5d1874c x86: Use {push,po... |
1300 |
popl_cfi %eax |
d211af055 i386: get rid of ... |
1301 1302 1303 |
je nmi_espfix_stack cmpl $ia32_sysenter_target,(%esp) je nmi_stack_fixup |
df5d1874c x86: Use {push,po... |
1304 |
pushl_cfi %eax |
d211af055 i386: get rid of ... |
1305 1306 1307 1308 1309 1310 |
movl %esp,%eax /* Do not access memory above the end of our stack page, * it might not exist. */ andl $(THREAD_SIZE-1),%eax cmpl $(THREAD_SIZE-20),%eax |
df5d1874c x86: Use {push,po... |
1311 |
popl_cfi %eax |
d211af055 i386: get rid of ... |
1312 1313 1314 1315 1316 |
jae nmi_stack_correct cmpl $ia32_sysenter_target,12(%esp) je nmi_debug_stack_check nmi_stack_correct: /* We have a RING0_INT_FRAME here */ |
df5d1874c x86: Use {push,po... |
1317 |
pushl_cfi %eax |
d211af055 i386: get rid of ... |
1318 |
SAVE_ALL |
d211af055 i386: get rid of ... |
1319 1320 1321 |
xorl %edx,%edx # zero error code movl %esp,%eax # pt_regs pointer call do_nmi |
2e04bc765 i386: fix return ... |
1322 |
jmp restore_all_notrace |
d211af055 i386: get rid of ... |
1323 1324 1325 1326 |
CFI_ENDPROC nmi_stack_fixup: RING0_INT_FRAME |
f0d96110f x86: use asm .mac... |
1327 |
FIX_STACK 12, nmi_stack_correct, 1 |
d211af055 i386: get rid of ... |
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 |
jmp nmi_stack_correct nmi_debug_stack_check: /* We have a RING0_INT_FRAME here */ cmpw $__KERNEL_CS,16(%esp) jne nmi_stack_correct cmpl $debug,(%esp) jb nmi_stack_correct cmpl $debug_esp_fix_insn,(%esp) ja nmi_stack_correct |
f0d96110f x86: use asm .mac... |
1338 |
FIX_STACK 24, nmi_stack_correct, 1 |
d211af055 i386: get rid of ... |
1339 1340 1341 1342 1343 1344 1345 |
jmp nmi_stack_correct nmi_espfix_stack: /* We have a RING0_INT_FRAME here. * * create the pointer to lss back */ |
df5d1874c x86: Use {push,po... |
1346 1347 |
pushl_cfi %ss pushl_cfi %esp |
bda3a8974 x86: minor cleanu... |
1348 |
addl $4, (%esp) |
d211af055 i386: get rid of ... |
1349 1350 |
/* copy the iret frame of 12 bytes */ .rept 3 |
df5d1874c x86: Use {push,po... |
1351 |
pushl_cfi 16(%esp) |
d211af055 i386: get rid of ... |
1352 |
.endr |
df5d1874c x86: Use {push,po... |
1353 |
pushl_cfi %eax |
d211af055 i386: get rid of ... |
1354 |
SAVE_ALL |
d211af055 i386: get rid of ... |
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 |
FIXUP_ESPFIX_STACK # %eax == %esp xorl %edx,%edx # zero error code call do_nmi RESTORE_REGS lss 12+4(%esp), %esp # back to espfix stack CFI_ADJUST_CFA_OFFSET -24 jmp irq_return CFI_ENDPROC END(nmi) ENTRY(int3) RING0_INT_FRAME |
df5d1874c x86: Use {push,po... |
1367 |
pushl_cfi $-1 # mark this as an int |
d211af055 i386: get rid of ... |
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 |
SAVE_ALL TRACE_IRQS_OFF xorl %edx,%edx # zero error code movl %esp,%eax # pt_regs pointer call do_int3 jmp ret_from_exception CFI_ENDPROC END(int3) ENTRY(general_protection) RING0_EC_FRAME |
df5d1874c x86: Use {push,po... |
1379 |
pushl_cfi $do_general_protection |
d211af055 i386: get rid of ... |
1380 1381 1382 |
jmp error_code CFI_ENDPROC END(general_protection) |
631bc4878 KVM: Handle async... |
1383 1384 1385 |
#ifdef CONFIG_KVM_GUEST ENTRY(async_page_fault) RING0_EC_FRAME |
60cf637a1 x86: Use {push,po... |
1386 |
pushl_cfi $do_async_page_fault |
631bc4878 KVM: Handle async... |
1387 1388 |
jmp error_code CFI_ENDPROC |
2ae9d293b x86: Fix binutils... |
1389 |
END(async_page_fault) |
631bc4878 KVM: Handle async... |
1390 |
#endif |
d211af055 i386: get rid of ... |
1391 1392 1393 1394 |
/* * End of kprobes section */ .popsection |