Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/i386/entry.S |
| 3 | * |
| 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * entry.S contains the system-call and fault low-level handling routines. |
| 9 | * This also contains the timer-interrupt handler, as well as all interrupts |
| 10 | * and faults that can result in a task-switch. |
| 11 | * |
| 12 | * NOTE: This code handles signal-recognition, which happens every time |
| 13 | * after a timer-interrupt and after each system call. |
| 14 | * |
| 15 | * I changed all the .align's to 4 (16 byte alignment), as that's faster |
| 16 | * on a 486. |
| 17 | * |
| 18 | * Stack layout in 'ret_from_system_call': |
| 19 | * ptrace needs to have all regs on the stack. |
| 20 | * if the order here is changed, it needs to be |
| 21 | * updated in fork.c:copy_process, signal.c:do_signal, |
| 22 | * ptrace.c and ptrace.h |
| 23 | * |
| 24 | * 0(%esp) - %ebx |
| 25 | * 4(%esp) - %ecx |
| 26 | * 8(%esp) - %edx |
| 27 | * C(%esp) - %esi |
| 28 | * 10(%esp) - %edi |
| 29 | * 14(%esp) - %ebp |
| 30 | * 18(%esp) - %eax |
| 31 | * 1C(%esp) - %ds |
| 32 | * 20(%esp) - %es |
| 33 | * 24(%esp) - orig_eax |
| 34 | * 28(%esp) - %eip |
| 35 | * 2C(%esp) - %cs |
| 36 | * 30(%esp) - %eflags |
| 37 | * 34(%esp) - %oldesp |
| 38 | * 38(%esp) - %oldss |
| 39 | * |
| 40 | * "current" is in register %ebx during any slow entries. |
| 41 | */ |
| 42 | |
| 43 | #include <linux/config.h> |
| 44 | #include <linux/linkage.h> |
| 45 | #include <asm/thread_info.h> |
| 46 | #include <asm/errno.h> |
| 47 | #include <asm/segment.h> |
| 48 | #include <asm/smp.h> |
| 49 | #include <asm/page.h> |
| 50 | #include <asm/desc.h> |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 51 | #include <asm/dwarf2.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #include "irq_vectors.h" |
| 53 | |
| 54 | #define nr_syscalls ((syscall_table_size)/4) |
| 55 | |
| 56 | EBX = 0x00 |
| 57 | ECX = 0x04 |
| 58 | EDX = 0x08 |
| 59 | ESI = 0x0C |
| 60 | EDI = 0x10 |
| 61 | EBP = 0x14 |
| 62 | EAX = 0x18 |
| 63 | DS = 0x1C |
| 64 | ES = 0x20 |
| 65 | ORIG_EAX = 0x24 |
| 66 | EIP = 0x28 |
| 67 | CS = 0x2C |
| 68 | EFLAGS = 0x30 |
| 69 | OLDESP = 0x34 |
| 70 | OLDSS = 0x38 |
| 71 | |
| 72 | CF_MASK = 0x00000001 |
| 73 | TF_MASK = 0x00000100 |
| 74 | IF_MASK = 0x00000200 |
| 75 | DF_MASK = 0x00000400 |
| 76 | NT_MASK = 0x00004000 |
| 77 | VM_MASK = 0x00020000 |
| 78 | |
| 79 | #ifdef CONFIG_PREEMPT |
| 80 | #define preempt_stop cli |
| 81 | #else |
| 82 | #define preempt_stop |
| 83 | #define resume_kernel restore_nocheck |
| 84 | #endif |
| 85 | |
Aleksey Gorelov | 4031ff3 | 2006-06-27 02:53:48 -0700 | [diff] [blame^] | 86 | #ifdef CONFIG_VM86 |
| 87 | #define resume_userspace_sig check_userspace |
| 88 | #else |
| 89 | #define resume_userspace_sig resume_userspace |
| 90 | #endif |
| 91 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | #define SAVE_ALL \ |
| 93 | cld; \ |
| 94 | pushl %es; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 95 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 96 | /*CFI_REL_OFFSET es, 0;*/\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | pushl %ds; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 98 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 99 | /*CFI_REL_OFFSET ds, 0;*/\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | pushl %eax; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 101 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 102 | CFI_REL_OFFSET eax, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | pushl %ebp; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 104 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 105 | CFI_REL_OFFSET ebp, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | pushl %edi; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 107 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 108 | CFI_REL_OFFSET edi, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | pushl %esi; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 110 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 111 | CFI_REL_OFFSET esi, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | pushl %edx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 113 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 114 | CFI_REL_OFFSET edx, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | pushl %ecx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 116 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 117 | CFI_REL_OFFSET ecx, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | pushl %ebx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 119 | CFI_ADJUST_CFA_OFFSET 4;\ |
| 120 | CFI_REL_OFFSET ebx, 0;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | movl $(__USER_DS), %edx; \ |
| 122 | movl %edx, %ds; \ |
| 123 | movl %edx, %es; |
| 124 | |
| 125 | #define RESTORE_INT_REGS \ |
| 126 | popl %ebx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 127 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 128 | CFI_RESTORE ebx;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | popl %ecx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 130 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 131 | CFI_RESTORE ecx;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | popl %edx; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 133 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 134 | CFI_RESTORE edx;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | popl %esi; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 136 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 137 | CFI_RESTORE esi;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | popl %edi; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 139 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 140 | CFI_RESTORE edi;\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | popl %ebp; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 142 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 143 | CFI_RESTORE ebp;\ |
| 144 | popl %eax; \ |
| 145 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 146 | CFI_RESTORE eax |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
| 148 | #define RESTORE_REGS \ |
| 149 | RESTORE_INT_REGS; \ |
| 150 | 1: popl %ds; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 151 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 152 | /*CFI_RESTORE ds;*/\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | 2: popl %es; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 154 | CFI_ADJUST_CFA_OFFSET -4;\ |
| 155 | /*CFI_RESTORE es;*/\ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | .section .fixup,"ax"; \ |
| 157 | 3: movl $0,(%esp); \ |
| 158 | jmp 1b; \ |
| 159 | 4: movl $0,(%esp); \ |
| 160 | jmp 2b; \ |
| 161 | .previous; \ |
| 162 | .section __ex_table,"a";\ |
| 163 | .align 4; \ |
| 164 | .long 1b,3b; \ |
| 165 | .long 2b,4b; \ |
| 166 | .previous |
| 167 | |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 168 | #define RING0_INT_FRAME \ |
| 169 | CFI_STARTPROC simple;\ |
| 170 | CFI_DEF_CFA esp, 3*4;\ |
| 171 | /*CFI_OFFSET cs, -2*4;*/\ |
| 172 | CFI_OFFSET eip, -3*4 |
| 173 | |
| 174 | #define RING0_EC_FRAME \ |
| 175 | CFI_STARTPROC simple;\ |
| 176 | CFI_DEF_CFA esp, 4*4;\ |
| 177 | /*CFI_OFFSET cs, -2*4;*/\ |
| 178 | CFI_OFFSET eip, -3*4 |
| 179 | |
| 180 | #define RING0_PTREGS_FRAME \ |
| 181 | CFI_STARTPROC simple;\ |
| 182 | CFI_DEF_CFA esp, OLDESP-EBX;\ |
| 183 | /*CFI_OFFSET cs, CS-OLDESP;*/\ |
| 184 | CFI_OFFSET eip, EIP-OLDESP;\ |
| 185 | /*CFI_OFFSET es, ES-OLDESP;*/\ |
| 186 | /*CFI_OFFSET ds, DS-OLDESP;*/\ |
| 187 | CFI_OFFSET eax, EAX-OLDESP;\ |
| 188 | CFI_OFFSET ebp, EBP-OLDESP;\ |
| 189 | CFI_OFFSET edi, EDI-OLDESP;\ |
| 190 | CFI_OFFSET esi, ESI-OLDESP;\ |
| 191 | CFI_OFFSET edx, EDX-OLDESP;\ |
| 192 | CFI_OFFSET ecx, ECX-OLDESP;\ |
| 193 | CFI_OFFSET ebx, EBX-OLDESP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | ENTRY(ret_from_fork) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 196 | CFI_STARTPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 198 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | call schedule_tail |
| 200 | GET_THREAD_INFO(%ebp) |
| 201 | popl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 202 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | jmp syscall_exit |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 204 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | /* |
| 207 | * Return to user mode is not as complex as all this looks, |
| 208 | * but we want the default path for a system call return to |
| 209 | * go as quickly as possible which is why some of this is |
| 210 | * less clear than it otherwise should be. |
| 211 | */ |
| 212 | |
| 213 | # userspace resumption stub bypassing syscall exit tracing |
| 214 | ALIGN |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 215 | RING0_PTREGS_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | ret_from_exception: |
| 217 | preempt_stop |
| 218 | ret_from_intr: |
| 219 | GET_THREAD_INFO(%ebp) |
Aleksey Gorelov | 4031ff3 | 2006-06-27 02:53:48 -0700 | [diff] [blame^] | 220 | check_userspace: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | movl EFLAGS(%esp), %eax # mix EFLAGS and CS |
| 222 | movb CS(%esp), %al |
| 223 | testl $(VM_MASK | 3), %eax |
| 224 | jz resume_kernel |
| 225 | ENTRY(resume_userspace) |
| 226 | cli # make sure we don't miss an interrupt |
| 227 | # setting need_resched or sigpending |
| 228 | # between sampling and the iret |
| 229 | movl TI_flags(%ebp), %ecx |
| 230 | andl $_TIF_WORK_MASK, %ecx # is there any work to be done on |
| 231 | # int/exception return? |
| 232 | jne work_pending |
| 233 | jmp restore_all |
| 234 | |
| 235 | #ifdef CONFIG_PREEMPT |
| 236 | ENTRY(resume_kernel) |
| 237 | cli |
| 238 | cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? |
| 239 | jnz restore_nocheck |
| 240 | need_resched: |
| 241 | movl TI_flags(%ebp), %ecx # need_resched set ? |
| 242 | testb $_TIF_NEED_RESCHED, %cl |
| 243 | jz restore_all |
| 244 | testl $IF_MASK,EFLAGS(%esp) # interrupts off (exception path) ? |
| 245 | jz restore_all |
| 246 | call preempt_schedule_irq |
| 247 | jmp need_resched |
| 248 | #endif |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 249 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | |
| 251 | /* SYSENTER_RETURN points to after the "sysenter" instruction in |
| 252 | the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ |
| 253 | |
| 254 | # sysenter call handler stub |
| 255 | ENTRY(sysenter_entry) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 256 | CFI_STARTPROC simple |
| 257 | CFI_DEF_CFA esp, 0 |
| 258 | CFI_REGISTER esp, ebp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | movl TSS_sysenter_esp0(%esp),%esp |
| 260 | sysenter_past_esp: |
| 261 | sti |
| 262 | pushl $(__USER_DS) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 263 | CFI_ADJUST_CFA_OFFSET 4 |
| 264 | /*CFI_REL_OFFSET ss, 0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | pushl %ebp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 266 | CFI_ADJUST_CFA_OFFSET 4 |
| 267 | CFI_REL_OFFSET esp, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | pushfl |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 269 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | pushl $(__USER_CS) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 271 | CFI_ADJUST_CFA_OFFSET 4 |
| 272 | /*CFI_REL_OFFSET cs, 0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | pushl $SYSENTER_RETURN |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 274 | CFI_ADJUST_CFA_OFFSET 4 |
| 275 | CFI_REL_OFFSET eip, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
| 277 | /* |
| 278 | * Load the potential sixth argument from user stack. |
| 279 | * Careful about security. |
| 280 | */ |
| 281 | cmpl $__PAGE_OFFSET-3,%ebp |
| 282 | jae syscall_fault |
| 283 | 1: movl (%ebp),%ebp |
| 284 | .section __ex_table,"a" |
| 285 | .align 4 |
| 286 | .long 1b,syscall_fault |
| 287 | .previous |
| 288 | |
| 289 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 290 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | SAVE_ALL |
| 292 | GET_THREAD_INFO(%ebp) |
| 293 | |
| 294 | /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */ |
Laurent Vivier | ed75e8d | 2005-09-03 15:57:18 -0700 | [diff] [blame] | 295 | testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | jnz syscall_trace_entry |
| 297 | cmpl $(nr_syscalls), %eax |
| 298 | jae syscall_badsys |
| 299 | call *sys_call_table(,%eax,4) |
| 300 | movl %eax,EAX(%esp) |
| 301 | cli |
| 302 | movl TI_flags(%ebp), %ecx |
| 303 | testw $_TIF_ALLWORK_MASK, %cx |
| 304 | jne syscall_exit_work |
| 305 | /* if something modifies registers it must also disable sysexit */ |
| 306 | movl EIP(%esp), %edx |
| 307 | movl OLDESP(%esp), %ecx |
| 308 | xorl %ebp,%ebp |
| 309 | sti |
| 310 | sysexit |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 311 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
| 313 | |
| 314 | # system call handler stub |
| 315 | ENTRY(system_call) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 316 | RING0_INT_FRAME # can't unwind into user space anyway |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | pushl %eax # save orig_eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 318 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | SAVE_ALL |
| 320 | GET_THREAD_INFO(%ebp) |
Chuck Ebbert | 635cf99 | 2006-03-23 02:59:48 -0800 | [diff] [blame] | 321 | testl $TF_MASK,EFLAGS(%esp) |
| 322 | jz no_singlestep |
| 323 | orl $_TIF_SINGLESTEP,TI_flags(%ebp) |
| 324 | no_singlestep: |
Laurent Vivier | ed75e8d | 2005-09-03 15:57:18 -0700 | [diff] [blame] | 325 | # system call tracing in operation / emulation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */ |
Laurent Vivier | ed75e8d | 2005-09-03 15:57:18 -0700 | [diff] [blame] | 327 | testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | jnz syscall_trace_entry |
| 329 | cmpl $(nr_syscalls), %eax |
| 330 | jae syscall_badsys |
| 331 | syscall_call: |
| 332 | call *sys_call_table(,%eax,4) |
| 333 | movl %eax,EAX(%esp) # store the return value |
| 334 | syscall_exit: |
| 335 | cli # make sure we don't miss an interrupt |
| 336 | # setting need_resched or sigpending |
| 337 | # between sampling and the iret |
| 338 | movl TI_flags(%ebp), %ecx |
| 339 | testw $_TIF_ALLWORK_MASK, %cx # current->work |
| 340 | jne syscall_exit_work |
| 341 | |
| 342 | restore_all: |
| 343 | movl EFLAGS(%esp), %eax # mix EFLAGS, SS and CS |
Stas Sergeev | 5df2408 | 2005-04-16 15:24:01 -0700 | [diff] [blame] | 344 | # Warning: OLDSS(%esp) contains the wrong/random values if we |
| 345 | # are returning to the kernel. |
| 346 | # See comments in process.c:copy_thread() for details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | movb OLDSS(%esp), %ah |
| 348 | movb CS(%esp), %al |
| 349 | andl $(VM_MASK | (4 << 8) | 3), %eax |
| 350 | cmpl $((4 << 8) | 3), %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 351 | CFI_REMEMBER_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | je ldt_ss # returning to user-space with LDT SS |
| 353 | restore_nocheck: |
| 354 | RESTORE_REGS |
| 355 | addl $4, %esp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 356 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | 1: iret |
| 358 | .section .fixup,"ax" |
| 359 | iret_exc: |
| 360 | sti |
Linus Torvalds | a879cbb | 2005-04-29 09:38:44 -0700 | [diff] [blame] | 361 | pushl $0 # no error code |
| 362 | pushl $do_iret_error |
| 363 | jmp error_code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | .previous |
| 365 | .section __ex_table,"a" |
| 366 | .align 4 |
| 367 | .long 1b,iret_exc |
| 368 | .previous |
| 369 | |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 370 | CFI_RESTORE_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | ldt_ss: |
| 372 | larl OLDSS(%esp), %eax |
| 373 | jnz restore_nocheck |
| 374 | testl $0x00400000, %eax # returning to 32bit stack? |
| 375 | jnz restore_nocheck # allright, normal return |
| 376 | /* If returning to userspace with 16bit stack, |
| 377 | * try to fix the higher word of ESP, as the CPU |
| 378 | * won't restore it. |
| 379 | * This is an "official" bug of all the x86-compatible |
| 380 | * CPUs, which we can try to work around to make |
| 381 | * dosemu and wine happy. */ |
| 382 | subl $8, %esp # reserve space for switch16 pointer |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 383 | CFI_ADJUST_CFA_OFFSET 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | cli |
| 385 | movl %esp, %eax |
| 386 | /* Set up the 16bit stack frame with switch32 pointer on top, |
| 387 | * and a switch16 pointer on top of the current frame. */ |
| 388 | call setup_x86_bogus_stack |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 389 | CFI_ADJUST_CFA_OFFSET -8 # frame has moved |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | RESTORE_REGS |
| 391 | lss 20+4(%esp), %esp # switch to 16bit stack |
| 392 | 1: iret |
| 393 | .section __ex_table,"a" |
| 394 | .align 4 |
| 395 | .long 1b,iret_exc |
| 396 | .previous |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 397 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | |
| 399 | # perform work that needs to be done immediately before resumption |
| 400 | ALIGN |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 401 | RING0_PTREGS_FRAME # can't unwind into user space anyway |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | work_pending: |
| 403 | testb $_TIF_NEED_RESCHED, %cl |
| 404 | jz work_notifysig |
| 405 | work_resched: |
| 406 | call schedule |
| 407 | cli # make sure we don't miss an interrupt |
| 408 | # setting need_resched or sigpending |
| 409 | # between sampling and the iret |
| 410 | movl TI_flags(%ebp), %ecx |
| 411 | andl $_TIF_WORK_MASK, %ecx # is there any work to be done other |
| 412 | # than syscall tracing? |
| 413 | jz restore_all |
| 414 | testb $_TIF_NEED_RESCHED, %cl |
| 415 | jnz work_resched |
| 416 | |
| 417 | work_notifysig: # deal with pending signals and |
| 418 | # notify-resume requests |
| 419 | testl $VM_MASK, EFLAGS(%esp) |
| 420 | movl %esp, %eax |
| 421 | jne work_notifysig_v86 # returning to kernel-space or |
| 422 | # vm86-space |
| 423 | xorl %edx, %edx |
| 424 | call do_notify_resume |
Aleksey Gorelov | 4031ff3 | 2006-06-27 02:53:48 -0700 | [diff] [blame^] | 425 | jmp resume_userspace_sig |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | |
| 427 | ALIGN |
| 428 | work_notifysig_v86: |
Matt Mackall | 64ca900 | 2006-01-08 01:05:26 -0800 | [diff] [blame] | 429 | #ifdef CONFIG_VM86 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | pushl %ecx # save ti_flags for do_notify_resume |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 431 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | call save_v86_state # %eax contains pt_regs pointer |
| 433 | popl %ecx |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 434 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | movl %eax, %esp |
| 436 | xorl %edx, %edx |
| 437 | call do_notify_resume |
Aleksey Gorelov | 4031ff3 | 2006-06-27 02:53:48 -0700 | [diff] [blame^] | 438 | jmp resume_userspace_sig |
Matt Mackall | 64ca900 | 2006-01-08 01:05:26 -0800 | [diff] [blame] | 439 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | |
| 441 | # perform syscall exit tracing |
| 442 | ALIGN |
| 443 | syscall_trace_entry: |
| 444 | movl $-ENOSYS,EAX(%esp) |
| 445 | movl %esp, %eax |
| 446 | xorl %edx,%edx |
| 447 | call do_syscall_trace |
Laurent Vivier | ed75e8d | 2005-09-03 15:57:18 -0700 | [diff] [blame] | 448 | cmpl $0, %eax |
Paolo 'Blaisorblade' Giarrusso | 640aa46 | 2005-09-03 15:57:22 -0700 | [diff] [blame] | 449 | jne resume_userspace # ret != 0 -> running under PTRACE_SYSEMU, |
Laurent Vivier | ed75e8d | 2005-09-03 15:57:18 -0700 | [diff] [blame] | 450 | # so must skip actual syscall |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | movl ORIG_EAX(%esp), %eax |
| 452 | cmpl $(nr_syscalls), %eax |
| 453 | jnae syscall_call |
| 454 | jmp syscall_exit |
| 455 | |
| 456 | # perform syscall exit tracing |
| 457 | ALIGN |
| 458 | syscall_exit_work: |
| 459 | testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl |
| 460 | jz work_pending |
| 461 | sti # could let do_syscall_trace() call |
| 462 | # schedule() instead |
| 463 | movl %esp, %eax |
| 464 | movl $1, %edx |
| 465 | call do_syscall_trace |
| 466 | jmp resume_userspace |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 467 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 469 | RING0_INT_FRAME # can't unwind into user space anyway |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | syscall_fault: |
| 471 | pushl %eax # save orig_eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 472 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | SAVE_ALL |
| 474 | GET_THREAD_INFO(%ebp) |
| 475 | movl $-EFAULT,EAX(%esp) |
| 476 | jmp resume_userspace |
| 477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | syscall_badsys: |
| 479 | movl $-ENOSYS,EAX(%esp) |
| 480 | jmp resume_userspace |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 481 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | |
| 483 | #define FIXUP_ESPFIX_STACK \ |
| 484 | movl %esp, %eax; \ |
| 485 | /* switch to 32bit stack using the pointer on top of 16bit stack */ \ |
| 486 | lss %ss:CPU_16BIT_STACK_SIZE-8, %esp; \ |
| 487 | /* copy data from 16bit stack to 32bit stack */ \ |
| 488 | call fixup_x86_bogus_stack; \ |
| 489 | /* put ESP to the proper location */ \ |
| 490 | movl %eax, %esp; |
| 491 | #define UNWIND_ESPFIX_STACK \ |
| 492 | pushl %eax; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 493 | CFI_ADJUST_CFA_OFFSET 4; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | movl %ss, %eax; \ |
| 495 | /* see if on 16bit stack */ \ |
| 496 | cmpw $__ESPFIX_SS, %ax; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 497 | je 28f; \ |
| 498 | 27: popl %eax; \ |
| 499 | CFI_ADJUST_CFA_OFFSET -4; \ |
| 500 | .section .fixup,"ax"; \ |
| 501 | 28: movl $__KERNEL_DS, %eax; \ |
| 502 | movl %eax, %ds; \ |
| 503 | movl %eax, %es; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | /* switch to 32bit stack */ \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 505 | FIXUP_ESPFIX_STACK; \ |
| 506 | jmp 27b; \ |
| 507 | .previous |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
| 509 | /* |
| 510 | * Build the entry stubs and pointer table with |
| 511 | * some assembler magic. |
| 512 | */ |
| 513 | .data |
| 514 | ENTRY(interrupt) |
| 515 | .text |
| 516 | |
| 517 | vector=0 |
| 518 | ENTRY(irq_entries_start) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 519 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | .rept NR_IRQS |
| 521 | ALIGN |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 522 | .if vector |
| 523 | CFI_ADJUST_CFA_OFFSET -4 |
| 524 | .endif |
Rusty Russell | 19eadf9 | 2006-06-27 02:53:44 -0700 | [diff] [blame] | 525 | 1: pushl $~(vector) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 526 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | jmp common_interrupt |
| 528 | .data |
| 529 | .long 1b |
| 530 | .text |
| 531 | vector=vector+1 |
| 532 | .endr |
| 533 | |
| 534 | ALIGN |
| 535 | common_interrupt: |
| 536 | SAVE_ALL |
| 537 | movl %esp,%eax |
| 538 | call do_IRQ |
| 539 | jmp ret_from_intr |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 540 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | |
| 542 | #define BUILD_INTERRUPT(name, nr) \ |
| 543 | ENTRY(name) \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 544 | RING0_INT_FRAME; \ |
Rusty Russell | 19eadf9 | 2006-06-27 02:53:44 -0700 | [diff] [blame] | 545 | pushl $~(nr); \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 546 | CFI_ADJUST_CFA_OFFSET 4; \ |
| 547 | SAVE_ALL; \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | movl %esp,%eax; \ |
| 549 | call smp_/**/name; \ |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 550 | jmp ret_from_intr; \ |
| 551 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | |
| 553 | /* The include is where all of the SMP etc. interrupts come from */ |
| 554 | #include "entry_arch.h" |
| 555 | |
| 556 | ENTRY(divide_error) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 557 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | pushl $0 # no error code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 559 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | pushl $do_divide_error |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 561 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | ALIGN |
| 563 | error_code: |
| 564 | pushl %ds |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 565 | CFI_ADJUST_CFA_OFFSET 4 |
| 566 | /*CFI_REL_OFFSET ds, 0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 568 | CFI_ADJUST_CFA_OFFSET 4 |
| 569 | CFI_REL_OFFSET eax, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | xorl %eax, %eax |
| 571 | pushl %ebp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 572 | CFI_ADJUST_CFA_OFFSET 4 |
| 573 | CFI_REL_OFFSET ebp, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | pushl %edi |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 575 | CFI_ADJUST_CFA_OFFSET 4 |
| 576 | CFI_REL_OFFSET edi, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | pushl %esi |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 578 | CFI_ADJUST_CFA_OFFSET 4 |
| 579 | CFI_REL_OFFSET esi, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | pushl %edx |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 581 | CFI_ADJUST_CFA_OFFSET 4 |
| 582 | CFI_REL_OFFSET edx, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | decl %eax # eax = -1 |
| 584 | pushl %ecx |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 585 | CFI_ADJUST_CFA_OFFSET 4 |
| 586 | CFI_REL_OFFSET ecx, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 587 | pushl %ebx |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 588 | CFI_ADJUST_CFA_OFFSET 4 |
| 589 | CFI_REL_OFFSET ebx, 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | cld |
| 591 | pushl %es |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 592 | CFI_ADJUST_CFA_OFFSET 4 |
| 593 | /*CFI_REL_OFFSET es, 0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 594 | UNWIND_ESPFIX_STACK |
| 595 | popl %ecx |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 596 | CFI_ADJUST_CFA_OFFSET -4 |
| 597 | /*CFI_REGISTER es, ecx*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | movl ES(%esp), %edi # get the function address |
| 599 | movl ORIG_EAX(%esp), %edx # get the error code |
| 600 | movl %eax, ORIG_EAX(%esp) |
| 601 | movl %ecx, ES(%esp) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 602 | /*CFI_REL_OFFSET es, ES*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | movl $(__USER_DS), %ecx |
| 604 | movl %ecx, %ds |
| 605 | movl %ecx, %es |
| 606 | movl %esp,%eax # pt_regs pointer |
| 607 | call *%edi |
| 608 | jmp ret_from_exception |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 609 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 610 | |
| 611 | ENTRY(coprocessor_error) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 612 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 614 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | pushl $do_coprocessor_error |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 616 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 618 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | |
| 620 | ENTRY(simd_coprocessor_error) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 621 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 622 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 623 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 624 | pushl $do_simd_coprocessor_error |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 625 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 627 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | |
| 629 | ENTRY(device_not_available) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 630 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | pushl $-1 # mark this as an int |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 632 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | SAVE_ALL |
| 634 | movl %cr0, %eax |
| 635 | testl $0x4, %eax # EM (math emulation bit) |
| 636 | jne device_not_available_emulate |
| 637 | preempt_stop |
| 638 | call math_state_restore |
| 639 | jmp ret_from_exception |
| 640 | device_not_available_emulate: |
| 641 | pushl $0 # temporary storage for ORIG_EIP |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 642 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | call math_emulate |
| 644 | addl $4, %esp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 645 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | jmp ret_from_exception |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 647 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | |
| 649 | /* |
| 650 | * Debug traps and NMI can happen at the one SYSENTER instruction |
| 651 | * that sets up the real kernel stack. Check here, since we can't |
| 652 | * allow the wrong stack to be used. |
| 653 | * |
| 654 | * "TSS_sysenter_esp0+12" is because the NMI/debug handler will have |
| 655 | * already pushed 3 words if it hits on the sysenter instruction: |
| 656 | * eflags, cs and eip. |
| 657 | * |
| 658 | * We just load the right stack, and push the three (known) values |
| 659 | * by hand onto the new stack - while updating the return eip past |
| 660 | * the instruction that would have done it for sysenter. |
| 661 | */ |
| 662 | #define FIX_STACK(offset, ok, label) \ |
| 663 | cmpw $__KERNEL_CS,4(%esp); \ |
| 664 | jne ok; \ |
| 665 | label: \ |
| 666 | movl TSS_sysenter_esp0+offset(%esp),%esp; \ |
| 667 | pushfl; \ |
| 668 | pushl $__KERNEL_CS; \ |
| 669 | pushl $sysenter_past_esp |
| 670 | |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 671 | KPROBE_ENTRY(debug) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 672 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 673 | cmpl $sysenter_entry,(%esp) |
| 674 | jne debug_stack_correct |
| 675 | FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn) |
| 676 | debug_stack_correct: |
| 677 | pushl $-1 # mark this as an int |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 678 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | SAVE_ALL |
| 680 | xorl %edx,%edx # error code 0 |
| 681 | movl %esp,%eax # pt_regs pointer |
| 682 | call do_debug |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | jmp ret_from_exception |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 684 | CFI_ENDPROC |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 685 | .previous .text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | /* |
| 687 | * NMI is doubly nasty. It can happen _while_ we're handling |
| 688 | * a debug fault, and the debug fault hasn't yet been able to |
| 689 | * clear up the stack. So we first check whether we got an |
| 690 | * NMI on the sysenter entry path, but after that we need to |
| 691 | * check whether we got an NMI on the debug path where the debug |
| 692 | * fault happened on the sysenter path. |
| 693 | */ |
| 694 | ENTRY(nmi) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 695 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 697 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | movl %ss, %eax |
| 699 | cmpw $__ESPFIX_SS, %ax |
| 700 | popl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 701 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | je nmi_16bit_stack |
| 703 | cmpl $sysenter_entry,(%esp) |
| 704 | je nmi_stack_fixup |
| 705 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 706 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | movl %esp,%eax |
| 708 | /* Do not access memory above the end of our stack page, |
| 709 | * it might not exist. |
| 710 | */ |
| 711 | andl $(THREAD_SIZE-1),%eax |
| 712 | cmpl $(THREAD_SIZE-20),%eax |
| 713 | popl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 714 | CFI_ADJUST_CFA_OFFSET -4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | jae nmi_stack_correct |
| 716 | cmpl $sysenter_entry,12(%esp) |
| 717 | je nmi_debug_stack_check |
| 718 | nmi_stack_correct: |
| 719 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 720 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | SAVE_ALL |
| 722 | xorl %edx,%edx # zero error code |
| 723 | movl %esp,%eax # pt_regs pointer |
| 724 | call do_nmi |
| 725 | jmp restore_all |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 726 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | |
| 728 | nmi_stack_fixup: |
| 729 | FIX_STACK(12,nmi_stack_correct, 1) |
| 730 | jmp nmi_stack_correct |
| 731 | nmi_debug_stack_check: |
| 732 | cmpw $__KERNEL_CS,16(%esp) |
| 733 | jne nmi_stack_correct |
Jan Beulich | e271820 | 2005-11-13 16:06:52 -0800 | [diff] [blame] | 734 | cmpl $debug,(%esp) |
| 735 | jb nmi_stack_correct |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | cmpl $debug_esp_fix_insn,(%esp) |
Jan Beulich | e271820 | 2005-11-13 16:06:52 -0800 | [diff] [blame] | 737 | ja nmi_stack_correct |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 738 | FIX_STACK(24,nmi_stack_correct, 1) |
| 739 | jmp nmi_stack_correct |
| 740 | |
| 741 | nmi_16bit_stack: |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 742 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 743 | /* create the pointer to lss back */ |
| 744 | pushl %ss |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 745 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | pushl %esp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 747 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | movzwl %sp, %esp |
| 749 | addw $4, (%esp) |
| 750 | /* copy the iret frame of 12 bytes */ |
| 751 | .rept 3 |
| 752 | pushl 16(%esp) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 753 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 754 | .endr |
| 755 | pushl %eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 756 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 757 | SAVE_ALL |
| 758 | FIXUP_ESPFIX_STACK # %eax == %esp |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 759 | CFI_ADJUST_CFA_OFFSET -20 # the frame has now moved |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 760 | xorl %edx,%edx # zero error code |
| 761 | call do_nmi |
| 762 | RESTORE_REGS |
| 763 | lss 12+4(%esp), %esp # back to 16bit stack |
| 764 | 1: iret |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 765 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 766 | .section __ex_table,"a" |
| 767 | .align 4 |
| 768 | .long 1b,iret_exc |
| 769 | .previous |
| 770 | |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 771 | KPROBE_ENTRY(int3) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 772 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | pushl $-1 # mark this as an int |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 774 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | SAVE_ALL |
| 776 | xorl %edx,%edx # zero error code |
| 777 | movl %esp,%eax # pt_regs pointer |
| 778 | call do_int3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | jmp ret_from_exception |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 780 | CFI_ENDPROC |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 781 | .previous .text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 782 | |
| 783 | ENTRY(overflow) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 784 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 785 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 786 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | pushl $do_overflow |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 788 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 789 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 790 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 791 | |
| 792 | ENTRY(bounds) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 793 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 795 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 796 | pushl $do_bounds |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 797 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 798 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 799 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | |
| 801 | ENTRY(invalid_op) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 802 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 803 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 804 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 805 | pushl $do_invalid_op |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 806 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 808 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 809 | |
| 810 | ENTRY(coprocessor_segment_overrun) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 811 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 812 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 813 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 814 | pushl $do_coprocessor_segment_overrun |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 815 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 817 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 818 | |
| 819 | ENTRY(invalid_TSS) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 820 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 821 | pushl $do_invalid_TSS |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 822 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 823 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 824 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 825 | |
| 826 | ENTRY(segment_not_present) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 827 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 828 | pushl $do_segment_not_present |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 829 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 830 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 831 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 832 | |
| 833 | ENTRY(stack_segment) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 834 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 835 | pushl $do_stack_segment |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 836 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 837 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 838 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 839 | |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 840 | KPROBE_ENTRY(general_protection) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 841 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 842 | pushl $do_general_protection |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 843 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 844 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 845 | CFI_ENDPROC |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 846 | .previous .text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 847 | |
| 848 | ENTRY(alignment_check) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 849 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 850 | pushl $do_alignment_check |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 851 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 852 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 853 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 854 | |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 855 | KPROBE_ENTRY(page_fault) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 856 | RING0_EC_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 857 | pushl $do_page_fault |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 858 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 859 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 860 | CFI_ENDPROC |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 861 | .previous .text |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 862 | |
| 863 | #ifdef CONFIG_X86_MCE |
| 864 | ENTRY(machine_check) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 865 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 866 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 867 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 868 | pushl machine_check_vector |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 869 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 871 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | #endif |
| 873 | |
| 874 | ENTRY(spurious_interrupt_bug) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 875 | RING0_INT_FRAME |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 876 | pushl $0 |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 877 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 878 | pushl $do_spurious_interrupt_bug |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 879 | CFI_ADJUST_CFA_OFFSET 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 880 | jmp error_code |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 881 | CFI_ENDPROC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 882 | |
Jan Beulich | 176a271 | 2006-06-26 13:57:41 +0200 | [diff] [blame] | 883 | #ifdef CONFIG_STACK_UNWIND |
| 884 | ENTRY(arch_unwind_init_running) |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 885 | CFI_STARTPROC |
Jan Beulich | 176a271 | 2006-06-26 13:57:41 +0200 | [diff] [blame] | 886 | movl 4(%esp), %edx |
| 887 | movl (%esp), %ecx |
| 888 | leal 4(%esp), %eax |
| 889 | movl %ebx, EBX(%edx) |
| 890 | xorl %ebx, %ebx |
| 891 | movl %ebx, ECX(%edx) |
| 892 | movl %ebx, EDX(%edx) |
| 893 | movl %esi, ESI(%edx) |
| 894 | movl %edi, EDI(%edx) |
| 895 | movl %ebp, EBP(%edx) |
| 896 | movl %ebx, EAX(%edx) |
| 897 | movl $__USER_DS, DS(%edx) |
| 898 | movl $__USER_DS, ES(%edx) |
| 899 | movl %ebx, ORIG_EAX(%edx) |
| 900 | movl %ecx, EIP(%edx) |
| 901 | movl 12(%esp), %ecx |
| 902 | movl $__KERNEL_CS, CS(%edx) |
| 903 | movl %ebx, EFLAGS(%edx) |
| 904 | movl %eax, OLDESP(%edx) |
| 905 | movl 8(%esp), %eax |
| 906 | movl %ecx, 8(%esp) |
| 907 | movl EBX(%edx), %ebx |
| 908 | movl $__KERNEL_DS, OLDSS(%edx) |
| 909 | jmpl *%eax |
Jan Beulich | fe7cacc | 2006-06-26 13:57:44 +0200 | [diff] [blame] | 910 | CFI_ENDPROC |
Jan Beulich | 176a271 | 2006-06-26 13:57:41 +0200 | [diff] [blame] | 911 | ENDPROC(arch_unwind_init_running) |
| 912 | #endif |
| 913 | |
Arjan van de Ven | bb152f5 | 2006-01-06 00:12:05 -0800 | [diff] [blame] | 914 | .section .rodata,"a" |
Paolo 'Blaisorblade' Giarrusso | 5e7b83f | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 915 | #include "syscall_table.S" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 916 | |
| 917 | syscall_table_size=(.-sys_call_table) |