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