Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'x86/asm' into x86/core, to prepare for new patch

Collect all changes to arch/x86/entry/entry_64.S, before applying
patch that changes most of the file.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+2120 -2818
+2 -2
Documentation/x86/entry_64.txt
··· 18 18 19 19 - system_call: syscall instruction from 64-bit code. 20 20 21 - - ia32_syscall: int 0x80 from 32-bit or 64-bit code; compat syscall 21 + - entry_INT80_compat: int 0x80 from 32-bit or 64-bit code; compat syscall 22 22 either way. 23 23 24 - - ia32_syscall, ia32_sysenter: syscall and sysenter from 32-bit 24 + - entry_INT80_compat, ia32_sysenter: syscall and sysenter from 32-bit 25 25 code 26 26 27 27 - interrupt: An array of entries. Every IDT vector that doesn't
+1 -1
MAINTAINERS
··· 10893 10893 L: linux-kernel@vger.kernel.org 10894 10894 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/vdso 10895 10895 S: Maintained 10896 - F: arch/x86/vdso/ 10896 + F: arch/x86/entry/vdso/ 10897 10897 10898 10898 XC2028/3028 TUNER DRIVER 10899 10899 M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
+4 -1
arch/x86/Kbuild
··· 1 + 2 + obj-y += entry/ 3 + 1 4 obj-$(CONFIG_KVM) += kvm/ 2 5 3 6 # Xen paravirtualization support ··· 14 11 obj-y += mm/ 15 12 16 13 obj-y += crypto/ 17 - obj-y += vdso/ 14 + 18 15 obj-$(CONFIG_IA32_EMULATION) += ia32/ 19 16 20 17 obj-y += platform/
+4 -10
arch/x86/Makefile
··· 149 149 sp-$(CONFIG_X86_32) := esp 150 150 sp-$(CONFIG_X86_64) := rsp 151 151 152 - # do binutils support CFI? 153 - cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) 154 - # is .cfi_signal_frame supported too? 155 - cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) 156 - cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) 157 - 158 152 # does binutils support specific instructions? 159 153 asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) 160 154 asinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1) ··· 156 162 avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) 157 163 avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) 158 164 159 - KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) 160 - KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) 165 + KBUILD_AFLAGS += $(asinstr) $(avx_instr) $(avx2_instr) 166 + KBUILD_CFLAGS += $(asinstr) $(avx_instr) $(avx2_instr) 161 167 162 168 LDFLAGS := -m elf_$(UTS_MACHINE) 163 169 ··· 181 187 # Syscall table generation 182 188 183 189 archheaders: 184 - $(Q)$(MAKE) $(build)=arch/x86/syscalls all 190 + $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all 185 191 186 192 archprepare: 187 193 ifeq ($(CONFIG_KEXEC_FILE),y) ··· 244 250 245 251 PHONY += vdso_install 246 252 vdso_install: 247 - $(Q)$(MAKE) $(build)=arch/x86/vdso $@ 253 + $(Q)$(MAKE) $(build)=arch/x86/entry/vdso $@ 248 254 249 255 archclean: 250 256 $(Q)rm -rf $(objtree)/arch/i386
+10
arch/x86/entry/Makefile
··· 1 + # 2 + # Makefile for the x86 low level entry code 3 + # 4 + obj-y := entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o 5 + 6 + obj-y += vdso/ 7 + obj-y += vsyscall/ 8 + 9 + obj-$(CONFIG_IA32_EMULATION) += entry_64_compat.o syscall_32.o 10 +
+1248
arch/x86/entry/entry_32.S
··· 1 + /* 2 + * Copyright (C) 1991,1992 Linus Torvalds 3 + * 4 + * entry_32.S contains the system-call and low-level fault and trap handling routines. 5 + * 6 + * Stack layout in 'syscall_exit': 7 + * ptrace needs to have all registers on the stack. 8 + * If the order here is changed, it needs to be 9 + * updated in fork.c:copy_process(), signal.c:do_signal(), 10 + * ptrace.c and ptrace.h 11 + * 12 + * 0(%esp) - %ebx 13 + * 4(%esp) - %ecx 14 + * 8(%esp) - %edx 15 + * C(%esp) - %esi 16 + * 10(%esp) - %edi 17 + * 14(%esp) - %ebp 18 + * 18(%esp) - %eax 19 + * 1C(%esp) - %ds 20 + * 20(%esp) - %es 21 + * 24(%esp) - %fs 22 + * 28(%esp) - %gs saved iff !CONFIG_X86_32_LAZY_GS 23 + * 2C(%esp) - orig_eax 24 + * 30(%esp) - %eip 25 + * 34(%esp) - %cs 26 + * 38(%esp) - %eflags 27 + * 3C(%esp) - %oldesp 28 + * 40(%esp) - %oldss 29 + */ 30 + 31 + #include <linux/linkage.h> 32 + #include <linux/err.h> 33 + #include <asm/thread_info.h> 34 + #include <asm/irqflags.h> 35 + #include <asm/errno.h> 36 + #include <asm/segment.h> 37 + #include <asm/smp.h> 38 + #include <asm/page_types.h> 39 + #include <asm/percpu.h> 40 + #include <asm/processor-flags.h> 41 + #include <asm/ftrace.h> 42 + #include <asm/irq_vectors.h> 43 + #include <asm/cpufeature.h> 44 + #include <asm/alternative-asm.h> 45 + #include <asm/asm.h> 46 + #include <asm/smap.h> 47 + 48 + /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 49 + #include <linux/elf-em.h> 50 + #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 51 + #define __AUDIT_ARCH_LE 0x40000000 52 + 53 + #ifndef CONFIG_AUDITSYSCALL 54 + # define sysenter_audit syscall_trace_entry 55 + # define sysexit_audit syscall_exit_work 56 + #endif 57 + 58 + .section .entry.text, "ax" 59 + 60 + /* 61 + * We use macros for low-level operations which need to be overridden 62 + * for paravirtualization. The following will never clobber any registers: 63 + * INTERRUPT_RETURN (aka. "iret") 64 + * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax") 65 + * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit"). 66 + * 67 + * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must 68 + * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY). 69 + * Allowing a register to be clobbered can shrink the paravirt replacement 70 + * enough to patch inline, increasing performance. 71 + */ 72 + 73 + #ifdef CONFIG_PREEMPT 74 + # define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF 75 + #else 76 + # define preempt_stop(clobbers) 77 + # define resume_kernel restore_all 78 + #endif 79 + 80 + .macro TRACE_IRQS_IRET 81 + #ifdef CONFIG_TRACE_IRQFLAGS 82 + testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off? 83 + jz 1f 84 + TRACE_IRQS_ON 85 + 1: 86 + #endif 87 + .endm 88 + 89 + /* 90 + * User gs save/restore 91 + * 92 + * %gs is used for userland TLS and kernel only uses it for stack 93 + * canary which is required to be at %gs:20 by gcc. Read the comment 94 + * at the top of stackprotector.h for more info. 95 + * 96 + * Local labels 98 and 99 are used. 97 + */ 98 + #ifdef CONFIG_X86_32_LAZY_GS 99 + 100 + /* unfortunately push/pop can't be no-op */ 101 + .macro PUSH_GS 102 + pushl $0 103 + .endm 104 + .macro POP_GS pop=0 105 + addl $(4 + \pop), %esp 106 + .endm 107 + .macro POP_GS_EX 108 + .endm 109 + 110 + /* all the rest are no-op */ 111 + .macro PTGS_TO_GS 112 + .endm 113 + .macro PTGS_TO_GS_EX 114 + .endm 115 + .macro GS_TO_REG reg 116 + .endm 117 + .macro REG_TO_PTGS reg 118 + .endm 119 + .macro SET_KERNEL_GS reg 120 + .endm 121 + 122 + #else /* CONFIG_X86_32_LAZY_GS */ 123 + 124 + .macro PUSH_GS 125 + pushl %gs 126 + .endm 127 + 128 + .macro POP_GS pop=0 129 + 98: popl %gs 130 + .if \pop <> 0 131 + add $\pop, %esp 132 + .endif 133 + .endm 134 + .macro POP_GS_EX 135 + .pushsection .fixup, "ax" 136 + 99: movl $0, (%esp) 137 + jmp 98b 138 + .popsection 139 + _ASM_EXTABLE(98b, 99b) 140 + .endm 141 + 142 + .macro PTGS_TO_GS 143 + 98: mov PT_GS(%esp), %gs 144 + .endm 145 + .macro PTGS_TO_GS_EX 146 + .pushsection .fixup, "ax" 147 + 99: movl $0, PT_GS(%esp) 148 + jmp 98b 149 + .popsection 150 + _ASM_EXTABLE(98b, 99b) 151 + .endm 152 + 153 + .macro GS_TO_REG reg 154 + movl %gs, \reg 155 + .endm 156 + .macro REG_TO_PTGS reg 157 + movl \reg, PT_GS(%esp) 158 + .endm 159 + .macro SET_KERNEL_GS reg 160 + movl $(__KERNEL_STACK_CANARY), \reg 161 + movl \reg, %gs 162 + .endm 163 + 164 + #endif /* CONFIG_X86_32_LAZY_GS */ 165 + 166 + .macro SAVE_ALL 167 + cld 168 + PUSH_GS 169 + pushl %fs 170 + pushl %es 171 + pushl %ds 172 + pushl %eax 173 + pushl %ebp 174 + pushl %edi 175 + pushl %esi 176 + pushl %edx 177 + pushl %ecx 178 + pushl %ebx 179 + movl $(__USER_DS), %edx 180 + movl %edx, %ds 181 + movl %edx, %es 182 + movl $(__KERNEL_PERCPU), %edx 183 + movl %edx, %fs 184 + SET_KERNEL_GS %edx 185 + .endm 186 + 187 + .macro RESTORE_INT_REGS 188 + popl %ebx 189 + popl %ecx 190 + popl %edx 191 + popl %esi 192 + popl %edi 193 + popl %ebp 194 + popl %eax 195 + .endm 196 + 197 + .macro RESTORE_REGS pop=0 198 + RESTORE_INT_REGS 199 + 1: popl %ds 200 + 2: popl %es 201 + 3: popl %fs 202 + POP_GS \pop 203 + .pushsection .fixup, "ax" 204 + 4: movl $0, (%esp) 205 + jmp 1b 206 + 5: movl $0, (%esp) 207 + jmp 2b 208 + 6: movl $0, (%esp) 209 + jmp 3b 210 + .popsection 211 + _ASM_EXTABLE(1b, 4b) 212 + _ASM_EXTABLE(2b, 5b) 213 + _ASM_EXTABLE(3b, 6b) 214 + POP_GS_EX 215 + .endm 216 + 217 + ENTRY(ret_from_fork) 218 + pushl %eax 219 + call schedule_tail 220 + GET_THREAD_INFO(%ebp) 221 + popl %eax 222 + pushl $0x0202 # Reset kernel eflags 223 + popfl 224 + jmp syscall_exit 225 + END(ret_from_fork) 226 + 227 + ENTRY(ret_from_kernel_thread) 228 + pushl %eax 229 + call schedule_tail 230 + GET_THREAD_INFO(%ebp) 231 + popl %eax 232 + pushl $0x0202 # Reset kernel eflags 233 + popfl 234 + movl PT_EBP(%esp), %eax 235 + call *PT_EBX(%esp) 236 + movl $0, PT_EAX(%esp) 237 + jmp syscall_exit 238 + ENDPROC(ret_from_kernel_thread) 239 + 240 + /* 241 + * Return to user mode is not as complex as all this looks, 242 + * but we want the default path for a system call return to 243 + * go as quickly as possible which is why some of this is 244 + * less clear than it otherwise should be. 245 + */ 246 + 247 + # userspace resumption stub bypassing syscall exit tracing 248 + ALIGN 249 + ret_from_exception: 250 + preempt_stop(CLBR_ANY) 251 + ret_from_intr: 252 + GET_THREAD_INFO(%ebp) 253 + #ifdef CONFIG_VM86 254 + movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS 255 + movb PT_CS(%esp), %al 256 + andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax 257 + #else 258 + /* 259 + * We can be coming here from child spawned by kernel_thread(). 260 + */ 261 + movl PT_CS(%esp), %eax 262 + andl $SEGMENT_RPL_MASK, %eax 263 + #endif 264 + cmpl $USER_RPL, %eax 265 + jb resume_kernel # not returning to v8086 or userspace 266 + 267 + ENTRY(resume_userspace) 268 + LOCKDEP_SYS_EXIT 269 + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 270 + # setting need_resched or sigpending 271 + # between sampling and the iret 272 + TRACE_IRQS_OFF 273 + movl TI_flags(%ebp), %ecx 274 + andl $_TIF_WORK_MASK, %ecx # is there any work to be done on 275 + # int/exception return? 276 + jne work_pending 277 + jmp restore_all 278 + END(ret_from_exception) 279 + 280 + #ifdef CONFIG_PREEMPT 281 + ENTRY(resume_kernel) 282 + DISABLE_INTERRUPTS(CLBR_ANY) 283 + need_resched: 284 + cmpl $0, PER_CPU_VAR(__preempt_count) 285 + jnz restore_all 286 + testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? 287 + jz restore_all 288 + call preempt_schedule_irq 289 + jmp need_resched 290 + END(resume_kernel) 291 + #endif 292 + 293 + /* 294 + * SYSENTER_RETURN points to after the SYSENTER instruction 295 + * in the vsyscall page. See vsyscall-sysentry.S, which defines 296 + * the symbol. 297 + */ 298 + 299 + # SYSENTER call handler stub 300 + ENTRY(entry_SYSENTER_32) 301 + movl TSS_sysenter_sp0(%esp), %esp 302 + sysenter_past_esp: 303 + /* 304 + * Interrupts are disabled here, but we can't trace it until 305 + * enough kernel state to call TRACE_IRQS_OFF can be called - but 306 + * we immediately enable interrupts at that point anyway. 307 + */ 308 + pushl $__USER_DS 309 + pushl %ebp 310 + pushfl 311 + orl $X86_EFLAGS_IF, (%esp) 312 + pushl $__USER_CS 313 + /* 314 + * Push current_thread_info()->sysenter_return to the stack. 315 + * A tiny bit of offset fixup is necessary: TI_sysenter_return 316 + * is relative to thread_info, which is at the bottom of the 317 + * kernel stack page. 4*4 means the 4 words pushed above; 318 + * TOP_OF_KERNEL_STACK_PADDING takes us to the top of the stack; 319 + * and THREAD_SIZE takes us to the bottom. 320 + */ 321 + pushl ((TI_sysenter_return) - THREAD_SIZE + TOP_OF_KERNEL_STACK_PADDING + 4*4)(%esp) 322 + 323 + pushl %eax 324 + SAVE_ALL 325 + ENABLE_INTERRUPTS(CLBR_NONE) 326 + 327 + /* 328 + * Load the potential sixth argument from user stack. 329 + * Careful about security. 330 + */ 331 + cmpl $__PAGE_OFFSET-3, %ebp 332 + jae syscall_fault 333 + ASM_STAC 334 + 1: movl (%ebp), %ebp 335 + ASM_CLAC 336 + movl %ebp, PT_EBP(%esp) 337 + _ASM_EXTABLE(1b, syscall_fault) 338 + 339 + GET_THREAD_INFO(%ebp) 340 + 341 + testl $_TIF_WORK_SYSCALL_ENTRY, TI_flags(%ebp) 342 + jnz sysenter_audit 343 + sysenter_do_call: 344 + cmpl $(NR_syscalls), %eax 345 + jae sysenter_badsys 346 + call *sys_call_table(, %eax, 4) 347 + sysenter_after_call: 348 + movl %eax, PT_EAX(%esp) 349 + LOCKDEP_SYS_EXIT 350 + DISABLE_INTERRUPTS(CLBR_ANY) 351 + TRACE_IRQS_OFF 352 + movl TI_flags(%ebp), %ecx 353 + testl $_TIF_ALLWORK_MASK, %ecx 354 + jnz sysexit_audit 355 + sysenter_exit: 356 + /* if something modifies registers it must also disable sysexit */ 357 + movl PT_EIP(%esp), %edx 358 + movl PT_OLDESP(%esp), %ecx 359 + xorl %ebp, %ebp 360 + TRACE_IRQS_ON 361 + 1: mov PT_FS(%esp), %fs 362 + PTGS_TO_GS 363 + ENABLE_INTERRUPTS_SYSEXIT 364 + 365 + #ifdef CONFIG_AUDITSYSCALL 366 + sysenter_audit: 367 + testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), TI_flags(%ebp) 368 + jnz syscall_trace_entry 369 + /* movl PT_EAX(%esp), %eax already set, syscall number: 1st arg to audit */ 370 + movl PT_EBX(%esp), %edx /* ebx/a0: 2nd arg to audit */ 371 + /* movl PT_ECX(%esp), %ecx already set, a1: 3nd arg to audit */ 372 + pushl PT_ESI(%esp) /* a3: 5th arg */ 373 + pushl PT_EDX+4(%esp) /* a2: 4th arg */ 374 + call __audit_syscall_entry 375 + popl %ecx /* get that remapped edx off the stack */ 376 + popl %ecx /* get that remapped esi off the stack */ 377 + movl PT_EAX(%esp), %eax /* reload syscall number */ 378 + jmp sysenter_do_call 379 + 380 + sysexit_audit: 381 + testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx 382 + jnz syscall_exit_work 383 + TRACE_IRQS_ON 384 + ENABLE_INTERRUPTS(CLBR_ANY) 385 + movl %eax, %edx /* second arg, syscall return value */ 386 + cmpl $-MAX_ERRNO, %eax /* is it an error ? */ 387 + setbe %al /* 1 if so, 0 if not */ 388 + movzbl %al, %eax /* zero-extend that */ 389 + call __audit_syscall_exit 390 + DISABLE_INTERRUPTS(CLBR_ANY) 391 + TRACE_IRQS_OFF 392 + movl TI_flags(%ebp), %ecx 393 + testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx 394 + jnz syscall_exit_work 395 + movl PT_EAX(%esp), %eax /* reload syscall return value */ 396 + jmp sysenter_exit 397 + #endif 398 + 399 + .pushsection .fixup, "ax" 400 + 2: movl $0, PT_FS(%esp) 401 + jmp 1b 402 + .popsection 403 + _ASM_EXTABLE(1b, 2b) 404 + PTGS_TO_GS_EX 405 + ENDPROC(entry_SYSENTER_32) 406 + 407 + # system call handler stub 408 + ENTRY(entry_INT80_32) 409 + ASM_CLAC 410 + pushl %eax # save orig_eax 411 + SAVE_ALL 412 + GET_THREAD_INFO(%ebp) 413 + # system call tracing in operation / emulation 414 + testl $_TIF_WORK_SYSCALL_ENTRY, TI_flags(%ebp) 415 + jnz syscall_trace_entry 416 + cmpl $(NR_syscalls), %eax 417 + jae syscall_badsys 418 + syscall_call: 419 + call *sys_call_table(, %eax, 4) 420 + syscall_after_call: 421 + movl %eax, PT_EAX(%esp) # store the return value 422 + syscall_exit: 423 + LOCKDEP_SYS_EXIT 424 + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 425 + # setting need_resched or sigpending 426 + # between sampling and the iret 427 + TRACE_IRQS_OFF 428 + movl TI_flags(%ebp), %ecx 429 + testl $_TIF_ALLWORK_MASK, %ecx # current->work 430 + jnz syscall_exit_work 431 + 432 + restore_all: 433 + TRACE_IRQS_IRET 434 + restore_all_notrace: 435 + #ifdef CONFIG_X86_ESPFIX32 436 + movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS 437 + /* 438 + * Warning: PT_OLDSS(%esp) contains the wrong/random values if we 439 + * are returning to the kernel. 440 + * See comments in process.c:copy_thread() for details. 441 + */ 442 + movb PT_OLDSS(%esp), %ah 443 + movb PT_CS(%esp), %al 444 + andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax 445 + cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax 446 + je ldt_ss # returning to user-space with LDT SS 447 + #endif 448 + restore_nocheck: 449 + RESTORE_REGS 4 # skip orig_eax/error_code 450 + irq_return: 451 + INTERRUPT_RETURN 452 + .section .fixup, "ax" 453 + ENTRY(iret_exc ) 454 + pushl $0 # no error code 455 + pushl $do_iret_error 456 + jmp error_code 457 + .previous 458 + _ASM_EXTABLE(irq_return, iret_exc) 459 + 460 + #ifdef CONFIG_X86_ESPFIX32 461 + ldt_ss: 462 + #ifdef CONFIG_PARAVIRT 463 + /* 464 + * The kernel can't run on a non-flat stack if paravirt mode 465 + * is active. Rather than try to fixup the high bits of 466 + * ESP, bypass this code entirely. This may break DOSemu 467 + * and/or Wine support in a paravirt VM, although the option 468 + * is still available to implement the setting of the high 469 + * 16-bits in the INTERRUPT_RETURN paravirt-op. 470 + */ 471 + cmpl $0, pv_info+PARAVIRT_enabled 472 + jne restore_nocheck 473 + #endif 474 + 475 + /* 476 + * Setup and switch to ESPFIX stack 477 + * 478 + * We're returning to userspace with a 16 bit stack. The CPU will not 479 + * restore the high word of ESP for us on executing iret... This is an 480 + * "official" bug of all the x86-compatible CPUs, which we can work 481 + * around to make dosemu and wine happy. We do this by preloading the 482 + * high word of ESP with the high word of the userspace ESP while 483 + * compensating for the offset by changing to the ESPFIX segment with 484 + * a base address that matches for the difference. 485 + */ 486 + #define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8) 487 + mov %esp, %edx /* load kernel esp */ 488 + mov PT_OLDESP(%esp), %eax /* load userspace esp */ 489 + mov %dx, %ax /* eax: new kernel esp */ 490 + sub %eax, %edx /* offset (low word is 0) */ 491 + shr $16, %edx 492 + mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */ 493 + mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */ 494 + pushl $__ESPFIX_SS 495 + pushl %eax /* new kernel esp */ 496 + /* 497 + * Disable interrupts, but do not irqtrace this section: we 498 + * will soon execute iret and the tracer was already set to 499 + * the irqstate after the IRET: 500 + */ 501 + DISABLE_INTERRUPTS(CLBR_EAX) 502 + lss (%esp), %esp /* switch to espfix segment */ 503 + jmp restore_nocheck 504 + #endif 505 + ENDPROC(entry_INT80_32) 506 + 507 + # perform work that needs to be done immediately before resumption 508 + ALIGN 509 + work_pending: 510 + testb $_TIF_NEED_RESCHED, %cl 511 + jz work_notifysig 512 + work_resched: 513 + call schedule 514 + LOCKDEP_SYS_EXIT 515 + DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 516 + # setting need_resched or sigpending 517 + # between sampling and the iret 518 + TRACE_IRQS_OFF 519 + movl TI_flags(%ebp), %ecx 520 + andl $_TIF_WORK_MASK, %ecx # is there any work to be done other 521 + # than syscall tracing? 522 + jz restore_all 523 + testb $_TIF_NEED_RESCHED, %cl 524 + jnz work_resched 525 + 526 + work_notifysig: # deal with pending signals and 527 + # notify-resume requests 528 + #ifdef CONFIG_VM86 529 + testl $X86_EFLAGS_VM, PT_EFLAGS(%esp) 530 + movl %esp, %eax 531 + jnz work_notifysig_v86 # returning to kernel-space or 532 + # vm86-space 533 + 1: 534 + #else 535 + movl %esp, %eax 536 + #endif 537 + TRACE_IRQS_ON 538 + ENABLE_INTERRUPTS(CLBR_NONE) 539 + movb PT_CS(%esp), %bl 540 + andb $SEGMENT_RPL_MASK, %bl 541 + cmpb $USER_RPL, %bl 542 + jb resume_kernel 543 + xorl %edx, %edx 544 + call do_notify_resume 545 + jmp resume_userspace 546 + 547 + #ifdef CONFIG_VM86 548 + ALIGN 549 + work_notifysig_v86: 550 + pushl %ecx # save ti_flags for do_notify_resume 551 + call save_v86_state # %eax contains pt_regs pointer 552 + popl %ecx 553 + movl %eax, %esp 554 + jmp 1b 555 + #endif 556 + END(work_pending) 557 + 558 + # perform syscall exit tracing 559 + ALIGN 560 + syscall_trace_entry: 561 + movl $-ENOSYS, PT_EAX(%esp) 562 + movl %esp, %eax 563 + call syscall_trace_enter 564 + /* What it returned is what we'll actually use. */ 565 + cmpl $(NR_syscalls), %eax 566 + jnae syscall_call 567 + jmp syscall_exit 568 + END(syscall_trace_entry) 569 + 570 + # perform syscall exit tracing 571 + ALIGN 572 + syscall_exit_work: 573 + testl $_TIF_WORK_SYSCALL_EXIT, %ecx 574 + jz work_pending 575 + TRACE_IRQS_ON 576 + ENABLE_INTERRUPTS(CLBR_ANY) # could let syscall_trace_leave() call 577 + # schedule() instead 578 + movl %esp, %eax 579 + call syscall_trace_leave 580 + jmp resume_userspace 581 + END(syscall_exit_work) 582 + 583 + syscall_fault: 584 + ASM_CLAC 585 + GET_THREAD_INFO(%ebp) 586 + movl $-EFAULT, PT_EAX(%esp) 587 + jmp resume_userspace 588 + END(syscall_fault) 589 + 590 + syscall_badsys: 591 + movl $-ENOSYS, %eax 592 + jmp syscall_after_call 593 + END(syscall_badsys) 594 + 595 + sysenter_badsys: 596 + movl $-ENOSYS, %eax 597 + jmp sysenter_after_call 598 + END(sysenter_badsys) 599 + 600 + .macro FIXUP_ESPFIX_STACK 601 + /* 602 + * Switch back for ESPFIX stack to the normal zerobased stack 603 + * 604 + * We can't call C functions using the ESPFIX stack. This code reads 605 + * the high word of the segment base from the GDT and swiches to the 606 + * normal stack and adjusts ESP with the matching offset. 607 + */ 608 + #ifdef CONFIG_X86_ESPFIX32 609 + /* fixup the stack */ 610 + mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ 611 + mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */ 612 + shl $16, %eax 613 + addl %esp, %eax /* the adjusted stack pointer */ 614 + pushl $__KERNEL_DS 615 + pushl %eax 616 + lss (%esp), %esp /* switch to the normal stack segment */ 617 + #endif 618 + .endm 619 + .macro UNWIND_ESPFIX_STACK 620 + #ifdef CONFIG_X86_ESPFIX32 621 + movl %ss, %eax 622 + /* see if on espfix stack */ 623 + cmpw $__ESPFIX_SS, %ax 624 + jne 27f 625 + movl $__KERNEL_DS, %eax 626 + movl %eax, %ds 627 + movl %eax, %es 628 + /* switch to normal stack */ 629 + FIXUP_ESPFIX_STACK 630 + 27: 631 + #endif 632 + .endm 633 + 634 + /* 635 + * Build the entry stubs with some assembler magic. 636 + * We pack 1 stub into every 8-byte block. 637 + */ 638 + .align 8 639 + ENTRY(irq_entries_start) 640 + vector=FIRST_EXTERNAL_VECTOR 641 + .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR) 642 + pushl $(~vector+0x80) /* Note: always in signed byte range */ 643 + vector=vector+1 644 + jmp common_interrupt 645 + .align 8 646 + .endr 647 + END(irq_entries_start) 648 + 649 + /* 650 + * the CPU automatically disables interrupts when executing an IRQ vector, 651 + * so IRQ-flags tracing has to follow that: 652 + */ 653 + .p2align CONFIG_X86_L1_CACHE_SHIFT 654 + common_interrupt: 655 + ASM_CLAC 656 + addl $-0x80, (%esp) /* Adjust vector into the [-256, -1] range */ 657 + SAVE_ALL 658 + TRACE_IRQS_OFF 659 + movl %esp, %eax 660 + call do_IRQ 661 + jmp ret_from_intr 662 + ENDPROC(common_interrupt) 663 + 664 + #define BUILD_INTERRUPT3(name, nr, fn) \ 665 + ENTRY(name) \ 666 + ASM_CLAC; \ 667 + pushl $~(nr); \ 668 + SAVE_ALL; \ 669 + TRACE_IRQS_OFF \ 670 + movl %esp, %eax; \ 671 + call fn; \ 672 + jmp ret_from_intr; \ 673 + ENDPROC(name) 674 + 675 + 676 + #ifdef CONFIG_TRACING 677 + # define TRACE_BUILD_INTERRUPT(name, nr) BUILD_INTERRUPT3(trace_##name, nr, smp_trace_##name) 678 + #else 679 + # define TRACE_BUILD_INTERRUPT(name, nr) 680 + #endif 681 + 682 + #define BUILD_INTERRUPT(name, nr) \ 683 + BUILD_INTERRUPT3(name, nr, smp_##name); \ 684 + TRACE_BUILD_INTERRUPT(name, nr) 685 + 686 + /* The include is where all of the SMP etc. interrupts come from */ 687 + #include <asm/entry_arch.h> 688 + 689 + ENTRY(coprocessor_error) 690 + ASM_CLAC 691 + pushl $0 692 + pushl $do_coprocessor_error 693 + jmp error_code 694 + END(coprocessor_error) 695 + 696 + ENTRY(simd_coprocessor_error) 697 + ASM_CLAC 698 + pushl $0 699 + #ifdef CONFIG_X86_INVD_BUG 700 + /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ 701 + ALTERNATIVE "pushl $do_general_protection", \ 702 + "pushl $do_simd_coprocessor_error", \ 703 + X86_FEATURE_XMM 704 + #else 705 + pushl $do_simd_coprocessor_error 706 + #endif 707 + jmp error_code 708 + END(simd_coprocessor_error) 709 + 710 + ENTRY(device_not_available) 711 + ASM_CLAC 712 + pushl $-1 # mark this as an int 713 + pushl $do_device_not_available 714 + jmp error_code 715 + END(device_not_available) 716 + 717 + #ifdef CONFIG_PARAVIRT 718 + ENTRY(native_iret) 719 + iret 720 + _ASM_EXTABLE(native_iret, iret_exc) 721 + END(native_iret) 722 + 723 + ENTRY(native_irq_enable_sysexit) 724 + sti 725 + sysexit 726 + END(native_irq_enable_sysexit) 727 + #endif 728 + 729 + ENTRY(overflow) 730 + ASM_CLAC 731 + pushl $0 732 + pushl $do_overflow 733 + jmp error_code 734 + END(overflow) 735 + 736 + ENTRY(bounds) 737 + ASM_CLAC 738 + pushl $0 739 + pushl $do_bounds 740 + jmp error_code 741 + END(bounds) 742 + 743 + ENTRY(invalid_op) 744 + ASM_CLAC 745 + pushl $0 746 + pushl $do_invalid_op 747 + jmp error_code 748 + END(invalid_op) 749 + 750 + ENTRY(coprocessor_segment_overrun) 751 + ASM_CLAC 752 + pushl $0 753 + pushl $do_coprocessor_segment_overrun 754 + jmp error_code 755 + END(coprocessor_segment_overrun) 756 + 757 + ENTRY(invalid_TSS) 758 + ASM_CLAC 759 + pushl $do_invalid_TSS 760 + jmp error_code 761 + END(invalid_TSS) 762 + 763 + ENTRY(segment_not_present) 764 + ASM_CLAC 765 + pushl $do_segment_not_present 766 + jmp error_code 767 + END(segment_not_present) 768 + 769 + ENTRY(stack_segment) 770 + ASM_CLAC 771 + pushl $do_stack_segment 772 + jmp error_code 773 + END(stack_segment) 774 + 775 + ENTRY(alignment_check) 776 + ASM_CLAC 777 + pushl $do_alignment_check 778 + jmp error_code 779 + END(alignment_check) 780 + 781 + ENTRY(divide_error) 782 + ASM_CLAC 783 + pushl $0 # no error code 784 + pushl $do_divide_error 785 + jmp error_code 786 + END(divide_error) 787 + 788 + #ifdef CONFIG_X86_MCE 789 + ENTRY(machine_check) 790 + ASM_CLAC 791 + pushl $0 792 + pushl machine_check_vector 793 + jmp error_code 794 + END(machine_check) 795 + #endif 796 + 797 + ENTRY(spurious_interrupt_bug) 798 + ASM_CLAC 799 + pushl $0 800 + pushl $do_spurious_interrupt_bug 801 + jmp error_code 802 + END(spurious_interrupt_bug) 803 + 804 + #ifdef CONFIG_XEN 805 + /* 806 + * Xen doesn't set %esp to be precisely what the normal SYSENTER 807 + * entry point expects, so fix it up before using the normal path. 808 + */ 809 + ENTRY(xen_sysenter_target) 810 + addl $5*4, %esp /* remove xen-provided frame */ 811 + jmp sysenter_past_esp 812 + 813 + ENTRY(xen_hypervisor_callback) 814 + pushl $-1 /* orig_ax = -1 => not a system call */ 815 + SAVE_ALL 816 + TRACE_IRQS_OFF 817 + 818 + /* 819 + * Check to see if we got the event in the critical 820 + * region in xen_iret_direct, after we've reenabled 821 + * events and checked for pending events. This simulates 822 + * iret instruction's behaviour where it delivers a 823 + * pending interrupt when enabling interrupts: 824 + */ 825 + movl PT_EIP(%esp), %eax 826 + cmpl $xen_iret_start_crit, %eax 827 + jb 1f 828 + cmpl $xen_iret_end_crit, %eax 829 + jae 1f 830 + 831 + jmp xen_iret_crit_fixup 832 + 833 + ENTRY(xen_do_upcall) 834 + 1: mov %esp, %eax 835 + call xen_evtchn_do_upcall 836 + #ifndef CONFIG_PREEMPT 837 + call xen_maybe_preempt_hcall 838 + #endif 839 + jmp ret_from_intr 840 + ENDPROC(xen_hypervisor_callback) 841 + 842 + /* 843 + * Hypervisor uses this for application faults while it executes. 844 + * We get here for two reasons: 845 + * 1. Fault while reloading DS, ES, FS or GS 846 + * 2. Fault while executing IRET 847 + * Category 1 we fix up by reattempting the load, and zeroing the segment 848 + * register if the load fails. 849 + * Category 2 we fix up by jumping to do_iret_error. We cannot use the 850 + * normal Linux return path in this case because if we use the IRET hypercall 851 + * to pop the stack frame we end up in an infinite loop of failsafe callbacks. 852 + * We distinguish between categories by maintaining a status value in EAX. 853 + */ 854 + ENTRY(xen_failsafe_callback) 855 + pushl %eax 856 + movl $1, %eax 857 + 1: mov 4(%esp), %ds 858 + 2: mov 8(%esp), %es 859 + 3: mov 12(%esp), %fs 860 + 4: mov 16(%esp), %gs 861 + /* EAX == 0 => Category 1 (Bad segment) 862 + EAX != 0 => Category 2 (Bad IRET) */ 863 + testl %eax, %eax 864 + popl %eax 865 + lea 16(%esp), %esp 866 + jz 5f 867 + jmp iret_exc 868 + 5: pushl $-1 /* orig_ax = -1 => not a system call */ 869 + SAVE_ALL 870 + jmp ret_from_exception 871 + 872 + .section .fixup, "ax" 873 + 6: xorl %eax, %eax 874 + movl %eax, 4(%esp) 875 + jmp 1b 876 + 7: xorl %eax, %eax 877 + movl %eax, 8(%esp) 878 + jmp 2b 879 + 8: xorl %eax, %eax 880 + movl %eax, 12(%esp) 881 + jmp 3b 882 + 9: xorl %eax, %eax 883 + movl %eax, 16(%esp) 884 + jmp 4b 885 + .previous 886 + _ASM_EXTABLE(1b, 6b) 887 + _ASM_EXTABLE(2b, 7b) 888 + _ASM_EXTABLE(3b, 8b) 889 + _ASM_EXTABLE(4b, 9b) 890 + ENDPROC(xen_failsafe_callback) 891 + 892 + BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, 893 + xen_evtchn_do_upcall) 894 + 895 + #endif /* CONFIG_XEN */ 896 + 897 + #if IS_ENABLED(CONFIG_HYPERV) 898 + 899 + BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR, 900 + hyperv_vector_handler) 901 + 902 + #endif /* CONFIG_HYPERV */ 903 + 904 + #ifdef CONFIG_FUNCTION_TRACER 905 + #ifdef CONFIG_DYNAMIC_FTRACE 906 + 907 + ENTRY(mcount) 908 + ret 909 + END(mcount) 910 + 911 + ENTRY(ftrace_caller) 912 + pushl %eax 913 + pushl %ecx 914 + pushl %edx 915 + pushl $0 /* Pass NULL as regs pointer */ 916 + movl 4*4(%esp), %eax 917 + movl 0x4(%ebp), %edx 918 + movl function_trace_op, %ecx 919 + subl $MCOUNT_INSN_SIZE, %eax 920 + 921 + .globl ftrace_call 922 + ftrace_call: 923 + call ftrace_stub 924 + 925 + addl $4, %esp /* skip NULL pointer */ 926 + popl %edx 927 + popl %ecx 928 + popl %eax 929 + ftrace_ret: 930 + #ifdef CONFIG_FUNCTION_GRAPH_TRACER 931 + .globl ftrace_graph_call 932 + ftrace_graph_call: 933 + jmp ftrace_stub 934 + #endif 935 + 936 + .globl ftrace_stub 937 + ftrace_stub: 938 + ret 939 + END(ftrace_caller) 940 + 941 + ENTRY(ftrace_regs_caller) 942 + pushf /* push flags before compare (in cs location) */ 943 + 944 + /* 945 + * i386 does not save SS and ESP when coming from kernel. 946 + * Instead, to get sp, &regs->sp is used (see ptrace.h). 947 + * Unfortunately, that means eflags must be at the same location 948 + * as the current return ip is. We move the return ip into the 949 + * ip location, and move flags into the return ip location. 950 + */ 951 + pushl 4(%esp) /* save return ip into ip slot */ 952 + 953 + pushl $0 /* Load 0 into orig_ax */ 954 + pushl %gs 955 + pushl %fs 956 + pushl %es 957 + pushl %ds 958 + pushl %eax 959 + pushl %ebp 960 + pushl %edi 961 + pushl %esi 962 + pushl %edx 963 + pushl %ecx 964 + pushl %ebx 965 + 966 + movl 13*4(%esp), %eax /* Get the saved flags */ 967 + movl %eax, 14*4(%esp) /* Move saved flags into regs->flags location */ 968 + /* clobbering return ip */ 969 + movl $__KERNEL_CS, 13*4(%esp) 970 + 971 + movl 12*4(%esp), %eax /* Load ip (1st parameter) */ 972 + subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */ 973 + movl 0x4(%ebp), %edx /* Load parent ip (2nd parameter) */ 974 + movl function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */ 975 + pushl %esp /* Save pt_regs as 4th parameter */ 976 + 977 + GLOBAL(ftrace_regs_call) 978 + call ftrace_stub 979 + 980 + addl $4, %esp /* Skip pt_regs */ 981 + movl 14*4(%esp), %eax /* Move flags back into cs */ 982 + movl %eax, 13*4(%esp) /* Needed to keep addl from modifying flags */ 983 + movl 12*4(%esp), %eax /* Get return ip from regs->ip */ 984 + movl %eax, 14*4(%esp) /* Put return ip back for ret */ 985 + 986 + popl %ebx 987 + popl %ecx 988 + popl %edx 989 + popl %esi 990 + popl %edi 991 + popl %ebp 992 + popl %eax 993 + popl %ds 994 + popl %es 995 + popl %fs 996 + popl %gs 997 + addl $8, %esp /* Skip orig_ax and ip */ 998 + popf /* Pop flags at end (no addl to corrupt flags) */ 999 + jmp ftrace_ret 1000 + 1001 + popf 1002 + jmp ftrace_stub 1003 + #else /* ! CONFIG_DYNAMIC_FTRACE */ 1004 + 1005 + ENTRY(mcount) 1006 + cmpl $__PAGE_OFFSET, %esp 1007 + jb ftrace_stub /* Paging not enabled yet? */ 1008 + 1009 + cmpl $ftrace_stub, ftrace_trace_function 1010 + jnz trace 1011 + #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1012 + cmpl $ftrace_stub, ftrace_graph_return 1013 + jnz ftrace_graph_caller 1014 + 1015 + cmpl $ftrace_graph_entry_stub, ftrace_graph_entry 1016 + jnz ftrace_graph_caller 1017 + #endif 1018 + .globl ftrace_stub 1019 + ftrace_stub: 1020 + ret 1021 + 1022 + /* taken from glibc */ 1023 + trace: 1024 + pushl %eax 1025 + pushl %ecx 1026 + pushl %edx 1027 + movl 0xc(%esp), %eax 1028 + movl 0x4(%ebp), %edx 1029 + subl $MCOUNT_INSN_SIZE, %eax 1030 + 1031 + call *ftrace_trace_function 1032 + 1033 + popl %edx 1034 + popl %ecx 1035 + popl %eax 1036 + jmp ftrace_stub 1037 + END(mcount) 1038 + #endif /* CONFIG_DYNAMIC_FTRACE */ 1039 + #endif /* CONFIG_FUNCTION_TRACER */ 1040 + 1041 + #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1042 + ENTRY(ftrace_graph_caller) 1043 + pushl %eax 1044 + pushl %ecx 1045 + pushl %edx 1046 + movl 0xc(%esp), %eax 1047 + lea 0x4(%ebp), %edx 1048 + movl (%ebp), %ecx 1049 + subl $MCOUNT_INSN_SIZE, %eax 1050 + call prepare_ftrace_return 1051 + popl %edx 1052 + popl %ecx 1053 + popl %eax 1054 + ret 1055 + END(ftrace_graph_caller) 1056 + 1057 + .globl return_to_handler 1058 + return_to_handler: 1059 + pushl %eax 1060 + pushl %edx 1061 + movl %ebp, %eax 1062 + call ftrace_return_to_handler 1063 + movl %eax, %ecx 1064 + popl %edx 1065 + popl %eax 1066 + jmp *%ecx 1067 + #endif 1068 + 1069 + #ifdef CONFIG_TRACING 1070 + ENTRY(trace_page_fault) 1071 + ASM_CLAC 1072 + pushl $trace_do_page_fault 1073 + jmp error_code 1074 + END(trace_page_fault) 1075 + #endif 1076 + 1077 + ENTRY(page_fault) 1078 + ASM_CLAC 1079 + pushl $do_page_fault 1080 + ALIGN 1081 + error_code: 1082 + /* the function address is in %gs's slot on the stack */ 1083 + pushl %fs 1084 + pushl %es 1085 + pushl %ds 1086 + pushl %eax 1087 + pushl %ebp 1088 + pushl %edi 1089 + pushl %esi 1090 + pushl %edx 1091 + pushl %ecx 1092 + pushl %ebx 1093 + cld 1094 + movl $(__KERNEL_PERCPU), %ecx 1095 + movl %ecx, %fs 1096 + UNWIND_ESPFIX_STACK 1097 + GS_TO_REG %ecx 1098 + movl PT_GS(%esp), %edi # get the function address 1099 + movl PT_ORIG_EAX(%esp), %edx # get the error code 1100 + movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart 1101 + REG_TO_PTGS %ecx 1102 + SET_KERNEL_GS %ecx 1103 + movl $(__USER_DS), %ecx 1104 + movl %ecx, %ds 1105 + movl %ecx, %es 1106 + TRACE_IRQS_OFF 1107 + movl %esp, %eax # pt_regs pointer 1108 + call *%edi 1109 + jmp ret_from_exception 1110 + END(page_fault) 1111 + 1112 + /* 1113 + * Debug traps and NMI can happen at the one SYSENTER instruction 1114 + * that sets up the real kernel stack. Check here, since we can't 1115 + * allow the wrong stack to be used. 1116 + * 1117 + * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have 1118 + * already pushed 3 words if it hits on the sysenter instruction: 1119 + * eflags, cs and eip. 1120 + * 1121 + * We just load the right stack, and push the three (known) values 1122 + * by hand onto the new stack - while updating the return eip past 1123 + * the instruction that would have done it for sysenter. 1124 + */ 1125 + .macro FIX_STACK offset ok label 1126 + cmpw $__KERNEL_CS, 4(%esp) 1127 + jne \ok 1128 + \label: 1129 + movl TSS_sysenter_sp0 + \offset(%esp), %esp 1130 + pushfl 1131 + pushl $__KERNEL_CS 1132 + pushl $sysenter_past_esp 1133 + .endm 1134 + 1135 + ENTRY(debug) 1136 + ASM_CLAC 1137 + cmpl $entry_SYSENTER_32, (%esp) 1138 + jne debug_stack_correct 1139 + FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn 1140 + debug_stack_correct: 1141 + pushl $-1 # mark this as an int 1142 + SAVE_ALL 1143 + TRACE_IRQS_OFF 1144 + xorl %edx, %edx # error code 0 1145 + movl %esp, %eax # pt_regs pointer 1146 + call do_debug 1147 + jmp ret_from_exception 1148 + END(debug) 1149 + 1150 + /* 1151 + * NMI is doubly nasty. It can happen _while_ we're handling 1152 + * a debug fault, and the debug fault hasn't yet been able to 1153 + * clear up the stack. So we first check whether we got an 1154 + * NMI on the sysenter entry path, but after that we need to 1155 + * check whether we got an NMI on the debug path where the debug 1156 + * fault happened on the sysenter path. 1157 + */ 1158 + ENTRY(nmi) 1159 + ASM_CLAC 1160 + #ifdef CONFIG_X86_ESPFIX32 1161 + pushl %eax 1162 + movl %ss, %eax 1163 + cmpw $__ESPFIX_SS, %ax 1164 + popl %eax 1165 + je nmi_espfix_stack 1166 + #endif 1167 + cmpl $entry_SYSENTER_32, (%esp) 1168 + je nmi_stack_fixup 1169 + pushl %eax 1170 + movl %esp, %eax 1171 + /* 1172 + * Do not access memory above the end of our stack page, 1173 + * it might not exist. 1174 + */ 1175 + andl $(THREAD_SIZE-1), %eax 1176 + cmpl $(THREAD_SIZE-20), %eax 1177 + popl %eax 1178 + jae nmi_stack_correct 1179 + cmpl $entry_SYSENTER_32, 12(%esp) 1180 + je nmi_debug_stack_check 1181 + nmi_stack_correct: 1182 + pushl %eax 1183 + SAVE_ALL 1184 + xorl %edx, %edx # zero error code 1185 + movl %esp, %eax # pt_regs pointer 1186 + call do_nmi 1187 + jmp restore_all_notrace 1188 + 1189 + nmi_stack_fixup: 1190 + FIX_STACK 12, nmi_stack_correct, 1 1191 + jmp nmi_stack_correct 1192 + 1193 + nmi_debug_stack_check: 1194 + cmpw $__KERNEL_CS, 16(%esp) 1195 + jne nmi_stack_correct 1196 + cmpl $debug, (%esp) 1197 + jb nmi_stack_correct 1198 + cmpl $debug_esp_fix_insn, (%esp) 1199 + ja nmi_stack_correct 1200 + FIX_STACK 24, nmi_stack_correct, 1 1201 + jmp nmi_stack_correct 1202 + 1203 + #ifdef CONFIG_X86_ESPFIX32 1204 + nmi_espfix_stack: 1205 + /* 1206 + * create the pointer to lss back 1207 + */ 1208 + pushl %ss 1209 + pushl %esp 1210 + addl $4, (%esp) 1211 + /* copy the iret frame of 12 bytes */ 1212 + .rept 3 1213 + pushl 16(%esp) 1214 + .endr 1215 + pushl %eax 1216 + SAVE_ALL 1217 + FIXUP_ESPFIX_STACK # %eax == %esp 1218 + xorl %edx, %edx # zero error code 1219 + call do_nmi 1220 + RESTORE_REGS 1221 + lss 12+4(%esp), %esp # back to espfix stack 1222 + jmp irq_return 1223 + #endif 1224 + END(nmi) 1225 + 1226 + ENTRY(int3) 1227 + ASM_CLAC 1228 + pushl $-1 # mark this as an int 1229 + SAVE_ALL 1230 + TRACE_IRQS_OFF 1231 + xorl %edx, %edx # zero error code 1232 + movl %esp, %eax # pt_regs pointer 1233 + call do_int3 1234 + jmp ret_from_exception 1235 + END(int3) 1236 + 1237 + ENTRY(general_protection) 1238 + pushl $do_general_protection 1239 + jmp error_code 1240 + END(general_protection) 1241 + 1242 + #ifdef CONFIG_KVM_GUEST 1243 + ENTRY(async_page_fault) 1244 + ASM_CLAC 1245 + pushl $do_async_page_fault 1246 + jmp error_code 1247 + END(async_page_fault) 1248 + #endif
+547
arch/x86/entry/entry_64_compat.S
··· 1 + /* 2 + * Compatibility mode system call entry point for x86-64. 3 + * 4 + * Copyright 2000-2002 Andi Kleen, SuSE Labs. 5 + */ 6 + #include "calling.h" 7 + #include <asm/asm-offsets.h> 8 + #include <asm/current.h> 9 + #include <asm/errno.h> 10 + #include <asm/ia32_unistd.h> 11 + #include <asm/thread_info.h> 12 + #include <asm/segment.h> 13 + #include <asm/irqflags.h> 14 + #include <asm/asm.h> 15 + #include <asm/smap.h> 16 + #include <linux/linkage.h> 17 + #include <linux/err.h> 18 + 19 + /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 20 + #include <linux/elf-em.h> 21 + #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 22 + #define __AUDIT_ARCH_LE 0x40000000 23 + 24 + #ifndef CONFIG_AUDITSYSCALL 25 + # define sysexit_audit ia32_ret_from_sys_call 26 + # define sysretl_audit ia32_ret_from_sys_call 27 + #endif 28 + 29 + .section .entry.text, "ax" 30 + 31 + #ifdef CONFIG_PARAVIRT 32 + ENTRY(native_usergs_sysret32) 33 + swapgs 34 + sysretl 35 + ENDPROC(native_usergs_sysret32) 36 + #endif 37 + 38 + /* 39 + * 32-bit SYSENTER instruction entry. 40 + * 41 + * SYSENTER loads ss, rsp, cs, and rip from previously programmed MSRs. 42 + * IF and VM in rflags are cleared (IOW: interrupts are off). 43 + * SYSENTER does not save anything on the stack, 44 + * and does not save old rip (!!!) and rflags. 45 + * 46 + * Arguments: 47 + * eax system call number 48 + * ebx arg1 49 + * ecx arg2 50 + * edx arg3 51 + * esi arg4 52 + * edi arg5 53 + * ebp user stack 54 + * 0(%ebp) arg6 55 + * 56 + * This is purely a fast path. For anything complicated we use the int 0x80 57 + * path below. We set up a complete hardware stack frame to share code 58 + * with the int 0x80 path. 59 + */ 60 + ENTRY(entry_SYSENTER_compat) 61 + /* 62 + * Interrupts are off on entry. 63 + * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 64 + * it is too small to ever cause noticeable irq latency. 65 + */ 66 + SWAPGS_UNSAFE_STACK 67 + movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp 68 + ENABLE_INTERRUPTS(CLBR_NONE) 69 + 70 + /* Zero-extending 32-bit regs, do not remove */ 71 + movl %ebp, %ebp 72 + movl %eax, %eax 73 + 74 + movl ASM_THREAD_INFO(TI_sysenter_return, %rsp, 0), %r10d 75 + 76 + /* Construct struct pt_regs on stack */ 77 + pushq $__USER32_DS /* pt_regs->ss */ 78 + pushq %rbp /* pt_regs->sp */ 79 + pushfq /* pt_regs->flags */ 80 + pushq $__USER32_CS /* pt_regs->cs */ 81 + pushq %r10 /* pt_regs->ip = thread_info->sysenter_return */ 82 + pushq %rax /* pt_regs->orig_ax */ 83 + pushq %rdi /* pt_regs->di */ 84 + pushq %rsi /* pt_regs->si */ 85 + pushq %rdx /* pt_regs->dx */ 86 + pushq %rcx /* pt_regs->cx */ 87 + pushq $-ENOSYS /* pt_regs->ax */ 88 + cld 89 + sub $(10*8), %rsp /* pt_regs->r8-11, bp, bx, r12-15 not saved */ 90 + 91 + /* 92 + * no need to do an access_ok check here because rbp has been 93 + * 32-bit zero extended 94 + */ 95 + ASM_STAC 96 + 1: movl (%rbp), %ebp 97 + _ASM_EXTABLE(1b, ia32_badarg) 98 + ASM_CLAC 99 + 100 + /* 101 + * Sysenter doesn't filter flags, so we need to clear NT 102 + * ourselves. To save a few cycles, we can check whether 103 + * NT was set instead of doing an unconditional popfq. 104 + */ 105 + testl $X86_EFLAGS_NT, EFLAGS(%rsp) 106 + jnz sysenter_fix_flags 107 + sysenter_flags_fixed: 108 + 109 + orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 110 + testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 111 + jnz sysenter_tracesys 112 + 113 + sysenter_do_call: 114 + /* 32-bit syscall -> 64-bit C ABI argument conversion */ 115 + movl %edi, %r8d /* arg5 */ 116 + movl %ebp, %r9d /* arg6 */ 117 + xchg %ecx, %esi /* rsi:arg2, rcx:arg4 */ 118 + movl %ebx, %edi /* arg1 */ 119 + movl %edx, %edx /* arg3 (zero extension) */ 120 + sysenter_dispatch: 121 + cmpq $(IA32_NR_syscalls-1), %rax 122 + ja 1f 123 + call *ia32_sys_call_table(, %rax, 8) 124 + movq %rax, RAX(%rsp) 125 + 1: 126 + DISABLE_INTERRUPTS(CLBR_NONE) 127 + TRACE_IRQS_OFF 128 + testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 129 + jnz sysexit_audit 130 + sysexit_from_sys_call: 131 + /* 132 + * NB: SYSEXIT is not obviously safe for 64-bit kernels -- an 133 + * NMI between STI and SYSEXIT has poorly specified behavior, 134 + * and and NMI followed by an IRQ with usergs is fatal. So 135 + * we just pretend we're using SYSEXIT but we really use 136 + * SYSRETL instead. 137 + * 138 + * This code path is still called 'sysexit' because it pairs 139 + * with 'sysenter' and it uses the SYSENTER calling convention. 140 + */ 141 + andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 142 + movl RIP(%rsp), %ecx /* User %eip */ 143 + RESTORE_RSI_RDI 144 + xorl %edx, %edx /* Do not leak kernel information */ 145 + xorq %r8, %r8 146 + xorq %r9, %r9 147 + xorq %r10, %r10 148 + movl EFLAGS(%rsp), %r11d /* User eflags */ 149 + TRACE_IRQS_ON 150 + 151 + /* 152 + * SYSRETL works even on Intel CPUs. Use it in preference to SYSEXIT, 153 + * since it avoids a dicey window with interrupts enabled. 154 + */ 155 + movl RSP(%rsp), %esp 156 + 157 + /* 158 + * USERGS_SYSRET32 does: 159 + * gsbase = user's gs base 160 + * eip = ecx 161 + * rflags = r11 162 + * cs = __USER32_CS 163 + * ss = __USER_DS 164 + * 165 + * The prologue set RIP(%rsp) to VDSO32_SYSENTER_RETURN, which does: 166 + * 167 + * pop %ebp 168 + * pop %edx 169 + * pop %ecx 170 + * 171 + * Therefore, we invoke SYSRETL with EDX and R8-R10 zeroed to 172 + * avoid info leaks. R11 ends up with VDSO32_SYSENTER_RETURN's 173 + * address (already known to user code), and R12-R15 are 174 + * callee-saved and therefore don't contain any interesting 175 + * kernel data. 176 + */ 177 + USERGS_SYSRET32 178 + 179 + #ifdef CONFIG_AUDITSYSCALL 180 + .macro auditsys_entry_common 181 + movl %esi, %r8d /* 5th arg: 4th syscall arg */ 182 + movl %ecx, %r9d /* swap with edx */ 183 + movl %edx, %ecx /* 4th arg: 3rd syscall arg */ 184 + movl %r9d, %edx /* 3rd arg: 2nd syscall arg */ 185 + movl %ebx, %esi /* 2nd arg: 1st syscall arg */ 186 + movl %eax, %edi /* 1st arg: syscall number */ 187 + call __audit_syscall_entry 188 + movl ORIG_RAX(%rsp), %eax /* reload syscall number */ 189 + movl %ebx, %edi /* reload 1st syscall arg */ 190 + movl RCX(%rsp), %esi /* reload 2nd syscall arg */ 191 + movl RDX(%rsp), %edx /* reload 3rd syscall arg */ 192 + movl RSI(%rsp), %ecx /* reload 4th syscall arg */ 193 + movl RDI(%rsp), %r8d /* reload 5th syscall arg */ 194 + .endm 195 + 196 + .macro auditsys_exit exit 197 + testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 198 + jnz ia32_ret_from_sys_call 199 + TRACE_IRQS_ON 200 + ENABLE_INTERRUPTS(CLBR_NONE) 201 + movl %eax, %esi /* second arg, syscall return value */ 202 + cmpl $-MAX_ERRNO, %eax /* is it an error ? */ 203 + jbe 1f 204 + movslq %eax, %rsi /* if error sign extend to 64 bits */ 205 + 1: setbe %al /* 1 if error, 0 if not */ 206 + movzbl %al, %edi /* zero-extend that into %edi */ 207 + call __audit_syscall_exit 208 + movq RAX(%rsp), %rax /* reload syscall return value */ 209 + movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %edi 210 + DISABLE_INTERRUPTS(CLBR_NONE) 211 + TRACE_IRQS_OFF 212 + testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 213 + jz \exit 214 + xorl %eax, %eax /* Do not leak kernel information */ 215 + movq %rax, R11(%rsp) 216 + movq %rax, R10(%rsp) 217 + movq %rax, R9(%rsp) 218 + movq %rax, R8(%rsp) 219 + jmp int_with_check 220 + .endm 221 + 222 + sysenter_auditsys: 223 + auditsys_entry_common 224 + movl %ebp, %r9d /* reload 6th syscall arg */ 225 + jmp sysenter_dispatch 226 + 227 + sysexit_audit: 228 + auditsys_exit sysexit_from_sys_call 229 + #endif 230 + 231 + sysenter_fix_flags: 232 + pushq $(X86_EFLAGS_IF|X86_EFLAGS_FIXED) 233 + popfq 234 + jmp sysenter_flags_fixed 235 + 236 + sysenter_tracesys: 237 + #ifdef CONFIG_AUDITSYSCALL 238 + testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 239 + jz sysenter_auditsys 240 + #endif 241 + SAVE_EXTRA_REGS 242 + xorl %eax, %eax /* Do not leak kernel information */ 243 + movq %rax, R11(%rsp) 244 + movq %rax, R10(%rsp) 245 + movq %rax, R9(%rsp) 246 + movq %rax, R8(%rsp) 247 + movq %rsp, %rdi /* &pt_regs -> arg1 */ 248 + call syscall_trace_enter 249 + 250 + /* Reload arg registers from stack. (see sysenter_tracesys) */ 251 + movl RCX(%rsp), %ecx 252 + movl RDX(%rsp), %edx 253 + movl RSI(%rsp), %esi 254 + movl RDI(%rsp), %edi 255 + movl %eax, %eax /* zero extension */ 256 + 257 + RESTORE_EXTRA_REGS 258 + jmp sysenter_do_call 259 + ENDPROC(entry_SYSENTER_compat) 260 + 261 + /* 262 + * 32-bit SYSCALL instruction entry. 263 + * 264 + * 32-bit SYSCALL saves rip to rcx, clears rflags.RF, then saves rflags to r11, 265 + * then loads new ss, cs, and rip from previously programmed MSRs. 266 + * rflags gets masked by a value from another MSR (so CLD and CLAC 267 + * are not needed). SYSCALL does not save anything on the stack 268 + * and does not change rsp. 269 + * 270 + * Note: rflags saving+masking-with-MSR happens only in Long mode 271 + * (in legacy 32-bit mode, IF, RF and VM bits are cleared and that's it). 272 + * Don't get confused: rflags saving+masking depends on Long Mode Active bit 273 + * (EFER.LMA=1), NOT on bitness of userspace where SYSCALL executes 274 + * or target CS descriptor's L bit (SYSCALL does not read segment descriptors). 275 + * 276 + * Arguments: 277 + * eax system call number 278 + * ecx return address 279 + * ebx arg1 280 + * ebp arg2 (note: not saved in the stack frame, should not be touched) 281 + * edx arg3 282 + * esi arg4 283 + * edi arg5 284 + * esp user stack 285 + * 0(%esp) arg6 286 + * 287 + * This is purely a fast path. For anything complicated we use the int 0x80 288 + * path below. We set up a complete hardware stack frame to share code 289 + * with the int 0x80 path. 290 + */ 291 + ENTRY(entry_SYSCALL_compat) 292 + /* 293 + * Interrupts are off on entry. 294 + * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 295 + * it is too small to ever cause noticeable irq latency. 296 + */ 297 + SWAPGS_UNSAFE_STACK 298 + movl %esp, %r8d 299 + movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp 300 + ENABLE_INTERRUPTS(CLBR_NONE) 301 + 302 + /* Zero-extending 32-bit regs, do not remove */ 303 + movl %eax, %eax 304 + 305 + /* Construct struct pt_regs on stack */ 306 + pushq $__USER32_DS /* pt_regs->ss */ 307 + pushq %r8 /* pt_regs->sp */ 308 + pushq %r11 /* pt_regs->flags */ 309 + pushq $__USER32_CS /* pt_regs->cs */ 310 + pushq %rcx /* pt_regs->ip */ 311 + pushq %rax /* pt_regs->orig_ax */ 312 + pushq %rdi /* pt_regs->di */ 313 + pushq %rsi /* pt_regs->si */ 314 + pushq %rdx /* pt_regs->dx */ 315 + pushq %rbp /* pt_regs->cx */ 316 + movl %ebp, %ecx 317 + pushq $-ENOSYS /* pt_regs->ax */ 318 + sub $(10*8), %rsp /* pt_regs->r8-11, bp, bx, r12-15 not saved */ 319 + 320 + /* 321 + * No need to do an access_ok check here because r8 has been 322 + * 32-bit zero extended: 323 + */ 324 + ASM_STAC 325 + 1: movl (%r8), %ebp 326 + _ASM_EXTABLE(1b, ia32_badarg) 327 + ASM_CLAC 328 + orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 329 + testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 330 + jnz cstar_tracesys 331 + 332 + cstar_do_call: 333 + /* 32-bit syscall -> 64-bit C ABI argument conversion */ 334 + movl %edi, %r8d /* arg5 */ 335 + movl %ebp, %r9d /* arg6 */ 336 + xchg %ecx, %esi /* rsi:arg2, rcx:arg4 */ 337 + movl %ebx, %edi /* arg1 */ 338 + movl %edx, %edx /* arg3 (zero extension) */ 339 + 340 + cstar_dispatch: 341 + cmpq $(IA32_NR_syscalls-1), %rax 342 + ja 1f 343 + 344 + call *ia32_sys_call_table(, %rax, 8) 345 + movq %rax, RAX(%rsp) 346 + 1: 347 + DISABLE_INTERRUPTS(CLBR_NONE) 348 + TRACE_IRQS_OFF 349 + testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 350 + jnz sysretl_audit 351 + 352 + sysretl_from_sys_call: 353 + andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 354 + movl RCX(%rsp), %ebp 355 + RESTORE_RSI_RDI_RDX 356 + movl RIP(%rsp), %ecx 357 + movl EFLAGS(%rsp), %r11d 358 + xorq %r10, %r10 359 + xorq %r9, %r9 360 + xorq %r8, %r8 361 + TRACE_IRQS_ON 362 + movl RSP(%rsp), %esp 363 + /* 364 + * 64-bit->32-bit SYSRET restores eip from ecx, 365 + * eflags from r11 (but RF and VM bits are forced to 0), 366 + * cs and ss are loaded from MSRs. 367 + * (Note: 32-bit->32-bit SYSRET is different: since r11 368 + * does not exist, it merely sets eflags.IF=1). 369 + * 370 + * NB: On AMD CPUs with the X86_BUG_SYSRET_SS_ATTRS bug, the ss 371 + * descriptor is not reinitialized. This means that we must 372 + * avoid SYSRET with SS == NULL, which could happen if we schedule, 373 + * exit the kernel, and re-enter using an interrupt vector. (All 374 + * interrupt entries on x86_64 set SS to NULL.) We prevent that 375 + * from happening by reloading SS in __switch_to. 376 + */ 377 + USERGS_SYSRET32 378 + 379 + #ifdef CONFIG_AUDITSYSCALL 380 + cstar_auditsys: 381 + auditsys_entry_common 382 + movl %ebp, %r9d /* reload 6th syscall arg */ 383 + jmp cstar_dispatch 384 + 385 + sysretl_audit: 386 + auditsys_exit sysretl_from_sys_call 387 + #endif 388 + 389 + cstar_tracesys: 390 + #ifdef CONFIG_AUDITSYSCALL 391 + testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 392 + jz cstar_auditsys 393 + #endif 394 + SAVE_EXTRA_REGS 395 + xorl %eax, %eax /* Do not leak kernel information */ 396 + movq %rax, R11(%rsp) 397 + movq %rax, R10(%rsp) 398 + movq %rax, R9(%rsp) 399 + movq %rax, R8(%rsp) 400 + movq %rsp, %rdi /* &pt_regs -> arg1 */ 401 + call syscall_trace_enter 402 + 403 + /* Reload arg registers from stack. (see sysenter_tracesys) */ 404 + movl RCX(%rsp), %ecx 405 + movl RDX(%rsp), %edx 406 + movl RSI(%rsp), %esi 407 + movl RDI(%rsp), %edi 408 + movl %eax, %eax /* zero extension */ 409 + 410 + RESTORE_EXTRA_REGS 411 + jmp cstar_do_call 412 + END(entry_SYSCALL_compat) 413 + 414 + ia32_badarg: 415 + ASM_CLAC 416 + movq $-EFAULT, %rax 417 + jmp ia32_sysret 418 + 419 + ia32_ret_from_sys_call: 420 + xorl %eax, %eax /* Do not leak kernel information */ 421 + movq %rax, R11(%rsp) 422 + movq %rax, R10(%rsp) 423 + movq %rax, R9(%rsp) 424 + movq %rax, R8(%rsp) 425 + jmp int_ret_from_sys_call 426 + 427 + /* 428 + * Emulated IA32 system calls via int 0x80. 429 + * 430 + * Arguments: 431 + * eax system call number 432 + * ebx arg1 433 + * ecx arg2 434 + * edx arg3 435 + * esi arg4 436 + * edi arg5 437 + * ebp arg6 (note: not saved in the stack frame, should not be touched) 438 + * 439 + * Notes: 440 + * Uses the same stack frame as the x86-64 version. 441 + * All registers except eax must be saved (but ptrace may violate that). 442 + * Arguments are zero extended. For system calls that want sign extension and 443 + * take long arguments a wrapper is needed. Most calls can just be called 444 + * directly. 445 + * Assumes it is only called from user space and entered with interrupts off. 446 + */ 447 + 448 + ENTRY(entry_INT80_compat) 449 + /* 450 + * Interrupts are off on entry. 451 + * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 452 + * it is too small to ever cause noticeable irq latency. 453 + */ 454 + PARAVIRT_ADJUST_EXCEPTION_FRAME 455 + SWAPGS 456 + ENABLE_INTERRUPTS(CLBR_NONE) 457 + 458 + /* Zero-extending 32-bit regs, do not remove */ 459 + movl %eax, %eax 460 + 461 + /* Construct struct pt_regs on stack (iret frame is already on stack) */ 462 + pushq %rax /* pt_regs->orig_ax */ 463 + pushq %rdi /* pt_regs->di */ 464 + pushq %rsi /* pt_regs->si */ 465 + pushq %rdx /* pt_regs->dx */ 466 + pushq %rcx /* pt_regs->cx */ 467 + pushq $-ENOSYS /* pt_regs->ax */ 468 + pushq $0 /* pt_regs->r8 */ 469 + pushq $0 /* pt_regs->r9 */ 470 + pushq $0 /* pt_regs->r10 */ 471 + pushq $0 /* pt_regs->r11 */ 472 + cld 473 + sub $(6*8), %rsp /* pt_regs->bp, bx, r12-15 not saved */ 474 + 475 + orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 476 + testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 477 + jnz ia32_tracesys 478 + 479 + ia32_do_call: 480 + /* 32-bit syscall -> 64-bit C ABI argument conversion */ 481 + movl %edi, %r8d /* arg5 */ 482 + movl %ebp, %r9d /* arg6 */ 483 + xchg %ecx, %esi /* rsi:arg2, rcx:arg4 */ 484 + movl %ebx, %edi /* arg1 */ 485 + movl %edx, %edx /* arg3 (zero extension) */ 486 + cmpq $(IA32_NR_syscalls-1), %rax 487 + ja 1f 488 + 489 + call *ia32_sys_call_table(, %rax, 8) /* RIP relative */ 490 + 491 + ia32_sysret: 492 + movq %rax, RAX(%rsp) 493 + 1: 494 + jmp int_ret_from_sys_call 495 + 496 + ia32_tracesys: 497 + SAVE_EXTRA_REGS 498 + movq %rsp, %rdi /* &pt_regs -> arg1 */ 499 + call syscall_trace_enter 500 + /* 501 + * Reload arg registers from stack in case ptrace changed them. 502 + * Don't reload %eax because syscall_trace_enter() returned 503 + * the %rax value we should see. But do truncate it to 32 bits. 504 + * If it's -1 to make us punt the syscall, then (u32)-1 is still 505 + * an appropriately invalid value. 506 + */ 507 + movl RCX(%rsp), %ecx 508 + movl RDX(%rsp), %edx 509 + movl RSI(%rsp), %esi 510 + movl RDI(%rsp), %edi 511 + movl %eax, %eax /* zero extension */ 512 + RESTORE_EXTRA_REGS 513 + jmp ia32_do_call 514 + END(entry_INT80_compat) 515 + 516 + .macro PTREGSCALL label, func 517 + ALIGN 518 + GLOBAL(\label) 519 + leaq \func(%rip), %rax 520 + jmp ia32_ptregs_common 521 + .endm 522 + 523 + PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn 524 + PTREGSCALL stub32_sigreturn, sys32_sigreturn 525 + PTREGSCALL stub32_fork, sys_fork 526 + PTREGSCALL stub32_vfork, sys_vfork 527 + 528 + ALIGN 529 + GLOBAL(stub32_clone) 530 + leaq sys_clone(%rip), %rax 531 + /* 532 + * The 32-bit clone ABI is: clone(..., int tls_val, int *child_tidptr). 533 + * The 64-bit clone ABI is: clone(..., int *child_tidptr, int tls_val). 534 + * 535 + * The native 64-bit kernel's sys_clone() implements the latter, 536 + * so we need to swap arguments here before calling it: 537 + */ 538 + xchg %r8, %rcx 539 + jmp ia32_ptregs_common 540 + 541 + ALIGN 542 + ia32_ptregs_common: 543 + SAVE_EXTRA_REGS 8 544 + call *%rax 545 + RESTORE_EXTRA_REGS 8 546 + ret 547 + END(ia32_ptregs_common)
+7
arch/x86/entry/vsyscall/Makefile
··· 1 + # 2 + # Makefile for the x86 low level vsyscall code 3 + # 4 + obj-y := vsyscall_gtod.o 5 + 6 + obj-$(CONFIG_X86_VSYSCALL_EMULATION) += vsyscall_64.o vsyscall_emu_64.o 7 +
+1 -1
arch/x86/ia32/Makefile
··· 2 2 # Makefile for the ia32 kernel emulation subsystem. 3 3 # 4 4 5 - obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o 5 + obj-$(CONFIG_IA32_EMULATION) := sys_ia32.o ia32_signal.o 6 6 7 7 obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 8 8
-591
arch/x86/ia32/ia32entry.S
··· 1 - /* 2 - * Compatibility mode system call entry point for x86-64. 3 - * 4 - * Copyright 2000-2002 Andi Kleen, SuSE Labs. 5 - */ 6 - 7 - #include <asm/dwarf2.h> 8 - #include <asm/calling.h> 9 - #include <asm/asm-offsets.h> 10 - #include <asm/current.h> 11 - #include <asm/errno.h> 12 - #include <asm/ia32_unistd.h> 13 - #include <asm/thread_info.h> 14 - #include <asm/segment.h> 15 - #include <asm/irqflags.h> 16 - #include <asm/asm.h> 17 - #include <asm/smap.h> 18 - #include <linux/linkage.h> 19 - #include <linux/err.h> 20 - 21 - /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 22 - #include <linux/elf-em.h> 23 - #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 24 - #define __AUDIT_ARCH_LE 0x40000000 25 - 26 - #ifndef CONFIG_AUDITSYSCALL 27 - #define sysexit_audit ia32_ret_from_sys_call 28 - #define sysretl_audit ia32_ret_from_sys_call 29 - #endif 30 - 31 - .section .entry.text, "ax" 32 - 33 - /* clobbers %rax */ 34 - .macro CLEAR_RREGS _r9=rax 35 - xorl %eax,%eax 36 - movq %rax,R11(%rsp) 37 - movq %rax,R10(%rsp) 38 - movq %\_r9,R9(%rsp) 39 - movq %rax,R8(%rsp) 40 - .endm 41 - 42 - /* 43 - * Reload arg registers from stack in case ptrace changed them. 44 - * We don't reload %eax because syscall_trace_enter() returned 45 - * the %rax value we should see. Instead, we just truncate that 46 - * value to 32 bits again as we did on entry from user mode. 47 - * If it's a new value set by user_regset during entry tracing, 48 - * this matches the normal truncation of the user-mode value. 49 - * If it's -1 to make us punt the syscall, then (u32)-1 is still 50 - * an appropriately invalid value. 51 - */ 52 - .macro LOAD_ARGS32 _r9=0 53 - .if \_r9 54 - movl R9(%rsp),%r9d 55 - .endif 56 - movl RCX(%rsp),%ecx 57 - movl RDX(%rsp),%edx 58 - movl RSI(%rsp),%esi 59 - movl RDI(%rsp),%edi 60 - movl %eax,%eax /* zero extension */ 61 - .endm 62 - 63 - .macro CFI_STARTPROC32 simple 64 - CFI_STARTPROC \simple 65 - CFI_UNDEFINED r8 66 - CFI_UNDEFINED r9 67 - CFI_UNDEFINED r10 68 - CFI_UNDEFINED r11 69 - CFI_UNDEFINED r12 70 - CFI_UNDEFINED r13 71 - CFI_UNDEFINED r14 72 - CFI_UNDEFINED r15 73 - .endm 74 - 75 - #ifdef CONFIG_PARAVIRT 76 - ENTRY(native_usergs_sysret32) 77 - swapgs 78 - sysretl 79 - ENDPROC(native_usergs_sysret32) 80 - #endif 81 - 82 - /* 83 - * 32bit SYSENTER instruction entry. 84 - * 85 - * SYSENTER loads ss, rsp, cs, and rip from previously programmed MSRs. 86 - * IF and VM in rflags are cleared (IOW: interrupts are off). 87 - * SYSENTER does not save anything on the stack, 88 - * and does not save old rip (!!!) and rflags. 89 - * 90 - * Arguments: 91 - * eax system call number 92 - * ebx arg1 93 - * ecx arg2 94 - * edx arg3 95 - * esi arg4 96 - * edi arg5 97 - * ebp user stack 98 - * 0(%ebp) arg6 99 - * 100 - * This is purely a fast path. For anything complicated we use the int 0x80 101 - * path below. We set up a complete hardware stack frame to share code 102 - * with the int 0x80 path. 103 - */ 104 - ENTRY(ia32_sysenter_target) 105 - CFI_STARTPROC32 simple 106 - CFI_SIGNAL_FRAME 107 - CFI_DEF_CFA rsp,0 108 - CFI_REGISTER rsp,rbp 109 - 110 - /* 111 - * Interrupts are off on entry. 112 - * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 113 - * it is too small to ever cause noticeable irq latency. 114 - */ 115 - SWAPGS_UNSAFE_STACK 116 - movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp 117 - ENABLE_INTERRUPTS(CLBR_NONE) 118 - 119 - /* Zero-extending 32-bit regs, do not remove */ 120 - movl %ebp, %ebp 121 - movl %eax, %eax 122 - 123 - movl ASM_THREAD_INFO(TI_sysenter_return, %rsp, 0), %r10d 124 - CFI_REGISTER rip,r10 125 - 126 - /* Construct struct pt_regs on stack */ 127 - pushq_cfi $__USER32_DS /* pt_regs->ss */ 128 - pushq_cfi %rbp /* pt_regs->sp */ 129 - CFI_REL_OFFSET rsp,0 130 - pushfq_cfi /* pt_regs->flags */ 131 - pushq_cfi $__USER32_CS /* pt_regs->cs */ 132 - pushq_cfi %r10 /* pt_regs->ip = thread_info->sysenter_return */ 133 - CFI_REL_OFFSET rip,0 134 - pushq_cfi_reg rax /* pt_regs->orig_ax */ 135 - pushq_cfi_reg rdi /* pt_regs->di */ 136 - pushq_cfi_reg rsi /* pt_regs->si */ 137 - pushq_cfi_reg rdx /* pt_regs->dx */ 138 - pushq_cfi_reg rcx /* pt_regs->cx */ 139 - pushq_cfi $-ENOSYS /* pt_regs->ax */ 140 - cld 141 - sub $(10*8),%rsp /* pt_regs->r8-11,bp,bx,r12-15 not saved */ 142 - CFI_ADJUST_CFA_OFFSET 10*8 143 - 144 - /* 145 - * no need to do an access_ok check here because rbp has been 146 - * 32bit zero extended 147 - */ 148 - ASM_STAC 149 - 1: movl (%rbp),%ebp 150 - _ASM_EXTABLE(1b,ia32_badarg) 151 - ASM_CLAC 152 - 153 - /* 154 - * Sysenter doesn't filter flags, so we need to clear NT 155 - * ourselves. To save a few cycles, we can check whether 156 - * NT was set instead of doing an unconditional popfq. 157 - */ 158 - testl $X86_EFLAGS_NT,EFLAGS(%rsp) 159 - jnz sysenter_fix_flags 160 - sysenter_flags_fixed: 161 - 162 - orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 163 - testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 164 - CFI_REMEMBER_STATE 165 - jnz sysenter_tracesys 166 - sysenter_do_call: 167 - /* 32bit syscall -> 64bit C ABI argument conversion */ 168 - movl %edi,%r8d /* arg5 */ 169 - movl %ebp,%r9d /* arg6 */ 170 - xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */ 171 - movl %ebx,%edi /* arg1 */ 172 - movl %edx,%edx /* arg3 (zero extension) */ 173 - sysenter_dispatch: 174 - cmpq $(IA32_NR_syscalls-1),%rax 175 - ja 1f 176 - call *ia32_sys_call_table(,%rax,8) 177 - movq %rax,RAX(%rsp) 178 - 1: 179 - DISABLE_INTERRUPTS(CLBR_NONE) 180 - TRACE_IRQS_OFF 181 - testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 182 - jnz sysexit_audit 183 - sysexit_from_sys_call: 184 - /* 185 - * NB: SYSEXIT is not obviously safe for 64-bit kernels -- an 186 - * NMI between STI and SYSEXIT has poorly specified behavior, 187 - * and and NMI followed by an IRQ with usergs is fatal. So 188 - * we just pretend we're using SYSEXIT but we really use 189 - * SYSRETL instead. 190 - * 191 - * This code path is still called 'sysexit' because it pairs 192 - * with 'sysenter' and it uses the SYSENTER calling convention. 193 - */ 194 - andl $~TS_COMPAT,ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 195 - movl RIP(%rsp),%ecx /* User %eip */ 196 - CFI_REGISTER rip,rcx 197 - RESTORE_RSI_RDI 198 - xorl %edx,%edx /* avoid info leaks */ 199 - xorq %r8,%r8 200 - xorq %r9,%r9 201 - xorq %r10,%r10 202 - movl EFLAGS(%rsp),%r11d /* User eflags */ 203 - /*CFI_RESTORE rflags*/ 204 - TRACE_IRQS_ON 205 - 206 - /* 207 - * SYSRETL works even on Intel CPUs. Use it in preference to SYSEXIT, 208 - * since it avoids a dicey window with interrupts enabled. 209 - */ 210 - movl RSP(%rsp),%esp 211 - 212 - /* 213 - * USERGS_SYSRET32 does: 214 - * gsbase = user's gs base 215 - * eip = ecx 216 - * rflags = r11 217 - * cs = __USER32_CS 218 - * ss = __USER_DS 219 - * 220 - * The prologue set RIP(%rsp) to VDSO32_SYSENTER_RETURN, which does: 221 - * 222 - * pop %ebp 223 - * pop %edx 224 - * pop %ecx 225 - * 226 - * Therefore, we invoke SYSRETL with EDX and R8-R10 zeroed to 227 - * avoid info leaks. R11 ends up with VDSO32_SYSENTER_RETURN's 228 - * address (already known to user code), and R12-R15 are 229 - * callee-saved and therefore don't contain any interesting 230 - * kernel data. 231 - */ 232 - USERGS_SYSRET32 233 - 234 - CFI_RESTORE_STATE 235 - 236 - #ifdef CONFIG_AUDITSYSCALL 237 - .macro auditsys_entry_common 238 - movl %esi,%r8d /* 5th arg: 4th syscall arg */ 239 - movl %ecx,%r9d /*swap with edx*/ 240 - movl %edx,%ecx /* 4th arg: 3rd syscall arg */ 241 - movl %r9d,%edx /* 3rd arg: 2nd syscall arg */ 242 - movl %ebx,%esi /* 2nd arg: 1st syscall arg */ 243 - movl %eax,%edi /* 1st arg: syscall number */ 244 - call __audit_syscall_entry 245 - movl ORIG_RAX(%rsp),%eax /* reload syscall number */ 246 - movl %ebx,%edi /* reload 1st syscall arg */ 247 - movl RCX(%rsp),%esi /* reload 2nd syscall arg */ 248 - movl RDX(%rsp),%edx /* reload 3rd syscall arg */ 249 - movl RSI(%rsp),%ecx /* reload 4th syscall arg */ 250 - movl RDI(%rsp),%r8d /* reload 5th syscall arg */ 251 - .endm 252 - 253 - .macro auditsys_exit exit 254 - testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 255 - jnz ia32_ret_from_sys_call 256 - TRACE_IRQS_ON 257 - ENABLE_INTERRUPTS(CLBR_NONE) 258 - movl %eax,%esi /* second arg, syscall return value */ 259 - cmpl $-MAX_ERRNO,%eax /* is it an error ? */ 260 - jbe 1f 261 - movslq %eax, %rsi /* if error sign extend to 64 bits */ 262 - 1: setbe %al /* 1 if error, 0 if not */ 263 - movzbl %al,%edi /* zero-extend that into %edi */ 264 - call __audit_syscall_exit 265 - movq RAX(%rsp),%rax /* reload syscall return value */ 266 - movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi 267 - DISABLE_INTERRUPTS(CLBR_NONE) 268 - TRACE_IRQS_OFF 269 - testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 270 - jz \exit 271 - CLEAR_RREGS 272 - jmp int_with_check 273 - .endm 274 - 275 - sysenter_auditsys: 276 - auditsys_entry_common 277 - movl %ebp,%r9d /* reload 6th syscall arg */ 278 - jmp sysenter_dispatch 279 - 280 - sysexit_audit: 281 - auditsys_exit sysexit_from_sys_call 282 - #endif 283 - 284 - sysenter_fix_flags: 285 - pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED) 286 - popfq_cfi 287 - jmp sysenter_flags_fixed 288 - 289 - sysenter_tracesys: 290 - #ifdef CONFIG_AUDITSYSCALL 291 - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 292 - jz sysenter_auditsys 293 - #endif 294 - SAVE_EXTRA_REGS 295 - CLEAR_RREGS 296 - movq %rsp,%rdi /* &pt_regs -> arg1 */ 297 - call syscall_trace_enter 298 - LOAD_ARGS32 /* reload args from stack in case ptrace changed it */ 299 - RESTORE_EXTRA_REGS 300 - jmp sysenter_do_call 301 - CFI_ENDPROC 302 - ENDPROC(ia32_sysenter_target) 303 - 304 - /* 305 - * 32bit SYSCALL instruction entry. 306 - * 307 - * 32bit SYSCALL saves rip to rcx, clears rflags.RF, then saves rflags to r11, 308 - * then loads new ss, cs, and rip from previously programmed MSRs. 309 - * rflags gets masked by a value from another MSR (so CLD and CLAC 310 - * are not needed). SYSCALL does not save anything on the stack 311 - * and does not change rsp. 312 - * 313 - * Note: rflags saving+masking-with-MSR happens only in Long mode 314 - * (in legacy 32bit mode, IF, RF and VM bits are cleared and that's it). 315 - * Don't get confused: rflags saving+masking depends on Long Mode Active bit 316 - * (EFER.LMA=1), NOT on bitness of userspace where SYSCALL executes 317 - * or target CS descriptor's L bit (SYSCALL does not read segment descriptors). 318 - * 319 - * Arguments: 320 - * eax system call number 321 - * ecx return address 322 - * ebx arg1 323 - * ebp arg2 (note: not saved in the stack frame, should not be touched) 324 - * edx arg3 325 - * esi arg4 326 - * edi arg5 327 - * esp user stack 328 - * 0(%esp) arg6 329 - * 330 - * This is purely a fast path. For anything complicated we use the int 0x80 331 - * path below. We set up a complete hardware stack frame to share code 332 - * with the int 0x80 path. 333 - */ 334 - ENTRY(ia32_cstar_target) 335 - CFI_STARTPROC32 simple 336 - CFI_SIGNAL_FRAME 337 - CFI_DEF_CFA rsp,0 338 - CFI_REGISTER rip,rcx 339 - /*CFI_REGISTER rflags,r11*/ 340 - 341 - /* 342 - * Interrupts are off on entry. 343 - * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 344 - * it is too small to ever cause noticeable irq latency. 345 - */ 346 - SWAPGS_UNSAFE_STACK 347 - movl %esp,%r8d 348 - CFI_REGISTER rsp,r8 349 - movq PER_CPU_VAR(cpu_current_top_of_stack),%rsp 350 - ENABLE_INTERRUPTS(CLBR_NONE) 351 - 352 - /* Zero-extending 32-bit regs, do not remove */ 353 - movl %eax,%eax 354 - 355 - /* Construct struct pt_regs on stack */ 356 - pushq_cfi $__USER32_DS /* pt_regs->ss */ 357 - pushq_cfi %r8 /* pt_regs->sp */ 358 - CFI_REL_OFFSET rsp,0 359 - pushq_cfi %r11 /* pt_regs->flags */ 360 - pushq_cfi $__USER32_CS /* pt_regs->cs */ 361 - pushq_cfi %rcx /* pt_regs->ip */ 362 - CFI_REL_OFFSET rip,0 363 - pushq_cfi_reg rax /* pt_regs->orig_ax */ 364 - pushq_cfi_reg rdi /* pt_regs->di */ 365 - pushq_cfi_reg rsi /* pt_regs->si */ 366 - pushq_cfi_reg rdx /* pt_regs->dx */ 367 - pushq_cfi_reg rbp /* pt_regs->cx */ 368 - movl %ebp,%ecx 369 - pushq_cfi $-ENOSYS /* pt_regs->ax */ 370 - sub $(10*8),%rsp /* pt_regs->r8-11,bp,bx,r12-15 not saved */ 371 - CFI_ADJUST_CFA_OFFSET 10*8 372 - 373 - /* 374 - * no need to do an access_ok check here because r8 has been 375 - * 32bit zero extended 376 - */ 377 - ASM_STAC 378 - 1: movl (%r8),%r9d 379 - _ASM_EXTABLE(1b,ia32_badarg) 380 - ASM_CLAC 381 - orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 382 - testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 383 - CFI_REMEMBER_STATE 384 - jnz cstar_tracesys 385 - cstar_do_call: 386 - /* 32bit syscall -> 64bit C ABI argument conversion */ 387 - movl %edi,%r8d /* arg5 */ 388 - /* r9 already loaded */ /* arg6 */ 389 - xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */ 390 - movl %ebx,%edi /* arg1 */ 391 - movl %edx,%edx /* arg3 (zero extension) */ 392 - cstar_dispatch: 393 - cmpq $(IA32_NR_syscalls-1),%rax 394 - ja 1f 395 - call *ia32_sys_call_table(,%rax,8) 396 - movq %rax,RAX(%rsp) 397 - 1: 398 - DISABLE_INTERRUPTS(CLBR_NONE) 399 - TRACE_IRQS_OFF 400 - testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 401 - jnz sysretl_audit 402 - sysretl_from_sys_call: 403 - andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 404 - RESTORE_RSI_RDI_RDX 405 - movl RIP(%rsp),%ecx 406 - CFI_REGISTER rip,rcx 407 - movl EFLAGS(%rsp),%r11d 408 - /*CFI_REGISTER rflags,r11*/ 409 - xorq %r10,%r10 410 - xorq %r9,%r9 411 - xorq %r8,%r8 412 - TRACE_IRQS_ON 413 - movl RSP(%rsp),%esp 414 - CFI_RESTORE rsp 415 - /* 416 - * 64bit->32bit SYSRET restores eip from ecx, 417 - * eflags from r11 (but RF and VM bits are forced to 0), 418 - * cs and ss are loaded from MSRs. 419 - * (Note: 32bit->32bit SYSRET is different: since r11 420 - * does not exist, it merely sets eflags.IF=1). 421 - * 422 - * NB: On AMD CPUs with the X86_BUG_SYSRET_SS_ATTRS bug, the ss 423 - * descriptor is not reinitialized. This means that we must 424 - * avoid SYSRET with SS == NULL, which could happen if we schedule, 425 - * exit the kernel, and re-enter using an interrupt vector. (All 426 - * interrupt entries on x86_64 set SS to NULL.) We prevent that 427 - * from happening by reloading SS in __switch_to. 428 - */ 429 - USERGS_SYSRET32 430 - 431 - #ifdef CONFIG_AUDITSYSCALL 432 - cstar_auditsys: 433 - CFI_RESTORE_STATE 434 - movl %r9d,R9(%rsp) /* register to be clobbered by call */ 435 - auditsys_entry_common 436 - movl R9(%rsp),%r9d /* reload 6th syscall arg */ 437 - jmp cstar_dispatch 438 - 439 - sysretl_audit: 440 - auditsys_exit sysretl_from_sys_call 441 - #endif 442 - 443 - cstar_tracesys: 444 - #ifdef CONFIG_AUDITSYSCALL 445 - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT), ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 446 - jz cstar_auditsys 447 - #endif 448 - xchgl %r9d,%ebp 449 - SAVE_EXTRA_REGS 450 - CLEAR_RREGS r9 451 - movq %rsp,%rdi /* &pt_regs -> arg1 */ 452 - call syscall_trace_enter 453 - LOAD_ARGS32 1 /* reload args from stack in case ptrace changed it */ 454 - RESTORE_EXTRA_REGS 455 - xchgl %ebp,%r9d 456 - jmp cstar_do_call 457 - END(ia32_cstar_target) 458 - 459 - ia32_badarg: 460 - ASM_CLAC 461 - movq $-EFAULT,%rax 462 - jmp ia32_sysret 463 - CFI_ENDPROC 464 - 465 - /* 466 - * Emulated IA32 system calls via int 0x80. 467 - * 468 - * Arguments: 469 - * eax system call number 470 - * ebx arg1 471 - * ecx arg2 472 - * edx arg3 473 - * esi arg4 474 - * edi arg5 475 - * ebp arg6 (note: not saved in the stack frame, should not be touched) 476 - * 477 - * Notes: 478 - * Uses the same stack frame as the x86-64 version. 479 - * All registers except eax must be saved (but ptrace may violate that). 480 - * Arguments are zero extended. For system calls that want sign extension and 481 - * take long arguments a wrapper is needed. Most calls can just be called 482 - * directly. 483 - * Assumes it is only called from user space and entered with interrupts off. 484 - */ 485 - 486 - ENTRY(ia32_syscall) 487 - CFI_STARTPROC32 simple 488 - CFI_SIGNAL_FRAME 489 - CFI_DEF_CFA rsp,5*8 490 - /*CFI_REL_OFFSET ss,4*8 */ 491 - CFI_REL_OFFSET rsp,3*8 492 - /*CFI_REL_OFFSET rflags,2*8 */ 493 - /*CFI_REL_OFFSET cs,1*8 */ 494 - CFI_REL_OFFSET rip,0*8 495 - 496 - /* 497 - * Interrupts are off on entry. 498 - * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, 499 - * it is too small to ever cause noticeable irq latency. 500 - */ 501 - PARAVIRT_ADJUST_EXCEPTION_FRAME 502 - SWAPGS 503 - ENABLE_INTERRUPTS(CLBR_NONE) 504 - 505 - /* Zero-extending 32-bit regs, do not remove */ 506 - movl %eax,%eax 507 - 508 - /* Construct struct pt_regs on stack (iret frame is already on stack) */ 509 - pushq_cfi_reg rax /* pt_regs->orig_ax */ 510 - pushq_cfi_reg rdi /* pt_regs->di */ 511 - pushq_cfi_reg rsi /* pt_regs->si */ 512 - pushq_cfi_reg rdx /* pt_regs->dx */ 513 - pushq_cfi_reg rcx /* pt_regs->cx */ 514 - pushq_cfi $-ENOSYS /* pt_regs->ax */ 515 - cld 516 - sub $(10*8),%rsp /* pt_regs->r8-11,bp,bx,r12-15 not saved */ 517 - CFI_ADJUST_CFA_OFFSET 10*8 518 - 519 - orl $TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) 520 - testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 521 - jnz ia32_tracesys 522 - ia32_do_call: 523 - /* 32bit syscall -> 64bit C ABI argument conversion */ 524 - movl %edi,%r8d /* arg5 */ 525 - movl %ebp,%r9d /* arg6 */ 526 - xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */ 527 - movl %ebx,%edi /* arg1 */ 528 - movl %edx,%edx /* arg3 (zero extension) */ 529 - cmpq $(IA32_NR_syscalls-1),%rax 530 - ja 1f 531 - call *ia32_sys_call_table(,%rax,8) # xxx: rip relative 532 - ia32_sysret: 533 - movq %rax,RAX(%rsp) 534 - 1: 535 - ia32_ret_from_sys_call: 536 - CLEAR_RREGS 537 - jmp int_ret_from_sys_call 538 - 539 - ia32_tracesys: 540 - SAVE_EXTRA_REGS 541 - CLEAR_RREGS 542 - movq %rsp,%rdi /* &pt_regs -> arg1 */ 543 - call syscall_trace_enter 544 - LOAD_ARGS32 /* reload args from stack in case ptrace changed it */ 545 - RESTORE_EXTRA_REGS 546 - jmp ia32_do_call 547 - CFI_ENDPROC 548 - END(ia32_syscall) 549 - 550 - .macro PTREGSCALL label, func 551 - ALIGN 552 - GLOBAL(\label) 553 - leaq \func(%rip),%rax 554 - jmp ia32_ptregs_common 555 - .endm 556 - 557 - CFI_STARTPROC32 558 - 559 - PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn 560 - PTREGSCALL stub32_sigreturn, sys32_sigreturn 561 - PTREGSCALL stub32_fork, sys_fork 562 - PTREGSCALL stub32_vfork, sys_vfork 563 - 564 - ALIGN 565 - GLOBAL(stub32_clone) 566 - leaq sys_clone(%rip),%rax 567 - mov %r8, %rcx 568 - jmp ia32_ptregs_common 569 - 570 - ALIGN 571 - ia32_ptregs_common: 572 - CFI_ENDPROC 573 - CFI_STARTPROC32 simple 574 - CFI_SIGNAL_FRAME 575 - CFI_DEF_CFA rsp,SIZEOF_PTREGS 576 - CFI_REL_OFFSET rax,RAX 577 - CFI_REL_OFFSET rcx,RCX 578 - CFI_REL_OFFSET rdx,RDX 579 - CFI_REL_OFFSET rsi,RSI 580 - CFI_REL_OFFSET rdi,RDI 581 - CFI_REL_OFFSET rip,RIP 582 - /* CFI_REL_OFFSET cs,CS*/ 583 - /* CFI_REL_OFFSET rflags,EFLAGS*/ 584 - CFI_REL_OFFSET rsp,RSP 585 - /* CFI_REL_OFFSET ss,SS*/ 586 - SAVE_EXTRA_REGS 8 587 - call *%rax 588 - RESTORE_EXTRA_REGS 8 589 - ret 590 - CFI_ENDPROC 591 - END(ia32_ptregs_common)
+47 -51
arch/x86/include/asm/calling.h arch/x86/entry/calling.h
··· 46 46 47 47 */ 48 48 49 - #include <asm/dwarf2.h> 50 - 51 49 #ifdef CONFIG_X86_64 52 50 53 51 /* ··· 89 91 #define SIZEOF_PTREGS 21*8 90 92 91 93 .macro ALLOC_PT_GPREGS_ON_STACK addskip=0 92 - subq $15*8+\addskip, %rsp 93 - CFI_ADJUST_CFA_OFFSET 15*8+\addskip 94 + addq $-(15*8+\addskip), %rsp 94 95 .endm 95 96 96 97 .macro SAVE_C_REGS_HELPER offset=0 rax=1 rcx=1 r8910=1 r11=1 97 98 .if \r11 98 - movq_cfi r11, 6*8+\offset 99 + movq %r11, 6*8+\offset(%rsp) 99 100 .endif 100 101 .if \r8910 101 - movq_cfi r10, 7*8+\offset 102 - movq_cfi r9, 8*8+\offset 103 - movq_cfi r8, 9*8+\offset 102 + movq %r10, 7*8+\offset(%rsp) 103 + movq %r9, 8*8+\offset(%rsp) 104 + movq %r8, 9*8+\offset(%rsp) 104 105 .endif 105 106 .if \rax 106 - movq_cfi rax, 10*8+\offset 107 + movq %rax, 10*8+\offset(%rsp) 107 108 .endif 108 109 .if \rcx 109 - movq_cfi rcx, 11*8+\offset 110 + movq %rcx, 11*8+\offset(%rsp) 110 111 .endif 111 - movq_cfi rdx, 12*8+\offset 112 - movq_cfi rsi, 13*8+\offset 113 - movq_cfi rdi, 14*8+\offset 112 + movq %rdx, 12*8+\offset(%rsp) 113 + movq %rsi, 13*8+\offset(%rsp) 114 + movq %rdi, 14*8+\offset(%rsp) 114 115 .endm 115 116 .macro SAVE_C_REGS offset=0 116 117 SAVE_C_REGS_HELPER \offset, 1, 1, 1, 1 ··· 128 131 .endm 129 132 130 133 .macro SAVE_EXTRA_REGS offset=0 131 - movq_cfi r15, 0*8+\offset 132 - movq_cfi r14, 1*8+\offset 133 - movq_cfi r13, 2*8+\offset 134 - movq_cfi r12, 3*8+\offset 135 - movq_cfi rbp, 4*8+\offset 136 - movq_cfi rbx, 5*8+\offset 134 + movq %r15, 0*8+\offset(%rsp) 135 + movq %r14, 1*8+\offset(%rsp) 136 + movq %r13, 2*8+\offset(%rsp) 137 + movq %r12, 3*8+\offset(%rsp) 138 + movq %rbp, 4*8+\offset(%rsp) 139 + movq %rbx, 5*8+\offset(%rsp) 137 140 .endm 138 141 .macro SAVE_EXTRA_REGS_RBP offset=0 139 - movq_cfi rbp, 4*8+\offset 142 + movq %rbp, 4*8+\offset(%rsp) 140 143 .endm 141 144 142 145 .macro RESTORE_EXTRA_REGS offset=0 143 - movq_cfi_restore 0*8+\offset, r15 144 - movq_cfi_restore 1*8+\offset, r14 145 - movq_cfi_restore 2*8+\offset, r13 146 - movq_cfi_restore 3*8+\offset, r12 147 - movq_cfi_restore 4*8+\offset, rbp 148 - movq_cfi_restore 5*8+\offset, rbx 146 + movq 0*8+\offset(%rsp), %r15 147 + movq 1*8+\offset(%rsp), %r14 148 + movq 2*8+\offset(%rsp), %r13 149 + movq 3*8+\offset(%rsp), %r12 150 + movq 4*8+\offset(%rsp), %rbp 151 + movq 5*8+\offset(%rsp), %rbx 149 152 .endm 150 153 151 154 .macro ZERO_EXTRA_REGS ··· 159 162 160 163 .macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1 161 164 .if \rstor_r11 162 - movq_cfi_restore 6*8, r11 165 + movq 6*8(%rsp), %r11 163 166 .endif 164 167 .if \rstor_r8910 165 - movq_cfi_restore 7*8, r10 166 - movq_cfi_restore 8*8, r9 167 - movq_cfi_restore 9*8, r8 168 + movq 7*8(%rsp), %r10 169 + movq 8*8(%rsp), %r9 170 + movq 9*8(%rsp), %r8 168 171 .endif 169 172 .if \rstor_rax 170 - movq_cfi_restore 10*8, rax 173 + movq 10*8(%rsp), %rax 171 174 .endif 172 175 .if \rstor_rcx 173 - movq_cfi_restore 11*8, rcx 176 + movq 11*8(%rsp), %rcx 174 177 .endif 175 178 .if \rstor_rdx 176 - movq_cfi_restore 12*8, rdx 179 + movq 12*8(%rsp), %rdx 177 180 .endif 178 - movq_cfi_restore 13*8, rsi 179 - movq_cfi_restore 14*8, rdi 181 + movq 13*8(%rsp), %rsi 182 + movq 14*8(%rsp), %rdi 180 183 .endm 181 184 .macro RESTORE_C_REGS 182 185 RESTORE_C_REGS_HELPER 1,1,1,1,1 ··· 201 204 .endm 202 205 203 206 .macro REMOVE_PT_GPREGS_FROM_STACK addskip=0 204 - addq $15*8+\addskip, %rsp 205 - CFI_ADJUST_CFA_OFFSET -(15*8+\addskip) 207 + subq $-(15*8+\addskip), %rsp 206 208 .endm 207 209 208 210 .macro icebp ··· 220 224 */ 221 225 222 226 .macro SAVE_ALL 223 - pushl_cfi_reg eax 224 - pushl_cfi_reg ebp 225 - pushl_cfi_reg edi 226 - pushl_cfi_reg esi 227 - pushl_cfi_reg edx 228 - pushl_cfi_reg ecx 229 - pushl_cfi_reg ebx 227 + pushl %eax 228 + pushl %ebp 229 + pushl %edi 230 + pushl %esi 231 + pushl %edx 232 + pushl %ecx 233 + pushl %ebx 230 234 .endm 231 235 232 236 .macro RESTORE_ALL 233 - popl_cfi_reg ebx 234 - popl_cfi_reg ecx 235 - popl_cfi_reg edx 236 - popl_cfi_reg esi 237 - popl_cfi_reg edi 238 - popl_cfi_reg ebp 239 - popl_cfi_reg eax 237 + popl %ebx 238 + popl %ecx 239 + popl %edx 240 + popl %esi 241 + popl %edi 242 + popl %ebp 243 + popl %eax 240 244 .endm 241 245 242 246 #endif /* CONFIG_X86_64 */
-170
arch/x86/include/asm/dwarf2.h
··· 1 - #ifndef _ASM_X86_DWARF2_H 2 - #define _ASM_X86_DWARF2_H 3 - 4 - #ifndef __ASSEMBLY__ 5 - #warning "asm/dwarf2.h should be only included in pure assembly files" 6 - #endif 7 - 8 - /* 9 - * Macros for dwarf2 CFI unwind table entries. 10 - * See "as.info" for details on these pseudo ops. Unfortunately 11 - * they are only supported in very new binutils, so define them 12 - * away for older version. 13 - */ 14 - 15 - #ifdef CONFIG_AS_CFI 16 - 17 - #define CFI_STARTPROC .cfi_startproc 18 - #define CFI_ENDPROC .cfi_endproc 19 - #define CFI_DEF_CFA .cfi_def_cfa 20 - #define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register 21 - #define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset 22 - #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset 23 - #define CFI_OFFSET .cfi_offset 24 - #define CFI_REL_OFFSET .cfi_rel_offset 25 - #define CFI_REGISTER .cfi_register 26 - #define CFI_RESTORE .cfi_restore 27 - #define CFI_REMEMBER_STATE .cfi_remember_state 28 - #define CFI_RESTORE_STATE .cfi_restore_state 29 - #define CFI_UNDEFINED .cfi_undefined 30 - #define CFI_ESCAPE .cfi_escape 31 - 32 - #ifdef CONFIG_AS_CFI_SIGNAL_FRAME 33 - #define CFI_SIGNAL_FRAME .cfi_signal_frame 34 - #else 35 - #define CFI_SIGNAL_FRAME 36 - #endif 37 - 38 - #if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__) 39 - /* 40 - * Emit CFI data in .debug_frame sections, not .eh_frame sections. 41 - * The latter we currently just discard since we don't do DWARF 42 - * unwinding at runtime. So only the offline DWARF information is 43 - * useful to anyone. Note we should not use this directive if this 44 - * file is used in the vDSO assembly, or if vmlinux.lds.S gets 45 - * changed so it doesn't discard .eh_frame. 46 - */ 47 - .cfi_sections .debug_frame 48 - #endif 49 - 50 - #else 51 - 52 - /* 53 - * Due to the structure of pre-exisiting code, don't use assembler line 54 - * comment character # to ignore the arguments. Instead, use a dummy macro. 55 - */ 56 - .macro cfi_ignore a=0, b=0, c=0, d=0 57 - .endm 58 - 59 - #define CFI_STARTPROC cfi_ignore 60 - #define CFI_ENDPROC cfi_ignore 61 - #define CFI_DEF_CFA cfi_ignore 62 - #define CFI_DEF_CFA_REGISTER cfi_ignore 63 - #define CFI_DEF_CFA_OFFSET cfi_ignore 64 - #define CFI_ADJUST_CFA_OFFSET cfi_ignore 65 - #define CFI_OFFSET cfi_ignore 66 - #define CFI_REL_OFFSET cfi_ignore 67 - #define CFI_REGISTER cfi_ignore 68 - #define CFI_RESTORE cfi_ignore 69 - #define CFI_REMEMBER_STATE cfi_ignore 70 - #define CFI_RESTORE_STATE cfi_ignore 71 - #define CFI_UNDEFINED cfi_ignore 72 - #define CFI_ESCAPE cfi_ignore 73 - #define CFI_SIGNAL_FRAME cfi_ignore 74 - 75 - #endif 76 - 77 - /* 78 - * An attempt to make CFI annotations more or less 79 - * correct and shorter. It is implied that you know 80 - * what you're doing if you use them. 81 - */ 82 - #ifdef __ASSEMBLY__ 83 - #ifdef CONFIG_X86_64 84 - .macro pushq_cfi reg 85 - pushq \reg 86 - CFI_ADJUST_CFA_OFFSET 8 87 - .endm 88 - 89 - .macro pushq_cfi_reg reg 90 - pushq %\reg 91 - CFI_ADJUST_CFA_OFFSET 8 92 - CFI_REL_OFFSET \reg, 0 93 - .endm 94 - 95 - .macro popq_cfi reg 96 - popq \reg 97 - CFI_ADJUST_CFA_OFFSET -8 98 - .endm 99 - 100 - .macro popq_cfi_reg reg 101 - popq %\reg 102 - CFI_ADJUST_CFA_OFFSET -8 103 - CFI_RESTORE \reg 104 - .endm 105 - 106 - .macro pushfq_cfi 107 - pushfq 108 - CFI_ADJUST_CFA_OFFSET 8 109 - .endm 110 - 111 - .macro popfq_cfi 112 - popfq 113 - CFI_ADJUST_CFA_OFFSET -8 114 - .endm 115 - 116 - .macro movq_cfi reg offset=0 117 - movq %\reg, \offset(%rsp) 118 - CFI_REL_OFFSET \reg, \offset 119 - .endm 120 - 121 - .macro movq_cfi_restore offset reg 122 - movq \offset(%rsp), %\reg 123 - CFI_RESTORE \reg 124 - .endm 125 - #else /*!CONFIG_X86_64*/ 126 - .macro pushl_cfi reg 127 - pushl \reg 128 - CFI_ADJUST_CFA_OFFSET 4 129 - .endm 130 - 131 - .macro pushl_cfi_reg reg 132 - pushl %\reg 133 - CFI_ADJUST_CFA_OFFSET 4 134 - CFI_REL_OFFSET \reg, 0 135 - .endm 136 - 137 - .macro popl_cfi reg 138 - popl \reg 139 - CFI_ADJUST_CFA_OFFSET -4 140 - .endm 141 - 142 - .macro popl_cfi_reg reg 143 - popl %\reg 144 - CFI_ADJUST_CFA_OFFSET -4 145 - CFI_RESTORE \reg 146 - .endm 147 - 148 - .macro pushfl_cfi 149 - pushfl 150 - CFI_ADJUST_CFA_OFFSET 4 151 - .endm 152 - 153 - .macro popfl_cfi 154 - popfl 155 - CFI_ADJUST_CFA_OFFSET -4 156 - .endm 157 - 158 - .macro movl_cfi reg offset=0 159 - movl %\reg, \offset(%esp) 160 - CFI_REL_OFFSET \reg, \offset 161 - .endm 162 - 163 - .macro movl_cfi_restore offset reg 164 - movl \offset(%esp), %\reg 165 - CFI_RESTORE \reg 166 - .endm 167 - #endif /*!CONFIG_X86_64*/ 168 - #endif /*__ASSEMBLY__*/ 169 - 170 - #endif /* _ASM_X86_DWARF2_H */
+2 -5
arch/x86/include/asm/frame.h
··· 1 1 #ifdef __ASSEMBLY__ 2 2 3 3 #include <asm/asm.h> 4 - #include <asm/dwarf2.h> 5 4 6 5 /* The annotation hides the frame from the unwinder and makes it look 7 6 like a ordinary ebp save/restore. This avoids some special cases for 8 7 frame pointer later */ 9 8 #ifdef CONFIG_FRAME_POINTER 10 9 .macro FRAME 11 - __ASM_SIZE(push,_cfi) %__ASM_REG(bp) 12 - CFI_REL_OFFSET __ASM_REG(bp), 0 10 + __ASM_SIZE(push,) %__ASM_REG(bp) 13 11 __ASM_SIZE(mov) %__ASM_REG(sp), %__ASM_REG(bp) 14 12 .endm 15 13 .macro ENDFRAME 16 - __ASM_SIZE(pop,_cfi) %__ASM_REG(bp) 17 - CFI_RESTORE __ASM_REG(bp) 14 + __ASM_SIZE(pop,) %__ASM_REG(bp) 18 15 .endm 19 16 #else 20 17 .macro FRAME
+7 -2
arch/x86/include/asm/msr.h
··· 206 206 207 207 #endif /* !CONFIG_PARAVIRT */ 208 208 209 - #define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val), \ 210 - (u32)((val) >> 32)) 209 + /* 210 + * 64-bit version of wrmsr_safe(): 211 + */ 212 + static inline int wrmsrl_safe(u32 msr, u64 val) 213 + { 214 + return wrmsr_safe(msr, (u32)val, (u32)(val >> 32)); 215 + } 211 216 212 217 #define write_tsc(low, high) wrmsr(MSR_IA32_TSC, (low), (high)) 213 218
+6 -4
arch/x86/include/asm/proto.h
··· 5 5 6 6 /* misc architecture specific prototypes */ 7 7 8 - void system_call(void); 9 8 void syscall_init(void); 10 9 11 - void ia32_syscall(void); 12 - void ia32_cstar_target(void); 13 - void ia32_sysenter_target(void); 10 + void entry_SYSCALL_64(void); 11 + void entry_SYSCALL_compat(void); 12 + void entry_INT80_32(void); 13 + void entry_INT80_compat(void); 14 + void entry_SYSENTER_32(void); 15 + void entry_SYSENTER_compat(void); 14 16 15 17 void x86_configure_nx(void); 16 18 void x86_report_nx(void);
+12 -2
arch/x86/include/asm/segment.h
··· 231 231 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8) 232 232 233 233 #ifdef __KERNEL__ 234 + 235 + /* 236 + * early_idt_handler_array is an array of entry points referenced in the 237 + * early IDT. For simplicity, it's a real array with one entry point 238 + * every nine bytes. That leaves room for an optional 'push $0' if the 239 + * vector has no error code (two bytes), a 'push $vector_number' (two 240 + * bytes), and a jump to the common entry code (up to five bytes). 241 + */ 242 + #define EARLY_IDT_HANDLER_SIZE 9 243 + 234 244 #ifndef __ASSEMBLY__ 235 245 236 - extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; 246 + extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE]; 237 247 #ifdef CONFIG_TRACING 238 - # define trace_early_idt_handlers early_idt_handlers 248 + # define trace_early_idt_handler_array early_idt_handler_array 239 249 #endif 240 250 241 251 /*
+1 -4
arch/x86/kernel/Makefile
··· 22 22 23 23 CFLAGS_irq.o := -I$(src)/../include/asm/trace 24 24 25 - obj-y := process_$(BITS).o signal.o entry_$(BITS).o 25 + obj-y := process_$(BITS).o signal.o 26 26 obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 27 27 obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o 28 28 obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o ··· 31 31 obj-$(CONFIG_X86_32) += i386_ksyms_32.o 32 32 obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o 33 33 obj-$(CONFIG_X86_64) += mcount_64.o 34 - obj-y += syscall_$(BITS).o vsyscall_gtod.o 35 - obj-$(CONFIG_IA32_EMULATION) += syscall_32.o 36 - obj-$(CONFIG_X86_VSYSCALL_EMULATION) += vsyscall_64.o vsyscall_emu_64.o 37 34 obj-$(CONFIG_X86_ESPFIX64) += espfix_64.o 38 35 obj-$(CONFIG_SYSFS) += ksysfs.o 39 36 obj-y += bootflag.o e820.o
+1 -1
arch/x86/kernel/asm-offsets_64.c
··· 66 66 DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1); 67 67 DEFINE(NR_syscalls, sizeof(syscalls_64)); 68 68 69 - DEFINE(__NR_ia32_syscall_max, sizeof(syscalls_ia32) - 1); 69 + DEFINE(__NR_entry_INT80_compat_max, sizeof(syscalls_ia32) - 1); 70 70 DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32)); 71 71 72 72 return 0;
+4 -4
arch/x86/kernel/cpu/common.c
··· 1026 1026 (unsigned long)tss + offsetofend(struct tss_struct, SYSENTER_stack), 1027 1027 0); 1028 1028 1029 - wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)ia32_sysenter_target, 0); 1029 + wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long)entry_SYSENTER_32, 0); 1030 1030 1031 1031 out: 1032 1032 put_cpu(); ··· 1204 1204 * set CS/DS but only a 32bit target. LSTAR sets the 64bit rip. 1205 1205 */ 1206 1206 wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); 1207 - wrmsrl(MSR_LSTAR, system_call); 1207 + wrmsrl(MSR_LSTAR, entry_SYSCALL_64); 1208 1208 1209 1209 #ifdef CONFIG_IA32_EMULATION 1210 - wrmsrl(MSR_CSTAR, ia32_cstar_target); 1210 + wrmsrl(MSR_CSTAR, entry_SYSCALL_compat); 1211 1211 /* 1212 1212 * This only works on Intel CPUs. 1213 1213 * On AMD CPUs these MSRs are 32-bit, CPU truncates MSR_IA32_SYSENTER_EIP. ··· 1216 1216 */ 1217 1217 wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); 1218 1218 wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); 1219 - wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target); 1219 + wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat); 1220 1220 #else 1221 1221 wrmsrl(MSR_CSTAR, ignore_sysret); 1222 1222 wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG);
-1401
arch/x86/kernel/entry_32.S
··· 1 - /* 2 - * 3 - * Copyright (C) 1991, 1992 Linus Torvalds 4 - */ 5 - 6 - /* 7 - * entry.S contains the system-call and fault low-level handling routines. 8 - * This also contains the timer-interrupt handler, as well as all interrupts 9 - * and faults that can result in a task-switch. 10 - * 11 - * NOTE: This code handles signal-recognition, which happens every time 12 - * after a timer-interrupt and after each system call. 13 - * 14 - * I changed all the .align's to 4 (16 byte alignment), as that's faster 15 - * on a 486. 16 - * 17 - * Stack layout in 'syscall_exit': 18 - * ptrace needs to have all regs on the stack. 19 - * if the order here is changed, it needs to be 20 - * updated in fork.c:copy_process, signal.c:do_signal, 21 - * ptrace.c and ptrace.h 22 - * 23 - * 0(%esp) - %ebx 24 - * 4(%esp) - %ecx 25 - * 8(%esp) - %edx 26 - * C(%esp) - %esi 27 - * 10(%esp) - %edi 28 - * 14(%esp) - %ebp 29 - * 18(%esp) - %eax 30 - * 1C(%esp) - %ds 31 - * 20(%esp) - %es 32 - * 24(%esp) - %fs 33 - * 28(%esp) - %gs saved iff !CONFIG_X86_32_LAZY_GS 34 - * 2C(%esp) - orig_eax 35 - * 30(%esp) - %eip 36 - * 34(%esp) - %cs 37 - * 38(%esp) - %eflags 38 - * 3C(%esp) - %oldesp 39 - * 40(%esp) - %oldss 40 - * 41 - * "current" is in register %ebx during any slow entries. 42 - */ 43 - 44 - #include <linux/linkage.h> 45 - #include <linux/err.h> 46 - #include <asm/thread_info.h> 47 - #include <asm/irqflags.h> 48 - #include <asm/errno.h> 49 - #include <asm/segment.h> 50 - #include <asm/smp.h> 51 - #include <asm/page_types.h> 52 - #include <asm/percpu.h> 53 - #include <asm/dwarf2.h> 54 - #include <asm/processor-flags.h> 55 - #include <asm/ftrace.h> 56 - #include <asm/irq_vectors.h> 57 - #include <asm/cpufeature.h> 58 - #include <asm/alternative-asm.h> 59 - #include <asm/asm.h> 60 - #include <asm/smap.h> 61 - 62 - /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 63 - #include <linux/elf-em.h> 64 - #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 65 - #define __AUDIT_ARCH_LE 0x40000000 66 - 67 - #ifndef CONFIG_AUDITSYSCALL 68 - #define sysenter_audit syscall_trace_entry 69 - #define sysexit_audit syscall_exit_work 70 - #endif 71 - 72 - .section .entry.text, "ax" 73 - 74 - /* 75 - * We use macros for low-level operations which need to be overridden 76 - * for paravirtualization. The following will never clobber any registers: 77 - * INTERRUPT_RETURN (aka. "iret") 78 - * GET_CR0_INTO_EAX (aka. "movl %cr0, %eax") 79 - * ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit"). 80 - * 81 - * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must 82 - * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY). 83 - * Allowing a register to be clobbered can shrink the paravirt replacement 84 - * enough to patch inline, increasing performance. 85 - */ 86 - 87 - #ifdef CONFIG_PREEMPT 88 - #define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF 89 - #else 90 - #define preempt_stop(clobbers) 91 - #define resume_kernel restore_all 92 - #endif 93 - 94 - .macro TRACE_IRQS_IRET 95 - #ifdef CONFIG_TRACE_IRQFLAGS 96 - testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off? 97 - jz 1f 98 - TRACE_IRQS_ON 99 - 1: 100 - #endif 101 - .endm 102 - 103 - /* 104 - * User gs save/restore 105 - * 106 - * %gs is used for userland TLS and kernel only uses it for stack 107 - * canary which is required to be at %gs:20 by gcc. Read the comment 108 - * at the top of stackprotector.h for more info. 109 - * 110 - * Local labels 98 and 99 are used. 111 - */ 112 - #ifdef CONFIG_X86_32_LAZY_GS 113 - 114 - /* unfortunately push/pop can't be no-op */ 115 - .macro PUSH_GS 116 - pushl_cfi $0 117 - .endm 118 - .macro POP_GS pop=0 119 - addl $(4 + \pop), %esp 120 - CFI_ADJUST_CFA_OFFSET -(4 + \pop) 121 - .endm 122 - .macro POP_GS_EX 123 - .endm 124 - 125 - /* all the rest are no-op */ 126 - .macro PTGS_TO_GS 127 - .endm 128 - .macro PTGS_TO_GS_EX 129 - .endm 130 - .macro GS_TO_REG reg 131 - .endm 132 - .macro REG_TO_PTGS reg 133 - .endm 134 - .macro SET_KERNEL_GS reg 135 - .endm 136 - 137 - #else /* CONFIG_X86_32_LAZY_GS */ 138 - 139 - .macro PUSH_GS 140 - pushl_cfi %gs 141 - /*CFI_REL_OFFSET gs, 0*/ 142 - .endm 143 - 144 - .macro POP_GS pop=0 145 - 98: popl_cfi %gs 146 - /*CFI_RESTORE gs*/ 147 - .if \pop <> 0 148 - add $\pop, %esp 149 - CFI_ADJUST_CFA_OFFSET -\pop 150 - .endif 151 - .endm 152 - .macro POP_GS_EX 153 - .pushsection .fixup, "ax" 154 - 99: movl $0, (%esp) 155 - jmp 98b 156 - .popsection 157 - _ASM_EXTABLE(98b,99b) 158 - .endm 159 - 160 - .macro PTGS_TO_GS 161 - 98: mov PT_GS(%esp), %gs 162 - .endm 163 - .macro PTGS_TO_GS_EX 164 - .pushsection .fixup, "ax" 165 - 99: movl $0, PT_GS(%esp) 166 - jmp 98b 167 - .popsection 168 - _ASM_EXTABLE(98b,99b) 169 - .endm 170 - 171 - .macro GS_TO_REG reg 172 - movl %gs, \reg 173 - /*CFI_REGISTER gs, \reg*/ 174 - .endm 175 - .macro REG_TO_PTGS reg 176 - movl \reg, PT_GS(%esp) 177 - /*CFI_REL_OFFSET gs, PT_GS*/ 178 - .endm 179 - .macro SET_KERNEL_GS reg 180 - movl $(__KERNEL_STACK_CANARY), \reg 181 - movl \reg, %gs 182 - .endm 183 - 184 - #endif /* CONFIG_X86_32_LAZY_GS */ 185 - 186 - .macro SAVE_ALL 187 - cld 188 - PUSH_GS 189 - pushl_cfi %fs 190 - /*CFI_REL_OFFSET fs, 0;*/ 191 - pushl_cfi %es 192 - /*CFI_REL_OFFSET es, 0;*/ 193 - pushl_cfi %ds 194 - /*CFI_REL_OFFSET ds, 0;*/ 195 - pushl_cfi %eax 196 - CFI_REL_OFFSET eax, 0 197 - pushl_cfi %ebp 198 - CFI_REL_OFFSET ebp, 0 199 - pushl_cfi %edi 200 - CFI_REL_OFFSET edi, 0 201 - pushl_cfi %esi 202 - CFI_REL_OFFSET esi, 0 203 - pushl_cfi %edx 204 - CFI_REL_OFFSET edx, 0 205 - pushl_cfi %ecx 206 - CFI_REL_OFFSET ecx, 0 207 - pushl_cfi %ebx 208 - CFI_REL_OFFSET ebx, 0 209 - movl $(__USER_DS), %edx 210 - movl %edx, %ds 211 - movl %edx, %es 212 - movl $(__KERNEL_PERCPU), %edx 213 - movl %edx, %fs 214 - SET_KERNEL_GS %edx 215 - .endm 216 - 217 - .macro RESTORE_INT_REGS 218 - popl_cfi %ebx 219 - CFI_RESTORE ebx 220 - popl_cfi %ecx 221 - CFI_RESTORE ecx 222 - popl_cfi %edx 223 - CFI_RESTORE edx 224 - popl_cfi %esi 225 - CFI_RESTORE esi 226 - popl_cfi %edi 227 - CFI_RESTORE edi 228 - popl_cfi %ebp 229 - CFI_RESTORE ebp 230 - popl_cfi %eax 231 - CFI_RESTORE eax 232 - .endm 233 - 234 - .macro RESTORE_REGS pop=0 235 - RESTORE_INT_REGS 236 - 1: popl_cfi %ds 237 - /*CFI_RESTORE ds;*/ 238 - 2: popl_cfi %es 239 - /*CFI_RESTORE es;*/ 240 - 3: popl_cfi %fs 241 - /*CFI_RESTORE fs;*/ 242 - POP_GS \pop 243 - .pushsection .fixup, "ax" 244 - 4: movl $0, (%esp) 245 - jmp 1b 246 - 5: movl $0, (%esp) 247 - jmp 2b 248 - 6: movl $0, (%esp) 249 - jmp 3b 250 - .popsection 251 - _ASM_EXTABLE(1b,4b) 252 - _ASM_EXTABLE(2b,5b) 253 - _ASM_EXTABLE(3b,6b) 254 - POP_GS_EX 255 - .endm 256 - 257 - .macro RING0_INT_FRAME 258 - CFI_STARTPROC simple 259 - CFI_SIGNAL_FRAME 260 - CFI_DEF_CFA esp, 3*4 261 - /*CFI_OFFSET cs, -2*4;*/ 262 - CFI_OFFSET eip, -3*4 263 - .endm 264 - 265 - .macro RING0_EC_FRAME 266 - CFI_STARTPROC simple 267 - CFI_SIGNAL_FRAME 268 - CFI_DEF_CFA esp, 4*4 269 - /*CFI_OFFSET cs, -2*4;*/ 270 - CFI_OFFSET eip, -3*4 271 - .endm 272 - 273 - .macro RING0_PTREGS_FRAME 274 - CFI_STARTPROC simple 275 - CFI_SIGNAL_FRAME 276 - CFI_DEF_CFA esp, PT_OLDESP-PT_EBX 277 - /*CFI_OFFSET cs, PT_CS-PT_OLDESP;*/ 278 - CFI_OFFSET eip, PT_EIP-PT_OLDESP 279 - /*CFI_OFFSET es, PT_ES-PT_OLDESP;*/ 280 - /*CFI_OFFSET ds, PT_DS-PT_OLDESP;*/ 281 - CFI_OFFSET eax, PT_EAX-PT_OLDESP 282 - CFI_OFFSET ebp, PT_EBP-PT_OLDESP 283 - CFI_OFFSET edi, PT_EDI-PT_OLDESP 284 - CFI_OFFSET esi, PT_ESI-PT_OLDESP 285 - CFI_OFFSET edx, PT_EDX-PT_OLDESP 286 - CFI_OFFSET ecx, PT_ECX-PT_OLDESP 287 - CFI_OFFSET ebx, PT_EBX-PT_OLDESP 288 - .endm 289 - 290 - ENTRY(ret_from_fork) 291 - CFI_STARTPROC 292 - pushl_cfi %eax 293 - call schedule_tail 294 - GET_THREAD_INFO(%ebp) 295 - popl_cfi %eax 296 - pushl_cfi $0x0202 # Reset kernel eflags 297 - popfl_cfi 298 - jmp syscall_exit 299 - CFI_ENDPROC 300 - END(ret_from_fork) 301 - 302 - ENTRY(ret_from_kernel_thread) 303 - CFI_STARTPROC 304 - pushl_cfi %eax 305 - call schedule_tail 306 - GET_THREAD_INFO(%ebp) 307 - popl_cfi %eax 308 - pushl_cfi $0x0202 # Reset kernel eflags 309 - popfl_cfi 310 - movl PT_EBP(%esp),%eax 311 - call *PT_EBX(%esp) 312 - movl $0,PT_EAX(%esp) 313 - jmp syscall_exit 314 - CFI_ENDPROC 315 - ENDPROC(ret_from_kernel_thread) 316 - 317 - /* 318 - * Return to user mode is not as complex as all this looks, 319 - * but we want the default path for a system call return to 320 - * go as quickly as possible which is why some of this is 321 - * less clear than it otherwise should be. 322 - */ 323 - 324 - # userspace resumption stub bypassing syscall exit tracing 325 - ALIGN 326 - RING0_PTREGS_FRAME 327 - ret_from_exception: 328 - preempt_stop(CLBR_ANY) 329 - ret_from_intr: 330 - GET_THREAD_INFO(%ebp) 331 - #ifdef CONFIG_VM86 332 - movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS 333 - movb PT_CS(%esp), %al 334 - andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax 335 - #else 336 - /* 337 - * We can be coming here from child spawned by kernel_thread(). 338 - */ 339 - movl PT_CS(%esp), %eax 340 - andl $SEGMENT_RPL_MASK, %eax 341 - #endif 342 - cmpl $USER_RPL, %eax 343 - jb resume_kernel # not returning to v8086 or userspace 344 - 345 - ENTRY(resume_userspace) 346 - LOCKDEP_SYS_EXIT 347 - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 348 - # setting need_resched or sigpending 349 - # between sampling and the iret 350 - TRACE_IRQS_OFF 351 - movl TI_flags(%ebp), %ecx 352 - andl $_TIF_WORK_MASK, %ecx # is there any work to be done on 353 - # int/exception return? 354 - jne work_pending 355 - jmp restore_all 356 - END(ret_from_exception) 357 - 358 - #ifdef CONFIG_PREEMPT 359 - ENTRY(resume_kernel) 360 - DISABLE_INTERRUPTS(CLBR_ANY) 361 - need_resched: 362 - cmpl $0,PER_CPU_VAR(__preempt_count) 363 - jnz restore_all 364 - testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ? 365 - jz restore_all 366 - call preempt_schedule_irq 367 - jmp need_resched 368 - END(resume_kernel) 369 - #endif 370 - CFI_ENDPROC 371 - 372 - /* SYSENTER_RETURN points to after the "sysenter" instruction in 373 - the vsyscall page. See vsyscall-sysentry.S, which defines the symbol. */ 374 - 375 - # sysenter call handler stub 376 - ENTRY(ia32_sysenter_target) 377 - CFI_STARTPROC simple 378 - CFI_SIGNAL_FRAME 379 - CFI_DEF_CFA esp, 0 380 - CFI_REGISTER esp, ebp 381 - movl TSS_sysenter_sp0(%esp),%esp 382 - sysenter_past_esp: 383 - /* 384 - * Interrupts are disabled here, but we can't trace it until 385 - * enough kernel state to call TRACE_IRQS_OFF can be called - but 386 - * we immediately enable interrupts at that point anyway. 387 - */ 388 - pushl_cfi $__USER_DS 389 - /*CFI_REL_OFFSET ss, 0*/ 390 - pushl_cfi %ebp 391 - CFI_REL_OFFSET esp, 0 392 - pushfl_cfi 393 - orl $X86_EFLAGS_IF, (%esp) 394 - pushl_cfi $__USER_CS 395 - /*CFI_REL_OFFSET cs, 0*/ 396 - /* 397 - * Push current_thread_info()->sysenter_return to the stack. 398 - * A tiny bit of offset fixup is necessary: TI_sysenter_return 399 - * is relative to thread_info, which is at the bottom of the 400 - * kernel stack page. 4*4 means the 4 words pushed above; 401 - * TOP_OF_KERNEL_STACK_PADDING takes us to the top of the stack; 402 - * and THREAD_SIZE takes us to the bottom. 403 - */ 404 - pushl_cfi ((TI_sysenter_return) - THREAD_SIZE + TOP_OF_KERNEL_STACK_PADDING + 4*4)(%esp) 405 - CFI_REL_OFFSET eip, 0 406 - 407 - pushl_cfi %eax 408 - SAVE_ALL 409 - ENABLE_INTERRUPTS(CLBR_NONE) 410 - 411 - /* 412 - * Load the potential sixth argument from user stack. 413 - * Careful about security. 414 - */ 415 - cmpl $__PAGE_OFFSET-3,%ebp 416 - jae syscall_fault 417 - ASM_STAC 418 - 1: movl (%ebp),%ebp 419 - ASM_CLAC 420 - movl %ebp,PT_EBP(%esp) 421 - _ASM_EXTABLE(1b,syscall_fault) 422 - 423 - GET_THREAD_INFO(%ebp) 424 - 425 - testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) 426 - jnz sysenter_audit 427 - sysenter_do_call: 428 - cmpl $(NR_syscalls), %eax 429 - jae sysenter_badsys 430 - call *sys_call_table(,%eax,4) 431 - sysenter_after_call: 432 - movl %eax,PT_EAX(%esp) 433 - LOCKDEP_SYS_EXIT 434 - DISABLE_INTERRUPTS(CLBR_ANY) 435 - TRACE_IRQS_OFF 436 - movl TI_flags(%ebp), %ecx 437 - testl $_TIF_ALLWORK_MASK, %ecx 438 - jnz sysexit_audit 439 - sysenter_exit: 440 - /* if something modifies registers it must also disable sysexit */ 441 - movl PT_EIP(%esp), %edx 442 - movl PT_OLDESP(%esp), %ecx 443 - xorl %ebp,%ebp 444 - TRACE_IRQS_ON 445 - 1: mov PT_FS(%esp), %fs 446 - PTGS_TO_GS 447 - ENABLE_INTERRUPTS_SYSEXIT 448 - 449 - #ifdef CONFIG_AUDITSYSCALL 450 - sysenter_audit: 451 - testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) 452 - jnz syscall_trace_entry 453 - /* movl PT_EAX(%esp), %eax already set, syscall number: 1st arg to audit */ 454 - movl PT_EBX(%esp), %edx /* ebx/a0: 2nd arg to audit */ 455 - /* movl PT_ECX(%esp), %ecx already set, a1: 3nd arg to audit */ 456 - pushl_cfi PT_ESI(%esp) /* a3: 5th arg */ 457 - pushl_cfi PT_EDX+4(%esp) /* a2: 4th arg */ 458 - call __audit_syscall_entry 459 - popl_cfi %ecx /* get that remapped edx off the stack */ 460 - popl_cfi %ecx /* get that remapped esi off the stack */ 461 - movl PT_EAX(%esp),%eax /* reload syscall number */ 462 - jmp sysenter_do_call 463 - 464 - sysexit_audit: 465 - testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx 466 - jnz syscall_exit_work 467 - TRACE_IRQS_ON 468 - ENABLE_INTERRUPTS(CLBR_ANY) 469 - movl %eax,%edx /* second arg, syscall return value */ 470 - cmpl $-MAX_ERRNO,%eax /* is it an error ? */ 471 - setbe %al /* 1 if so, 0 if not */ 472 - movzbl %al,%eax /* zero-extend that */ 473 - call __audit_syscall_exit 474 - DISABLE_INTERRUPTS(CLBR_ANY) 475 - TRACE_IRQS_OFF 476 - movl TI_flags(%ebp), %ecx 477 - testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx 478 - jnz syscall_exit_work 479 - movl PT_EAX(%esp),%eax /* reload syscall return value */ 480 - jmp sysenter_exit 481 - #endif 482 - 483 - CFI_ENDPROC 484 - .pushsection .fixup,"ax" 485 - 2: movl $0,PT_FS(%esp) 486 - jmp 1b 487 - .popsection 488 - _ASM_EXTABLE(1b,2b) 489 - PTGS_TO_GS_EX 490 - ENDPROC(ia32_sysenter_target) 491 - 492 - # system call handler stub 493 - ENTRY(system_call) 494 - RING0_INT_FRAME # can't unwind into user space anyway 495 - ASM_CLAC 496 - pushl_cfi %eax # save orig_eax 497 - SAVE_ALL 498 - GET_THREAD_INFO(%ebp) 499 - # system call tracing in operation / emulation 500 - testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) 501 - jnz syscall_trace_entry 502 - cmpl $(NR_syscalls), %eax 503 - jae syscall_badsys 504 - syscall_call: 505 - call *sys_call_table(,%eax,4) 506 - syscall_after_call: 507 - movl %eax,PT_EAX(%esp) # store the return value 508 - syscall_exit: 509 - LOCKDEP_SYS_EXIT 510 - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 511 - # setting need_resched or sigpending 512 - # between sampling and the iret 513 - TRACE_IRQS_OFF 514 - movl TI_flags(%ebp), %ecx 515 - testl $_TIF_ALLWORK_MASK, %ecx # current->work 516 - jnz syscall_exit_work 517 - 518 - restore_all: 519 - TRACE_IRQS_IRET 520 - restore_all_notrace: 521 - #ifdef CONFIG_X86_ESPFIX32 522 - movl PT_EFLAGS(%esp), %eax # mix EFLAGS, SS and CS 523 - # Warning: PT_OLDSS(%esp) contains the wrong/random values if we 524 - # are returning to the kernel. 525 - # See comments in process.c:copy_thread() for details. 526 - movb PT_OLDSS(%esp), %ah 527 - movb PT_CS(%esp), %al 528 - andl $(X86_EFLAGS_VM | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax 529 - cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax 530 - CFI_REMEMBER_STATE 531 - je ldt_ss # returning to user-space with LDT SS 532 - #endif 533 - restore_nocheck: 534 - RESTORE_REGS 4 # skip orig_eax/error_code 535 - irq_return: 536 - INTERRUPT_RETURN 537 - .section .fixup,"ax" 538 - ENTRY(iret_exc) 539 - pushl $0 # no error code 540 - pushl $do_iret_error 541 - jmp error_code 542 - .previous 543 - _ASM_EXTABLE(irq_return,iret_exc) 544 - 545 - #ifdef CONFIG_X86_ESPFIX32 546 - CFI_RESTORE_STATE 547 - ldt_ss: 548 - #ifdef CONFIG_PARAVIRT 549 - /* 550 - * The kernel can't run on a non-flat stack if paravirt mode 551 - * is active. Rather than try to fixup the high bits of 552 - * ESP, bypass this code entirely. This may break DOSemu 553 - * and/or Wine support in a paravirt VM, although the option 554 - * is still available to implement the setting of the high 555 - * 16-bits in the INTERRUPT_RETURN paravirt-op. 556 - */ 557 - cmpl $0, pv_info+PARAVIRT_enabled 558 - jne restore_nocheck 559 - #endif 560 - 561 - /* 562 - * Setup and switch to ESPFIX stack 563 - * 564 - * We're returning to userspace with a 16 bit stack. The CPU will not 565 - * restore the high word of ESP for us on executing iret... This is an 566 - * "official" bug of all the x86-compatible CPUs, which we can work 567 - * around to make dosemu and wine happy. We do this by preloading the 568 - * high word of ESP with the high word of the userspace ESP while 569 - * compensating for the offset by changing to the ESPFIX segment with 570 - * a base address that matches for the difference. 571 - */ 572 - #define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8) 573 - mov %esp, %edx /* load kernel esp */ 574 - mov PT_OLDESP(%esp), %eax /* load userspace esp */ 575 - mov %dx, %ax /* eax: new kernel esp */ 576 - sub %eax, %edx /* offset (low word is 0) */ 577 - shr $16, %edx 578 - mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */ 579 - mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */ 580 - pushl_cfi $__ESPFIX_SS 581 - pushl_cfi %eax /* new kernel esp */ 582 - /* Disable interrupts, but do not irqtrace this section: we 583 - * will soon execute iret and the tracer was already set to 584 - * the irqstate after the iret */ 585 - DISABLE_INTERRUPTS(CLBR_EAX) 586 - lss (%esp), %esp /* switch to espfix segment */ 587 - CFI_ADJUST_CFA_OFFSET -8 588 - jmp restore_nocheck 589 - #endif 590 - CFI_ENDPROC 591 - ENDPROC(system_call) 592 - 593 - # perform work that needs to be done immediately before resumption 594 - ALIGN 595 - RING0_PTREGS_FRAME # can't unwind into user space anyway 596 - work_pending: 597 - testb $_TIF_NEED_RESCHED, %cl 598 - jz work_notifysig 599 - work_resched: 600 - call schedule 601 - LOCKDEP_SYS_EXIT 602 - DISABLE_INTERRUPTS(CLBR_ANY) # make sure we don't miss an interrupt 603 - # setting need_resched or sigpending 604 - # between sampling and the iret 605 - TRACE_IRQS_OFF 606 - movl TI_flags(%ebp), %ecx 607 - andl $_TIF_WORK_MASK, %ecx # is there any work to be done other 608 - # than syscall tracing? 609 - jz restore_all 610 - testb $_TIF_NEED_RESCHED, %cl 611 - jnz work_resched 612 - 613 - work_notifysig: # deal with pending signals and 614 - # notify-resume requests 615 - #ifdef CONFIG_VM86 616 - testl $X86_EFLAGS_VM, PT_EFLAGS(%esp) 617 - movl %esp, %eax 618 - jnz work_notifysig_v86 # returning to kernel-space or 619 - # vm86-space 620 - 1: 621 - #else 622 - movl %esp, %eax 623 - #endif 624 - TRACE_IRQS_ON 625 - ENABLE_INTERRUPTS(CLBR_NONE) 626 - movb PT_CS(%esp), %bl 627 - andb $SEGMENT_RPL_MASK, %bl 628 - cmpb $USER_RPL, %bl 629 - jb resume_kernel 630 - xorl %edx, %edx 631 - call do_notify_resume 632 - jmp resume_userspace 633 - 634 - #ifdef CONFIG_VM86 635 - ALIGN 636 - work_notifysig_v86: 637 - pushl_cfi %ecx # save ti_flags for do_notify_resume 638 - call save_v86_state # %eax contains pt_regs pointer 639 - popl_cfi %ecx 640 - movl %eax, %esp 641 - jmp 1b 642 - #endif 643 - END(work_pending) 644 - 645 - # perform syscall exit tracing 646 - ALIGN 647 - syscall_trace_entry: 648 - movl $-ENOSYS,PT_EAX(%esp) 649 - movl %esp, %eax 650 - call syscall_trace_enter 651 - /* What it returned is what we'll actually use. */ 652 - cmpl $(NR_syscalls), %eax 653 - jnae syscall_call 654 - jmp syscall_exit 655 - END(syscall_trace_entry) 656 - 657 - # perform syscall exit tracing 658 - ALIGN 659 - syscall_exit_work: 660 - testl $_TIF_WORK_SYSCALL_EXIT, %ecx 661 - jz work_pending 662 - TRACE_IRQS_ON 663 - ENABLE_INTERRUPTS(CLBR_ANY) # could let syscall_trace_leave() call 664 - # schedule() instead 665 - movl %esp, %eax 666 - call syscall_trace_leave 667 - jmp resume_userspace 668 - END(syscall_exit_work) 669 - CFI_ENDPROC 670 - 671 - RING0_INT_FRAME # can't unwind into user space anyway 672 - syscall_fault: 673 - ASM_CLAC 674 - GET_THREAD_INFO(%ebp) 675 - movl $-EFAULT,PT_EAX(%esp) 676 - jmp resume_userspace 677 - END(syscall_fault) 678 - 679 - syscall_badsys: 680 - movl $-ENOSYS,%eax 681 - jmp syscall_after_call 682 - END(syscall_badsys) 683 - 684 - sysenter_badsys: 685 - movl $-ENOSYS,%eax 686 - jmp sysenter_after_call 687 - END(sysenter_badsys) 688 - CFI_ENDPROC 689 - 690 - .macro FIXUP_ESPFIX_STACK 691 - /* 692 - * Switch back for ESPFIX stack to the normal zerobased stack 693 - * 694 - * We can't call C functions using the ESPFIX stack. This code reads 695 - * the high word of the segment base from the GDT and swiches to the 696 - * normal stack and adjusts ESP with the matching offset. 697 - */ 698 - #ifdef CONFIG_X86_ESPFIX32 699 - /* fixup the stack */ 700 - mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */ 701 - mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */ 702 - shl $16, %eax 703 - addl %esp, %eax /* the adjusted stack pointer */ 704 - pushl_cfi $__KERNEL_DS 705 - pushl_cfi %eax 706 - lss (%esp), %esp /* switch to the normal stack segment */ 707 - CFI_ADJUST_CFA_OFFSET -8 708 - #endif 709 - .endm 710 - .macro UNWIND_ESPFIX_STACK 711 - #ifdef CONFIG_X86_ESPFIX32 712 - movl %ss, %eax 713 - /* see if on espfix stack */ 714 - cmpw $__ESPFIX_SS, %ax 715 - jne 27f 716 - movl $__KERNEL_DS, %eax 717 - movl %eax, %ds 718 - movl %eax, %es 719 - /* switch to normal stack */ 720 - FIXUP_ESPFIX_STACK 721 - 27: 722 - #endif 723 - .endm 724 - 725 - /* 726 - * Build the entry stubs with some assembler magic. 727 - * We pack 1 stub into every 8-byte block. 728 - */ 729 - .align 8 730 - ENTRY(irq_entries_start) 731 - RING0_INT_FRAME 732 - vector=FIRST_EXTERNAL_VECTOR 733 - .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR) 734 - pushl_cfi $(~vector+0x80) /* Note: always in signed byte range */ 735 - vector=vector+1 736 - jmp common_interrupt 737 - CFI_ADJUST_CFA_OFFSET -4 738 - .align 8 739 - .endr 740 - END(irq_entries_start) 741 - 742 - /* 743 - * the CPU automatically disables interrupts when executing an IRQ vector, 744 - * so IRQ-flags tracing has to follow that: 745 - */ 746 - .p2align CONFIG_X86_L1_CACHE_SHIFT 747 - common_interrupt: 748 - ASM_CLAC 749 - addl $-0x80,(%esp) /* Adjust vector into the [-256,-1] range */ 750 - SAVE_ALL 751 - TRACE_IRQS_OFF 752 - movl %esp,%eax 753 - call do_IRQ 754 - jmp ret_from_intr 755 - ENDPROC(common_interrupt) 756 - CFI_ENDPROC 757 - 758 - #define BUILD_INTERRUPT3(name, nr, fn) \ 759 - ENTRY(name) \ 760 - RING0_INT_FRAME; \ 761 - ASM_CLAC; \ 762 - pushl_cfi $~(nr); \ 763 - SAVE_ALL; \ 764 - TRACE_IRQS_OFF \ 765 - movl %esp,%eax; \ 766 - call fn; \ 767 - jmp ret_from_intr; \ 768 - CFI_ENDPROC; \ 769 - ENDPROC(name) 770 - 771 - 772 - #ifdef CONFIG_TRACING 773 - #define TRACE_BUILD_INTERRUPT(name, nr) \ 774 - BUILD_INTERRUPT3(trace_##name, nr, smp_trace_##name) 775 - #else 776 - #define TRACE_BUILD_INTERRUPT(name, nr) 777 - #endif 778 - 779 - #define BUILD_INTERRUPT(name, nr) \ 780 - BUILD_INTERRUPT3(name, nr, smp_##name); \ 781 - TRACE_BUILD_INTERRUPT(name, nr) 782 - 783 - /* The include is where all of the SMP etc. interrupts come from */ 784 - #include <asm/entry_arch.h> 785 - 786 - ENTRY(coprocessor_error) 787 - RING0_INT_FRAME 788 - ASM_CLAC 789 - pushl_cfi $0 790 - pushl_cfi $do_coprocessor_error 791 - jmp error_code 792 - CFI_ENDPROC 793 - END(coprocessor_error) 794 - 795 - ENTRY(simd_coprocessor_error) 796 - RING0_INT_FRAME 797 - ASM_CLAC 798 - pushl_cfi $0 799 - #ifdef CONFIG_X86_INVD_BUG 800 - /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */ 801 - ALTERNATIVE "pushl_cfi $do_general_protection", \ 802 - "pushl $do_simd_coprocessor_error", \ 803 - X86_FEATURE_XMM 804 - #else 805 - pushl_cfi $do_simd_coprocessor_error 806 - #endif 807 - jmp error_code 808 - CFI_ENDPROC 809 - END(simd_coprocessor_error) 810 - 811 - ENTRY(device_not_available) 812 - RING0_INT_FRAME 813 - ASM_CLAC 814 - pushl_cfi $-1 # mark this as an int 815 - pushl_cfi $do_device_not_available 816 - jmp error_code 817 - CFI_ENDPROC 818 - END(device_not_available) 819 - 820 - #ifdef CONFIG_PARAVIRT 821 - ENTRY(native_iret) 822 - iret 823 - _ASM_EXTABLE(native_iret, iret_exc) 824 - END(native_iret) 825 - 826 - ENTRY(native_irq_enable_sysexit) 827 - sti 828 - sysexit 829 - END(native_irq_enable_sysexit) 830 - #endif 831 - 832 - ENTRY(overflow) 833 - RING0_INT_FRAME 834 - ASM_CLAC 835 - pushl_cfi $0 836 - pushl_cfi $do_overflow 837 - jmp error_code 838 - CFI_ENDPROC 839 - END(overflow) 840 - 841 - ENTRY(bounds) 842 - RING0_INT_FRAME 843 - ASM_CLAC 844 - pushl_cfi $0 845 - pushl_cfi $do_bounds 846 - jmp error_code 847 - CFI_ENDPROC 848 - END(bounds) 849 - 850 - ENTRY(invalid_op) 851 - RING0_INT_FRAME 852 - ASM_CLAC 853 - pushl_cfi $0 854 - pushl_cfi $do_invalid_op 855 - jmp error_code 856 - CFI_ENDPROC 857 - END(invalid_op) 858 - 859 - ENTRY(coprocessor_segment_overrun) 860 - RING0_INT_FRAME 861 - ASM_CLAC 862 - pushl_cfi $0 863 - pushl_cfi $do_coprocessor_segment_overrun 864 - jmp error_code 865 - CFI_ENDPROC 866 - END(coprocessor_segment_overrun) 867 - 868 - ENTRY(invalid_TSS) 869 - RING0_EC_FRAME 870 - ASM_CLAC 871 - pushl_cfi $do_invalid_TSS 872 - jmp error_code 873 - CFI_ENDPROC 874 - END(invalid_TSS) 875 - 876 - ENTRY(segment_not_present) 877 - RING0_EC_FRAME 878 - ASM_CLAC 879 - pushl_cfi $do_segment_not_present 880 - jmp error_code 881 - CFI_ENDPROC 882 - END(segment_not_present) 883 - 884 - ENTRY(stack_segment) 885 - RING0_EC_FRAME 886 - ASM_CLAC 887 - pushl_cfi $do_stack_segment 888 - jmp error_code 889 - CFI_ENDPROC 890 - END(stack_segment) 891 - 892 - ENTRY(alignment_check) 893 - RING0_EC_FRAME 894 - ASM_CLAC 895 - pushl_cfi $do_alignment_check 896 - jmp error_code 897 - CFI_ENDPROC 898 - END(alignment_check) 899 - 900 - ENTRY(divide_error) 901 - RING0_INT_FRAME 902 - ASM_CLAC 903 - pushl_cfi $0 # no error code 904 - pushl_cfi $do_divide_error 905 - jmp error_code 906 - CFI_ENDPROC 907 - END(divide_error) 908 - 909 - #ifdef CONFIG_X86_MCE 910 - ENTRY(machine_check) 911 - RING0_INT_FRAME 912 - ASM_CLAC 913 - pushl_cfi $0 914 - pushl_cfi machine_check_vector 915 - jmp error_code 916 - CFI_ENDPROC 917 - END(machine_check) 918 - #endif 919 - 920 - ENTRY(spurious_interrupt_bug) 921 - RING0_INT_FRAME 922 - ASM_CLAC 923 - pushl_cfi $0 924 - pushl_cfi $do_spurious_interrupt_bug 925 - jmp error_code 926 - CFI_ENDPROC 927 - END(spurious_interrupt_bug) 928 - 929 - #ifdef CONFIG_XEN 930 - /* Xen doesn't set %esp to be precisely what the normal sysenter 931 - entrypoint expects, so fix it up before using the normal path. */ 932 - ENTRY(xen_sysenter_target) 933 - RING0_INT_FRAME 934 - addl $5*4, %esp /* remove xen-provided frame */ 935 - CFI_ADJUST_CFA_OFFSET -5*4 936 - jmp sysenter_past_esp 937 - CFI_ENDPROC 938 - 939 - ENTRY(xen_hypervisor_callback) 940 - CFI_STARTPROC 941 - pushl_cfi $-1 /* orig_ax = -1 => not a system call */ 942 - SAVE_ALL 943 - TRACE_IRQS_OFF 944 - 945 - /* Check to see if we got the event in the critical 946 - region in xen_iret_direct, after we've reenabled 947 - events and checked for pending events. This simulates 948 - iret instruction's behaviour where it delivers a 949 - pending interrupt when enabling interrupts. */ 950 - movl PT_EIP(%esp),%eax 951 - cmpl $xen_iret_start_crit,%eax 952 - jb 1f 953 - cmpl $xen_iret_end_crit,%eax 954 - jae 1f 955 - 956 - jmp xen_iret_crit_fixup 957 - 958 - ENTRY(xen_do_upcall) 959 - 1: mov %esp, %eax 960 - call xen_evtchn_do_upcall 961 - #ifndef CONFIG_PREEMPT 962 - call xen_maybe_preempt_hcall 963 - #endif 964 - jmp ret_from_intr 965 - CFI_ENDPROC 966 - ENDPROC(xen_hypervisor_callback) 967 - 968 - # Hypervisor uses this for application faults while it executes. 969 - # We get here for two reasons: 970 - # 1. Fault while reloading DS, ES, FS or GS 971 - # 2. Fault while executing IRET 972 - # Category 1 we fix up by reattempting the load, and zeroing the segment 973 - # register if the load fails. 974 - # Category 2 we fix up by jumping to do_iret_error. We cannot use the 975 - # normal Linux return path in this case because if we use the IRET hypercall 976 - # to pop the stack frame we end up in an infinite loop of failsafe callbacks. 977 - # We distinguish between categories by maintaining a status value in EAX. 978 - ENTRY(xen_failsafe_callback) 979 - CFI_STARTPROC 980 - pushl_cfi %eax 981 - movl $1,%eax 982 - 1: mov 4(%esp),%ds 983 - 2: mov 8(%esp),%es 984 - 3: mov 12(%esp),%fs 985 - 4: mov 16(%esp),%gs 986 - /* EAX == 0 => Category 1 (Bad segment) 987 - EAX != 0 => Category 2 (Bad IRET) */ 988 - testl %eax,%eax 989 - popl_cfi %eax 990 - lea 16(%esp),%esp 991 - CFI_ADJUST_CFA_OFFSET -16 992 - jz 5f 993 - jmp iret_exc 994 - 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */ 995 - SAVE_ALL 996 - jmp ret_from_exception 997 - CFI_ENDPROC 998 - 999 - .section .fixup,"ax" 1000 - 6: xorl %eax,%eax 1001 - movl %eax,4(%esp) 1002 - jmp 1b 1003 - 7: xorl %eax,%eax 1004 - movl %eax,8(%esp) 1005 - jmp 2b 1006 - 8: xorl %eax,%eax 1007 - movl %eax,12(%esp) 1008 - jmp 3b 1009 - 9: xorl %eax,%eax 1010 - movl %eax,16(%esp) 1011 - jmp 4b 1012 - .previous 1013 - _ASM_EXTABLE(1b,6b) 1014 - _ASM_EXTABLE(2b,7b) 1015 - _ASM_EXTABLE(3b,8b) 1016 - _ASM_EXTABLE(4b,9b) 1017 - ENDPROC(xen_failsafe_callback) 1018 - 1019 - BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR, 1020 - xen_evtchn_do_upcall) 1021 - 1022 - #endif /* CONFIG_XEN */ 1023 - 1024 - #if IS_ENABLED(CONFIG_HYPERV) 1025 - 1026 - BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR, 1027 - hyperv_vector_handler) 1028 - 1029 - #endif /* CONFIG_HYPERV */ 1030 - 1031 - #ifdef CONFIG_FUNCTION_TRACER 1032 - #ifdef CONFIG_DYNAMIC_FTRACE 1033 - 1034 - ENTRY(mcount) 1035 - ret 1036 - END(mcount) 1037 - 1038 - ENTRY(ftrace_caller) 1039 - pushl %eax 1040 - pushl %ecx 1041 - pushl %edx 1042 - pushl $0 /* Pass NULL as regs pointer */ 1043 - movl 4*4(%esp), %eax 1044 - movl 0x4(%ebp), %edx 1045 - movl function_trace_op, %ecx 1046 - subl $MCOUNT_INSN_SIZE, %eax 1047 - 1048 - .globl ftrace_call 1049 - ftrace_call: 1050 - call ftrace_stub 1051 - 1052 - addl $4,%esp /* skip NULL pointer */ 1053 - popl %edx 1054 - popl %ecx 1055 - popl %eax 1056 - ftrace_ret: 1057 - #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1058 - .globl ftrace_graph_call 1059 - ftrace_graph_call: 1060 - jmp ftrace_stub 1061 - #endif 1062 - 1063 - .globl ftrace_stub 1064 - ftrace_stub: 1065 - ret 1066 - END(ftrace_caller) 1067 - 1068 - ENTRY(ftrace_regs_caller) 1069 - pushf /* push flags before compare (in cs location) */ 1070 - 1071 - /* 1072 - * i386 does not save SS and ESP when coming from kernel. 1073 - * Instead, to get sp, &regs->sp is used (see ptrace.h). 1074 - * Unfortunately, that means eflags must be at the same location 1075 - * as the current return ip is. We move the return ip into the 1076 - * ip location, and move flags into the return ip location. 1077 - */ 1078 - pushl 4(%esp) /* save return ip into ip slot */ 1079 - 1080 - pushl $0 /* Load 0 into orig_ax */ 1081 - pushl %gs 1082 - pushl %fs 1083 - pushl %es 1084 - pushl %ds 1085 - pushl %eax 1086 - pushl %ebp 1087 - pushl %edi 1088 - pushl %esi 1089 - pushl %edx 1090 - pushl %ecx 1091 - pushl %ebx 1092 - 1093 - movl 13*4(%esp), %eax /* Get the saved flags */ 1094 - movl %eax, 14*4(%esp) /* Move saved flags into regs->flags location */ 1095 - /* clobbering return ip */ 1096 - movl $__KERNEL_CS,13*4(%esp) 1097 - 1098 - movl 12*4(%esp), %eax /* Load ip (1st parameter) */ 1099 - subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */ 1100 - movl 0x4(%ebp), %edx /* Load parent ip (2nd parameter) */ 1101 - movl function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */ 1102 - pushl %esp /* Save pt_regs as 4th parameter */ 1103 - 1104 - GLOBAL(ftrace_regs_call) 1105 - call ftrace_stub 1106 - 1107 - addl $4, %esp /* Skip pt_regs */ 1108 - movl 14*4(%esp), %eax /* Move flags back into cs */ 1109 - movl %eax, 13*4(%esp) /* Needed to keep addl from modifying flags */ 1110 - movl 12*4(%esp), %eax /* Get return ip from regs->ip */ 1111 - movl %eax, 14*4(%esp) /* Put return ip back for ret */ 1112 - 1113 - popl %ebx 1114 - popl %ecx 1115 - popl %edx 1116 - popl %esi 1117 - popl %edi 1118 - popl %ebp 1119 - popl %eax 1120 - popl %ds 1121 - popl %es 1122 - popl %fs 1123 - popl %gs 1124 - addl $8, %esp /* Skip orig_ax and ip */ 1125 - popf /* Pop flags at end (no addl to corrupt flags) */ 1126 - jmp ftrace_ret 1127 - 1128 - popf 1129 - jmp ftrace_stub 1130 - #else /* ! CONFIG_DYNAMIC_FTRACE */ 1131 - 1132 - ENTRY(mcount) 1133 - cmpl $__PAGE_OFFSET, %esp 1134 - jb ftrace_stub /* Paging not enabled yet? */ 1135 - 1136 - cmpl $ftrace_stub, ftrace_trace_function 1137 - jnz trace 1138 - #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1139 - cmpl $ftrace_stub, ftrace_graph_return 1140 - jnz ftrace_graph_caller 1141 - 1142 - cmpl $ftrace_graph_entry_stub, ftrace_graph_entry 1143 - jnz ftrace_graph_caller 1144 - #endif 1145 - .globl ftrace_stub 1146 - ftrace_stub: 1147 - ret 1148 - 1149 - /* taken from glibc */ 1150 - trace: 1151 - pushl %eax 1152 - pushl %ecx 1153 - pushl %edx 1154 - movl 0xc(%esp), %eax 1155 - movl 0x4(%ebp), %edx 1156 - subl $MCOUNT_INSN_SIZE, %eax 1157 - 1158 - call *ftrace_trace_function 1159 - 1160 - popl %edx 1161 - popl %ecx 1162 - popl %eax 1163 - jmp ftrace_stub 1164 - END(mcount) 1165 - #endif /* CONFIG_DYNAMIC_FTRACE */ 1166 - #endif /* CONFIG_FUNCTION_TRACER */ 1167 - 1168 - #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1169 - ENTRY(ftrace_graph_caller) 1170 - pushl %eax 1171 - pushl %ecx 1172 - pushl %edx 1173 - movl 0xc(%esp), %eax 1174 - lea 0x4(%ebp), %edx 1175 - movl (%ebp), %ecx 1176 - subl $MCOUNT_INSN_SIZE, %eax 1177 - call prepare_ftrace_return 1178 - popl %edx 1179 - popl %ecx 1180 - popl %eax 1181 - ret 1182 - END(ftrace_graph_caller) 1183 - 1184 - .globl return_to_handler 1185 - return_to_handler: 1186 - pushl %eax 1187 - pushl %edx 1188 - movl %ebp, %eax 1189 - call ftrace_return_to_handler 1190 - movl %eax, %ecx 1191 - popl %edx 1192 - popl %eax 1193 - jmp *%ecx 1194 - #endif 1195 - 1196 - #ifdef CONFIG_TRACING 1197 - ENTRY(trace_page_fault) 1198 - RING0_EC_FRAME 1199 - ASM_CLAC 1200 - pushl_cfi $trace_do_page_fault 1201 - jmp error_code 1202 - CFI_ENDPROC 1203 - END(trace_page_fault) 1204 - #endif 1205 - 1206 - ENTRY(page_fault) 1207 - RING0_EC_FRAME 1208 - ASM_CLAC 1209 - pushl_cfi $do_page_fault 1210 - ALIGN 1211 - error_code: 1212 - /* the function address is in %gs's slot on the stack */ 1213 - pushl_cfi %fs 1214 - /*CFI_REL_OFFSET fs, 0*/ 1215 - pushl_cfi %es 1216 - /*CFI_REL_OFFSET es, 0*/ 1217 - pushl_cfi %ds 1218 - /*CFI_REL_OFFSET ds, 0*/ 1219 - pushl_cfi_reg eax 1220 - pushl_cfi_reg ebp 1221 - pushl_cfi_reg edi 1222 - pushl_cfi_reg esi 1223 - pushl_cfi_reg edx 1224 - pushl_cfi_reg ecx 1225 - pushl_cfi_reg ebx 1226 - cld 1227 - movl $(__KERNEL_PERCPU), %ecx 1228 - movl %ecx, %fs 1229 - UNWIND_ESPFIX_STACK 1230 - GS_TO_REG %ecx 1231 - movl PT_GS(%esp), %edi # get the function address 1232 - movl PT_ORIG_EAX(%esp), %edx # get the error code 1233 - movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart 1234 - REG_TO_PTGS %ecx 1235 - SET_KERNEL_GS %ecx 1236 - movl $(__USER_DS), %ecx 1237 - movl %ecx, %ds 1238 - movl %ecx, %es 1239 - TRACE_IRQS_OFF 1240 - movl %esp,%eax # pt_regs pointer 1241 - call *%edi 1242 - jmp ret_from_exception 1243 - CFI_ENDPROC 1244 - END(page_fault) 1245 - 1246 - /* 1247 - * Debug traps and NMI can happen at the one SYSENTER instruction 1248 - * that sets up the real kernel stack. Check here, since we can't 1249 - * allow the wrong stack to be used. 1250 - * 1251 - * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have 1252 - * already pushed 3 words if it hits on the sysenter instruction: 1253 - * eflags, cs and eip. 1254 - * 1255 - * We just load the right stack, and push the three (known) values 1256 - * by hand onto the new stack - while updating the return eip past 1257 - * the instruction that would have done it for sysenter. 1258 - */ 1259 - .macro FIX_STACK offset ok label 1260 - cmpw $__KERNEL_CS, 4(%esp) 1261 - jne \ok 1262 - \label: 1263 - movl TSS_sysenter_sp0 + \offset(%esp), %esp 1264 - CFI_DEF_CFA esp, 0 1265 - CFI_UNDEFINED eip 1266 - pushfl_cfi 1267 - pushl_cfi $__KERNEL_CS 1268 - pushl_cfi $sysenter_past_esp 1269 - CFI_REL_OFFSET eip, 0 1270 - .endm 1271 - 1272 - ENTRY(debug) 1273 - RING0_INT_FRAME 1274 - ASM_CLAC 1275 - cmpl $ia32_sysenter_target,(%esp) 1276 - jne debug_stack_correct 1277 - FIX_STACK 12, debug_stack_correct, debug_esp_fix_insn 1278 - debug_stack_correct: 1279 - pushl_cfi $-1 # mark this as an int 1280 - SAVE_ALL 1281 - TRACE_IRQS_OFF 1282 - xorl %edx,%edx # error code 0 1283 - movl %esp,%eax # pt_regs pointer 1284 - call do_debug 1285 - jmp ret_from_exception 1286 - CFI_ENDPROC 1287 - END(debug) 1288 - 1289 - /* 1290 - * NMI is doubly nasty. It can happen _while_ we're handling 1291 - * a debug fault, and the debug fault hasn't yet been able to 1292 - * clear up the stack. So we first check whether we got an 1293 - * NMI on the sysenter entry path, but after that we need to 1294 - * check whether we got an NMI on the debug path where the debug 1295 - * fault happened on the sysenter path. 1296 - */ 1297 - ENTRY(nmi) 1298 - RING0_INT_FRAME 1299 - ASM_CLAC 1300 - #ifdef CONFIG_X86_ESPFIX32 1301 - pushl_cfi %eax 1302 - movl %ss, %eax 1303 - cmpw $__ESPFIX_SS, %ax 1304 - popl_cfi %eax 1305 - je nmi_espfix_stack 1306 - #endif 1307 - cmpl $ia32_sysenter_target,(%esp) 1308 - je nmi_stack_fixup 1309 - pushl_cfi %eax 1310 - movl %esp,%eax 1311 - /* Do not access memory above the end of our stack page, 1312 - * it might not exist. 1313 - */ 1314 - andl $(THREAD_SIZE-1),%eax 1315 - cmpl $(THREAD_SIZE-20),%eax 1316 - popl_cfi %eax 1317 - jae nmi_stack_correct 1318 - cmpl $ia32_sysenter_target,12(%esp) 1319 - je nmi_debug_stack_check 1320 - nmi_stack_correct: 1321 - /* We have a RING0_INT_FRAME here */ 1322 - pushl_cfi %eax 1323 - SAVE_ALL 1324 - xorl %edx,%edx # zero error code 1325 - movl %esp,%eax # pt_regs pointer 1326 - call do_nmi 1327 - jmp restore_all_notrace 1328 - CFI_ENDPROC 1329 - 1330 - nmi_stack_fixup: 1331 - RING0_INT_FRAME 1332 - FIX_STACK 12, nmi_stack_correct, 1 1333 - jmp nmi_stack_correct 1334 - 1335 - nmi_debug_stack_check: 1336 - /* We have a RING0_INT_FRAME here */ 1337 - cmpw $__KERNEL_CS,16(%esp) 1338 - jne nmi_stack_correct 1339 - cmpl $debug,(%esp) 1340 - jb nmi_stack_correct 1341 - cmpl $debug_esp_fix_insn,(%esp) 1342 - ja nmi_stack_correct 1343 - FIX_STACK 24, nmi_stack_correct, 1 1344 - jmp nmi_stack_correct 1345 - 1346 - #ifdef CONFIG_X86_ESPFIX32 1347 - nmi_espfix_stack: 1348 - /* We have a RING0_INT_FRAME here. 1349 - * 1350 - * create the pointer to lss back 1351 - */ 1352 - pushl_cfi %ss 1353 - pushl_cfi %esp 1354 - addl $4, (%esp) 1355 - /* copy the iret frame of 12 bytes */ 1356 - .rept 3 1357 - pushl_cfi 16(%esp) 1358 - .endr 1359 - pushl_cfi %eax 1360 - SAVE_ALL 1361 - FIXUP_ESPFIX_STACK # %eax == %esp 1362 - xorl %edx,%edx # zero error code 1363 - call do_nmi 1364 - RESTORE_REGS 1365 - lss 12+4(%esp), %esp # back to espfix stack 1366 - CFI_ADJUST_CFA_OFFSET -24 1367 - jmp irq_return 1368 - #endif 1369 - CFI_ENDPROC 1370 - END(nmi) 1371 - 1372 - ENTRY(int3) 1373 - RING0_INT_FRAME 1374 - ASM_CLAC 1375 - pushl_cfi $-1 # mark this as an int 1376 - SAVE_ALL 1377 - TRACE_IRQS_OFF 1378 - xorl %edx,%edx # zero error code 1379 - movl %esp,%eax # pt_regs pointer 1380 - call do_int3 1381 - jmp ret_from_exception 1382 - CFI_ENDPROC 1383 - END(int3) 1384 - 1385 - ENTRY(general_protection) 1386 - RING0_EC_FRAME 1387 - pushl_cfi $do_general_protection 1388 - jmp error_code 1389 - CFI_ENDPROC 1390 - END(general_protection) 1391 - 1392 - #ifdef CONFIG_KVM_GUEST 1393 - ENTRY(async_page_fault) 1394 - RING0_EC_FRAME 1395 - ASM_CLAC 1396 - pushl_cfi $do_async_page_fault 1397 - jmp error_code 1398 - CFI_ENDPROC 1399 - END(async_page_fault) 1400 - #endif 1401 -
+58 -258
arch/x86/kernel/entry_64.S arch/x86/entry/entry_64.S
··· 19 19 * at the top of the kernel process stack. 20 20 * 21 21 * Some macro usage: 22 - * - CFI macros are used to generate dwarf2 unwind information for better 23 - * backtraces. They don't change any code. 24 22 * - ENTRY/END Define functions in the symbol table. 25 23 * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. 26 24 * - idtentry - Define exception entry points. ··· 28 30 #include <asm/segment.h> 29 31 #include <asm/cache.h> 30 32 #include <asm/errno.h> 31 - #include <asm/dwarf2.h> 32 - #include <asm/calling.h> 33 + #include "calling.h" 33 34 #include <asm/asm-offsets.h> 34 35 #include <asm/msr.h> 35 36 #include <asm/unistd.h> ··· 110 113 #endif 111 114 112 115 /* 113 - * empty frame 114 - */ 115 - .macro EMPTY_FRAME start=1 offset=0 116 - .if \start 117 - CFI_STARTPROC simple 118 - CFI_SIGNAL_FRAME 119 - CFI_DEF_CFA rsp,8+\offset 120 - .else 121 - CFI_DEF_CFA_OFFSET 8+\offset 122 - .endif 123 - .endm 124 - 125 - /* 126 - * initial frame state for interrupts (and exceptions without error code) 127 - */ 128 - .macro INTR_FRAME start=1 offset=0 129 - EMPTY_FRAME \start, 5*8+\offset 130 - /*CFI_REL_OFFSET ss, 4*8+\offset*/ 131 - CFI_REL_OFFSET rsp, 3*8+\offset 132 - /*CFI_REL_OFFSET rflags, 2*8+\offset*/ 133 - /*CFI_REL_OFFSET cs, 1*8+\offset*/ 134 - CFI_REL_OFFSET rip, 0*8+\offset 135 - .endm 136 - 137 - /* 138 - * initial frame state for exceptions with error code (and interrupts 139 - * with vector already pushed) 140 - */ 141 - .macro XCPT_FRAME start=1 offset=0 142 - INTR_FRAME \start, 1*8+\offset 143 - .endm 144 - 145 - /* 146 - * frame that enables passing a complete pt_regs to a C function. 147 - */ 148 - .macro DEFAULT_FRAME start=1 offset=0 149 - XCPT_FRAME \start, ORIG_RAX+\offset 150 - CFI_REL_OFFSET rdi, RDI+\offset 151 - CFI_REL_OFFSET rsi, RSI+\offset 152 - CFI_REL_OFFSET rdx, RDX+\offset 153 - CFI_REL_OFFSET rcx, RCX+\offset 154 - CFI_REL_OFFSET rax, RAX+\offset 155 - CFI_REL_OFFSET r8, R8+\offset 156 - CFI_REL_OFFSET r9, R9+\offset 157 - CFI_REL_OFFSET r10, R10+\offset 158 - CFI_REL_OFFSET r11, R11+\offset 159 - CFI_REL_OFFSET rbx, RBX+\offset 160 - CFI_REL_OFFSET rbp, RBP+\offset 161 - CFI_REL_OFFSET r12, R12+\offset 162 - CFI_REL_OFFSET r13, R13+\offset 163 - CFI_REL_OFFSET r14, R14+\offset 164 - CFI_REL_OFFSET r15, R15+\offset 165 - .endm 166 - 167 - /* 168 116 * 64bit SYSCALL instruction entry. Up to 6 arguments in registers. 169 117 * 170 118 * 64bit SYSCALL saves rip to rcx, clears rflags.RF, then saves rflags to r11, ··· 137 195 * with them due to bugs in both AMD and Intel CPUs. 138 196 */ 139 197 140 - ENTRY(system_call) 141 - CFI_STARTPROC simple 142 - CFI_SIGNAL_FRAME 143 - CFI_DEF_CFA rsp,0 144 - CFI_REGISTER rip,rcx 145 - /*CFI_REGISTER rflags,r11*/ 146 - 198 + ENTRY(entry_SYSCALL_64) 147 199 /* 148 200 * Interrupts are off on entry. 149 201 * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON, ··· 149 213 * after the swapgs, so that it can do the swapgs 150 214 * for the guest and jump here on syscall. 151 215 */ 152 - GLOBAL(system_call_after_swapgs) 216 + GLOBAL(entry_SYSCALL_64_after_swapgs) 153 217 154 218 movq %rsp,PER_CPU_VAR(rsp_scratch) 155 219 movq PER_CPU_VAR(cpu_current_top_of_stack),%rsp 156 220 157 221 /* Construct struct pt_regs on stack */ 158 - pushq_cfi $__USER_DS /* pt_regs->ss */ 159 - pushq_cfi PER_CPU_VAR(rsp_scratch) /* pt_regs->sp */ 222 + pushq $__USER_DS /* pt_regs->ss */ 223 + pushq PER_CPU_VAR(rsp_scratch) /* pt_regs->sp */ 160 224 /* 161 225 * Re-enable interrupts. 162 226 * We use 'rsp_scratch' as a scratch space, hence irq-off block above ··· 165 229 * with using rsp_scratch: 166 230 */ 167 231 ENABLE_INTERRUPTS(CLBR_NONE) 168 - pushq_cfi %r11 /* pt_regs->flags */ 169 - pushq_cfi $__USER_CS /* pt_regs->cs */ 170 - pushq_cfi %rcx /* pt_regs->ip */ 171 - CFI_REL_OFFSET rip,0 172 - pushq_cfi_reg rax /* pt_regs->orig_ax */ 173 - pushq_cfi_reg rdi /* pt_regs->di */ 174 - pushq_cfi_reg rsi /* pt_regs->si */ 175 - pushq_cfi_reg rdx /* pt_regs->dx */ 176 - pushq_cfi_reg rcx /* pt_regs->cx */ 177 - pushq_cfi $-ENOSYS /* pt_regs->ax */ 178 - pushq_cfi_reg r8 /* pt_regs->r8 */ 179 - pushq_cfi_reg r9 /* pt_regs->r9 */ 180 - pushq_cfi_reg r10 /* pt_regs->r10 */ 181 - pushq_cfi_reg r11 /* pt_regs->r11 */ 232 + pushq %r11 /* pt_regs->flags */ 233 + pushq $__USER_CS /* pt_regs->cs */ 234 + pushq %rcx /* pt_regs->ip */ 235 + pushq %rax /* pt_regs->orig_ax */ 236 + pushq %rdi /* pt_regs->di */ 237 + pushq %rsi /* pt_regs->si */ 238 + pushq %rdx /* pt_regs->dx */ 239 + pushq %rcx /* pt_regs->cx */ 240 + pushq $-ENOSYS /* pt_regs->ax */ 241 + pushq %r8 /* pt_regs->r8 */ 242 + pushq %r9 /* pt_regs->r9 */ 243 + pushq %r10 /* pt_regs->r10 */ 244 + pushq %r11 /* pt_regs->r11 */ 182 245 sub $(6*8),%rsp /* pt_regs->bp,bx,r12-15 not saved */ 183 - CFI_ADJUST_CFA_OFFSET 6*8 184 246 185 247 testl $_TIF_WORK_SYSCALL_ENTRY, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 186 248 jnz tracesys 187 - system_call_fastpath: 249 + entry_SYSCALL_64_fastpath: 188 250 #if __SYSCALL_MASK == ~0 189 251 cmpq $__NR_syscall_max,%rax 190 252 #else ··· 216 282 testl $_TIF_ALLWORK_MASK, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS) 217 283 jnz int_ret_from_sys_call_irqs_off /* Go to the slow path */ 218 284 219 - CFI_REMEMBER_STATE 220 - 221 285 RESTORE_C_REGS_EXCEPT_RCX_R11 222 286 movq RIP(%rsp),%rcx 223 - CFI_REGISTER rip,rcx 224 287 movq EFLAGS(%rsp),%r11 225 - /*CFI_REGISTER rflags,r11*/ 226 288 movq RSP(%rsp),%rsp 227 289 /* 228 290 * 64bit SYSRET restores rip from rcx, ··· 237 307 */ 238 308 USERGS_SYSRET64 239 309 240 - CFI_RESTORE_STATE 241 - 242 310 /* Do syscall entry tracing */ 243 311 tracesys: 244 312 movq %rsp, %rdi ··· 246 318 jnz tracesys_phase2 /* if needed, run the slow path */ 247 319 RESTORE_C_REGS_EXCEPT_RAX /* else restore clobbered regs */ 248 320 movq ORIG_RAX(%rsp), %rax 249 - jmp system_call_fastpath /* and return to the fast path */ 321 + jmp entry_SYSCALL_64_fastpath /* and return to the fast path */ 250 322 251 323 tracesys_phase2: 252 324 SAVE_EXTRA_REGS ··· 302 374 jnc int_very_careful 303 375 TRACE_IRQS_ON 304 376 ENABLE_INTERRUPTS(CLBR_NONE) 305 - pushq_cfi %rdi 377 + pushq %rdi 306 378 SCHEDULE_USER 307 - popq_cfi %rdi 379 + popq %rdi 308 380 DISABLE_INTERRUPTS(CLBR_NONE) 309 381 TRACE_IRQS_OFF 310 382 jmp int_with_check ··· 317 389 /* Check for syscall exit trace */ 318 390 testl $_TIF_WORK_SYSCALL_EXIT,%edx 319 391 jz int_signal 320 - pushq_cfi %rdi 392 + pushq %rdi 321 393 leaq 8(%rsp),%rdi # &ptregs -> arg1 322 394 call syscall_trace_leave 323 - popq_cfi %rdi 395 + popq %rdi 324 396 andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi 325 397 jmp int_restore_rest 326 398 ··· 403 475 * perf profiles. Nothing jumps here. 404 476 */ 405 477 syscall_return_via_sysret: 406 - CFI_REMEMBER_STATE 407 478 /* rcx and r11 are already restored (see code above) */ 408 479 RESTORE_C_REGS_EXCEPT_RCX_R11 409 480 movq RSP(%rsp),%rsp 410 481 USERGS_SYSRET64 411 - CFI_RESTORE_STATE 412 482 413 483 opportunistic_sysret_failed: 414 484 SWAPGS 415 485 jmp restore_c_regs_and_iret 416 - CFI_ENDPROC 417 - END(system_call) 486 + END(entry_SYSCALL_64) 418 487 419 488 420 489 .macro FORK_LIKE func 421 490 ENTRY(stub_\func) 422 - CFI_STARTPROC 423 - DEFAULT_FRAME 0, 8 /* offset 8: return address */ 424 491 SAVE_EXTRA_REGS 8 425 492 jmp sys_\func 426 - CFI_ENDPROC 427 493 END(stub_\func) 428 494 .endm 429 495 ··· 426 504 FORK_LIKE vfork 427 505 428 506 ENTRY(stub_execve) 429 - CFI_STARTPROC 430 - DEFAULT_FRAME 0, 8 431 507 call sys_execve 432 508 return_from_execve: 433 509 testl %eax, %eax ··· 435 515 1: 436 516 /* must use IRET code path (pt_regs->cs may have changed) */ 437 517 addq $8, %rsp 438 - CFI_ADJUST_CFA_OFFSET -8 439 518 ZERO_EXTRA_REGS 440 519 movq %rax,RAX(%rsp) 441 520 jmp int_ret_from_sys_call 442 - CFI_ENDPROC 443 521 END(stub_execve) 444 522 /* 445 523 * Remaining execve stubs are only 7 bytes long. ··· 445 527 */ 446 528 .align 8 447 529 GLOBAL(stub_execveat) 448 - CFI_STARTPROC 449 - DEFAULT_FRAME 0, 8 450 530 call sys_execveat 451 531 jmp return_from_execve 452 - CFI_ENDPROC 453 532 END(stub_execveat) 454 533 455 534 #if defined(CONFIG_X86_X32_ABI) || defined(CONFIG_IA32_EMULATION) 456 535 .align 8 457 536 GLOBAL(stub_x32_execve) 458 537 GLOBAL(stub32_execve) 459 - CFI_STARTPROC 460 - DEFAULT_FRAME 0, 8 461 538 call compat_sys_execve 462 539 jmp return_from_execve 463 - CFI_ENDPROC 464 540 END(stub32_execve) 465 541 END(stub_x32_execve) 466 542 .align 8 467 543 GLOBAL(stub_x32_execveat) 468 544 GLOBAL(stub32_execveat) 469 - CFI_STARTPROC 470 - DEFAULT_FRAME 0, 8 471 545 call compat_sys_execveat 472 546 jmp return_from_execve 473 - CFI_ENDPROC 474 547 END(stub32_execveat) 475 548 END(stub_x32_execveat) 476 549 #endif ··· 471 562 * This cannot be done with SYSRET, so use the IRET return path instead. 472 563 */ 473 564 ENTRY(stub_rt_sigreturn) 474 - CFI_STARTPROC 475 - DEFAULT_FRAME 0, 8 476 565 /* 477 566 * SAVE_EXTRA_REGS result is not normally needed: 478 567 * sigreturn overwrites all pt_regs->GPREGS. ··· 482 575 call sys_rt_sigreturn 483 576 return_from_stub: 484 577 addq $8, %rsp 485 - CFI_ADJUST_CFA_OFFSET -8 486 578 RESTORE_EXTRA_REGS 487 579 movq %rax,RAX(%rsp) 488 580 jmp int_ret_from_sys_call 489 - CFI_ENDPROC 490 581 END(stub_rt_sigreturn) 491 582 492 583 #ifdef CONFIG_X86_X32_ABI 493 584 ENTRY(stub_x32_rt_sigreturn) 494 - CFI_STARTPROC 495 - DEFAULT_FRAME 0, 8 496 585 SAVE_EXTRA_REGS 8 497 586 call sys32_x32_rt_sigreturn 498 587 jmp return_from_stub 499 - CFI_ENDPROC 500 588 END(stub_x32_rt_sigreturn) 501 589 #endif 502 590 ··· 501 599 * rdi: prev task we switched from 502 600 */ 503 601 ENTRY(ret_from_fork) 504 - DEFAULT_FRAME 505 602 506 603 LOCK ; btr $TIF_FORK,TI_flags(%r8) 507 604 508 - pushq_cfi $0x0002 509 - popfq_cfi # reset kernel eflags 605 + pushq $0x0002 606 + popfq # reset kernel eflags 510 607 511 608 call schedule_tail # rdi: 'prev' task parameter 512 609 ··· 516 615 /* 517 616 * By the time we get here, we have no idea whether our pt_regs, 518 617 * ti flags, and ti status came from the 64-bit SYSCALL fast path, 519 - * the slow path, or one of the ia32entry paths. 618 + * the slow path, or one of the 32-bit compat paths. 520 619 * Use IRET code path to return, since it can safely handle 521 620 * all of the above. 522 621 */ ··· 529 628 movl $0, RAX(%rsp) 530 629 RESTORE_EXTRA_REGS 531 630 jmp int_ret_from_sys_call 532 - CFI_ENDPROC 533 631 END(ret_from_fork) 534 632 535 633 /* ··· 537 637 */ 538 638 .align 8 539 639 ENTRY(irq_entries_start) 540 - INTR_FRAME 541 640 vector=FIRST_EXTERNAL_VECTOR 542 641 .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR) 543 - pushq_cfi $(~vector+0x80) /* Note: always in signed byte range */ 642 + pushq $(~vector+0x80) /* Note: always in signed byte range */ 544 643 vector=vector+1 545 644 jmp common_interrupt 546 - CFI_ADJUST_CFA_OFFSET -8 547 645 .align 8 548 646 .endr 549 - CFI_ENDPROC 550 647 END(irq_entries_start) 551 648 552 649 /* ··· 585 688 movq %rsp, %rsi 586 689 incl PER_CPU_VAR(irq_count) 587 690 cmovzq PER_CPU_VAR(irq_stack_ptr),%rsp 588 - CFI_DEF_CFA_REGISTER rsi 589 691 pushq %rsi 590 - /* 591 - * For debugger: 592 - * "CFA (Current Frame Address) is the value on stack + offset" 593 - */ 594 - CFI_ESCAPE 0x0f /* DW_CFA_def_cfa_expression */, 6, \ 595 - 0x77 /* DW_OP_breg7 (rsp) */, 0, \ 596 - 0x06 /* DW_OP_deref */, \ 597 - 0x08 /* DW_OP_const1u */, SIZEOF_PTREGS-RBP, \ 598 - 0x22 /* DW_OP_plus */ 599 692 /* We entered an interrupt context - irqs are off: */ 600 693 TRACE_IRQS_OFF 601 694 ··· 598 711 */ 599 712 .p2align CONFIG_X86_L1_CACHE_SHIFT 600 713 common_interrupt: 601 - XCPT_FRAME 602 714 ASM_CLAC 603 715 addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */ 604 716 interrupt do_IRQ ··· 609 723 610 724 /* Restore saved previous stack */ 611 725 popq %rsi 612 - CFI_DEF_CFA rsi,SIZEOF_PTREGS-RBP /* reg/off reset after def_cfa_expr */ 613 726 /* return code expects complete pt_regs - adjust rsp accordingly: */ 614 727 leaq -RBP(%rsi),%rsp 615 - CFI_DEF_CFA_REGISTER rsp 616 - CFI_ADJUST_CFA_OFFSET RBP 617 728 618 729 testb $3, CS(%rsp) 619 730 jz retint_kernel 620 731 /* Interrupt came from user space */ 621 - 732 + retint_user: 622 733 GET_THREAD_INFO(%rcx) 623 734 /* 624 735 * %rcx: thread info. Interrupts off. ··· 626 743 LOCKDEP_SYS_EXIT_IRQ 627 744 movl TI_flags(%rcx),%edx 628 745 andl %edi,%edx 629 - CFI_REMEMBER_STATE 630 746 jnz retint_careful 631 747 632 748 retint_swapgs: /* return to user-space */ ··· 663 781 restore_c_regs_and_iret: 664 782 RESTORE_C_REGS 665 783 REMOVE_PT_GPREGS_FROM_STACK 8 666 - 667 - irq_return: 668 784 INTERRUPT_RETURN 669 785 670 786 ENTRY(native_iret) ··· 687 807 688 808 #ifdef CONFIG_X86_ESPFIX64 689 809 native_irq_return_ldt: 690 - pushq_cfi %rax 691 - pushq_cfi %rdi 810 + pushq %rax 811 + pushq %rdi 692 812 SWAPGS 693 813 movq PER_CPU_VAR(espfix_waddr),%rdi 694 814 movq %rax,(0*8)(%rdi) /* RAX */ ··· 703 823 movq (5*8)(%rsp),%rax /* RSP */ 704 824 movq %rax,(4*8)(%rdi) 705 825 andl $0xffff0000,%eax 706 - popq_cfi %rdi 826 + popq %rdi 707 827 orq PER_CPU_VAR(espfix_stack),%rax 708 828 SWAPGS 709 829 movq %rax,%rsp 710 - popq_cfi %rax 830 + popq %rax 711 831 jmp native_irq_return_iret 712 832 #endif 713 833 714 834 /* edi: workmask, edx: work */ 715 835 retint_careful: 716 - CFI_RESTORE_STATE 717 836 bt $TIF_NEED_RESCHED,%edx 718 837 jnc retint_signal 719 838 TRACE_IRQS_ON 720 839 ENABLE_INTERRUPTS(CLBR_NONE) 721 - pushq_cfi %rdi 840 + pushq %rdi 722 841 SCHEDULE_USER 723 - popq_cfi %rdi 842 + popq %rdi 724 843 GET_THREAD_INFO(%rcx) 725 844 DISABLE_INTERRUPTS(CLBR_NONE) 726 845 TRACE_IRQS_OFF ··· 741 862 GET_THREAD_INFO(%rcx) 742 863 jmp retint_with_reschedule 743 864 744 - CFI_ENDPROC 745 865 END(common_interrupt) 746 866 747 867 /* ··· 748 870 */ 749 871 .macro apicinterrupt3 num sym do_sym 750 872 ENTRY(\sym) 751 - INTR_FRAME 752 873 ASM_CLAC 753 - pushq_cfi $~(\num) 874 + pushq $~(\num) 754 875 .Lcommon_\sym: 755 876 interrupt \do_sym 756 877 jmp ret_from_intr 757 - CFI_ENDPROC 758 878 END(\sym) 759 879 .endm 760 880 ··· 842 966 .error "using shift_ist requires paranoid=1" 843 967 .endif 844 968 845 - .if \has_error_code 846 - XCPT_FRAME 847 - .else 848 - INTR_FRAME 849 - .endif 850 - 851 969 ASM_CLAC 852 970 PARAVIRT_ADJUST_EXCEPTION_FRAME 853 971 854 972 .ifeq \has_error_code 855 - pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 973 + pushq $-1 /* ORIG_RAX: no syscall to restart */ 856 974 .endif 857 975 858 976 ALLOC_PT_GPREGS_ON_STACK 859 977 860 978 .if \paranoid 861 979 .if \paranoid == 1 862 - CFI_REMEMBER_STATE 863 980 testb $3, CS(%rsp) /* If coming from userspace, switch */ 864 981 jnz 1f /* stacks. */ 865 982 .endif ··· 861 992 call error_entry 862 993 .endif 863 994 /* returned flag: ebx=0: need swapgs on exit, ebx=1: don't need it */ 864 - 865 - DEFAULT_FRAME 0 866 995 867 996 .if \paranoid 868 997 .if \shift_ist != -1 ··· 897 1030 .endif 898 1031 899 1032 .if \paranoid == 1 900 - CFI_RESTORE_STATE 901 1033 /* 902 1034 * Paranoid entry from userspace. Switch stacks and treat it 903 1035 * as a normal entry. This means that paranoid handlers ··· 905 1039 1: 906 1040 call error_entry 907 1041 908 - DEFAULT_FRAME 0 909 1042 910 1043 movq %rsp,%rdi /* pt_regs pointer */ 911 1044 call sync_regs ··· 923 1058 924 1059 jmp error_exit /* %ebx: no swapgs flag */ 925 1060 .endif 926 - 927 - CFI_ENDPROC 928 1061 END(\sym) 929 1062 .endm 930 1063 ··· 955 1092 /* Reload gs selector with exception handling */ 956 1093 /* edi: new selector */ 957 1094 ENTRY(native_load_gs_index) 958 - CFI_STARTPROC 959 - pushfq_cfi 1095 + pushfq 960 1096 DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI) 961 1097 SWAPGS 962 1098 gs_change: 963 1099 movl %edi,%gs 964 1100 2: mfence /* workaround */ 965 1101 SWAPGS 966 - popfq_cfi 1102 + popfq 967 1103 ret 968 - CFI_ENDPROC 969 1104 END(native_load_gs_index) 970 1105 971 1106 _ASM_EXTABLE(gs_change,bad_gs) ··· 978 1117 979 1118 /* Call softirq on interrupt stack. Interrupts are off. */ 980 1119 ENTRY(do_softirq_own_stack) 981 - CFI_STARTPROC 982 - pushq_cfi %rbp 983 - CFI_REL_OFFSET rbp,0 1120 + pushq %rbp 984 1121 mov %rsp,%rbp 985 - CFI_DEF_CFA_REGISTER rbp 986 1122 incl PER_CPU_VAR(irq_count) 987 1123 cmove PER_CPU_VAR(irq_stack_ptr),%rsp 988 1124 push %rbp # backlink for old unwinder 989 1125 call __do_softirq 990 1126 leaveq 991 - CFI_RESTORE rbp 992 - CFI_DEF_CFA_REGISTER rsp 993 - CFI_ADJUST_CFA_OFFSET -8 994 1127 decl PER_CPU_VAR(irq_count) 995 1128 ret 996 - CFI_ENDPROC 997 1129 END(do_softirq_own_stack) 998 1130 999 1131 #ifdef CONFIG_XEN ··· 1006 1152 * activation and restart the handler using the previous one. 1007 1153 */ 1008 1154 ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) 1009 - CFI_STARTPROC 1010 1155 /* 1011 1156 * Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will 1012 1157 * see the correct pointer to the pt_regs 1013 1158 */ 1014 1159 movq %rdi, %rsp # we don't return, adjust the stack frame 1015 - CFI_ENDPROC 1016 - DEFAULT_FRAME 1017 1160 11: incl PER_CPU_VAR(irq_count) 1018 1161 movq %rsp,%rbp 1019 - CFI_DEF_CFA_REGISTER rbp 1020 1162 cmovzq PER_CPU_VAR(irq_stack_ptr),%rsp 1021 1163 pushq %rbp # backlink for old unwinder 1022 1164 call xen_evtchn_do_upcall 1023 1165 popq %rsp 1024 - CFI_DEF_CFA_REGISTER rsp 1025 1166 decl PER_CPU_VAR(irq_count) 1026 1167 #ifndef CONFIG_PREEMPT 1027 1168 call xen_maybe_preempt_hcall 1028 1169 #endif 1029 1170 jmp error_exit 1030 - CFI_ENDPROC 1031 1171 END(xen_do_hypervisor_callback) 1032 1172 1033 1173 /* ··· 1038 1190 * with its current contents: any discrepancy means we in category 1. 1039 1191 */ 1040 1192 ENTRY(xen_failsafe_callback) 1041 - INTR_FRAME 1 (6*8) 1042 - /*CFI_REL_OFFSET gs,GS*/ 1043 - /*CFI_REL_OFFSET fs,FS*/ 1044 - /*CFI_REL_OFFSET es,ES*/ 1045 - /*CFI_REL_OFFSET ds,DS*/ 1046 - CFI_REL_OFFSET r11,8 1047 - CFI_REL_OFFSET rcx,0 1048 1193 movl %ds,%ecx 1049 1194 cmpw %cx,0x10(%rsp) 1050 - CFI_REMEMBER_STATE 1051 1195 jne 1f 1052 1196 movl %es,%ecx 1053 1197 cmpw %cx,0x18(%rsp) ··· 1052 1212 jne 1f 1053 1213 /* All segments match their saved values => Category 2 (Bad IRET). */ 1054 1214 movq (%rsp),%rcx 1055 - CFI_RESTORE rcx 1056 1215 movq 8(%rsp),%r11 1057 - CFI_RESTORE r11 1058 1216 addq $0x30,%rsp 1059 - CFI_ADJUST_CFA_OFFSET -0x30 1060 - pushq_cfi $0 /* RIP */ 1061 - pushq_cfi %r11 1062 - pushq_cfi %rcx 1217 + pushq $0 /* RIP */ 1218 + pushq %r11 1219 + pushq %rcx 1063 1220 jmp general_protection 1064 - CFI_RESTORE_STATE 1065 1221 1: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */ 1066 1222 movq (%rsp),%rcx 1067 - CFI_RESTORE rcx 1068 1223 movq 8(%rsp),%r11 1069 - CFI_RESTORE r11 1070 1224 addq $0x30,%rsp 1071 - CFI_ADJUST_CFA_OFFSET -0x30 1072 - pushq_cfi $-1 /* orig_ax = -1 => not a system call */ 1225 + pushq $-1 /* orig_ax = -1 => not a system call */ 1073 1226 ALLOC_PT_GPREGS_ON_STACK 1074 1227 SAVE_C_REGS 1075 1228 SAVE_EXTRA_REGS 1076 1229 jmp error_exit 1077 - CFI_ENDPROC 1078 1230 END(xen_failsafe_callback) 1079 1231 1080 1232 apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ ··· 1102 1270 * Return: ebx=0: need swapgs on exit, ebx=1: otherwise 1103 1271 */ 1104 1272 ENTRY(paranoid_entry) 1105 - XCPT_FRAME 1 15*8 1106 1273 cld 1107 1274 SAVE_C_REGS 8 1108 1275 SAVE_EXTRA_REGS 8 ··· 1113 1282 SWAPGS 1114 1283 xorl %ebx,%ebx 1115 1284 1: ret 1116 - CFI_ENDPROC 1117 1285 END(paranoid_entry) 1118 1286 1119 1287 /* ··· 1127 1297 */ 1128 1298 /* On entry, ebx is "no swapgs" flag (1: don't need swapgs, 0: need it) */ 1129 1299 ENTRY(paranoid_exit) 1130 - DEFAULT_FRAME 1131 1300 DISABLE_INTERRUPTS(CLBR_NONE) 1132 1301 TRACE_IRQS_OFF_DEBUG 1133 1302 testl %ebx,%ebx /* swapgs needed? */ ··· 1141 1312 RESTORE_C_REGS 1142 1313 REMOVE_PT_GPREGS_FROM_STACK 8 1143 1314 INTERRUPT_RETURN 1144 - CFI_ENDPROC 1145 1315 END(paranoid_exit) 1146 1316 1147 1317 /* ··· 1148 1320 * Return: ebx=0: need swapgs on exit, ebx=1: otherwise 1149 1321 */ 1150 1322 ENTRY(error_entry) 1151 - XCPT_FRAME 1 15*8 1152 1323 cld 1153 1324 SAVE_C_REGS 8 1154 1325 SAVE_EXTRA_REGS 8 ··· 1167 1340 * for these here too. 1168 1341 */ 1169 1342 error_kernelspace: 1170 - CFI_REL_OFFSET rcx, RCX+8 1171 1343 incl %ebx 1172 1344 leaq native_irq_return_iret(%rip),%rcx 1173 1345 cmpq %rcx,RIP+8(%rsp) ··· 1190 1364 mov %rax,%rsp 1191 1365 decl %ebx /* Return to usergs */ 1192 1366 jmp error_sti 1193 - CFI_ENDPROC 1194 1367 END(error_entry) 1195 1368 1196 1369 1197 1370 /* On entry, ebx is "no swapgs" flag (1: don't need swapgs, 0: need it) */ 1198 1371 ENTRY(error_exit) 1199 - DEFAULT_FRAME 1200 1372 movl %ebx,%eax 1201 1373 RESTORE_EXTRA_REGS 1202 1374 DISABLE_INTERRUPTS(CLBR_NONE) 1203 1375 TRACE_IRQS_OFF 1204 - GET_THREAD_INFO(%rcx) 1205 1376 testl %eax,%eax 1206 1377 jnz retint_kernel 1207 - LOCKDEP_SYS_EXIT_IRQ 1208 - movl TI_flags(%rcx),%edx 1209 - movl $_TIF_WORK_MASK,%edi 1210 - andl %edi,%edx 1211 - jnz retint_careful 1212 - jmp retint_swapgs 1213 - CFI_ENDPROC 1378 + jmp retint_user 1214 1379 END(error_exit) 1215 1380 1216 1381 /* Runs on exception stack */ 1217 1382 ENTRY(nmi) 1218 - INTR_FRAME 1219 1383 PARAVIRT_ADJUST_EXCEPTION_FRAME 1220 1384 /* 1221 1385 * We allow breakpoints in NMIs. If a breakpoint occurs, then ··· 1240 1424 */ 1241 1425 1242 1426 /* Use %rdx as our temp variable throughout */ 1243 - pushq_cfi %rdx 1244 - CFI_REL_OFFSET rdx, 0 1427 + pushq %rdx 1245 1428 1246 1429 /* 1247 1430 * If %cs was not the kernel segment, then the NMI triggered in user ··· 1274 1459 jb first_nmi 1275 1460 /* Ah, it is within the NMI stack, treat it as nested */ 1276 1461 1277 - CFI_REMEMBER_STATE 1278 - 1279 1462 nested_nmi: 1280 1463 /* 1281 1464 * Do nothing if we interrupted the fixup in repeat_nmi. ··· 1291 1478 /* Set up the interrupted NMIs stack to jump to repeat_nmi */ 1292 1479 leaq -1*8(%rsp), %rdx 1293 1480 movq %rdx, %rsp 1294 - CFI_ADJUST_CFA_OFFSET 1*8 1295 1481 leaq -10*8(%rsp), %rdx 1296 - pushq_cfi $__KERNEL_DS 1297 - pushq_cfi %rdx 1298 - pushfq_cfi 1299 - pushq_cfi $__KERNEL_CS 1300 - pushq_cfi $repeat_nmi 1482 + pushq $__KERNEL_DS 1483 + pushq %rdx 1484 + pushfq 1485 + pushq $__KERNEL_CS 1486 + pushq $repeat_nmi 1301 1487 1302 1488 /* Put stack back */ 1303 1489 addq $(6*8), %rsp 1304 - CFI_ADJUST_CFA_OFFSET -6*8 1305 1490 1306 1491 nested_nmi_out: 1307 - popq_cfi %rdx 1308 - CFI_RESTORE rdx 1492 + popq %rdx 1309 1493 1310 1494 /* No need to check faults here */ 1311 1495 INTERRUPT_RETURN 1312 1496 1313 - CFI_RESTORE_STATE 1314 1497 first_nmi: 1315 1498 /* 1316 1499 * Because nested NMIs will use the pushed location that we ··· 1345 1536 */ 1346 1537 /* Do not pop rdx, nested NMIs will corrupt that part of the stack */ 1347 1538 movq (%rsp), %rdx 1348 - CFI_RESTORE rdx 1349 1539 1350 1540 /* Set the NMI executing variable on the stack. */ 1351 - pushq_cfi $1 1541 + pushq $1 1352 1542 1353 1543 /* 1354 1544 * Leave room for the "copied" frame 1355 1545 */ 1356 1546 subq $(5*8), %rsp 1357 - CFI_ADJUST_CFA_OFFSET 5*8 1358 1547 1359 1548 /* Copy the stack frame to the Saved frame */ 1360 1549 .rept 5 1361 - pushq_cfi 11*8(%rsp) 1550 + pushq 11*8(%rsp) 1362 1551 .endr 1363 - CFI_DEF_CFA_OFFSET 5*8 1364 1552 1365 1553 /* Everything up to here is safe from nested NMIs */ 1366 1554 ··· 1380 1574 1381 1575 /* Make another copy, this one may be modified by nested NMIs */ 1382 1576 addq $(10*8), %rsp 1383 - CFI_ADJUST_CFA_OFFSET -10*8 1384 1577 .rept 5 1385 - pushq_cfi -6*8(%rsp) 1578 + pushq -6*8(%rsp) 1386 1579 .endr 1387 1580 subq $(5*8), %rsp 1388 - CFI_DEF_CFA_OFFSET 5*8 1389 1581 end_repeat_nmi: 1390 1582 1391 1583 /* ··· 1391 1587 * NMI if the first NMI took an exception and reset our iret stack 1392 1588 * so that we repeat another NMI. 1393 1589 */ 1394 - pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ 1590 + pushq $-1 /* ORIG_RAX: no syscall to restart */ 1395 1591 ALLOC_PT_GPREGS_ON_STACK 1396 1592 1397 1593 /* ··· 1402 1598 * exceptions might do. 1403 1599 */ 1404 1600 call paranoid_entry 1405 - DEFAULT_FRAME 0 1406 1601 1407 1602 /* 1408 1603 * Save off the CR2 register. If we take a page fault in the NMI then ··· 1437 1634 1438 1635 /* Clear the NMI executing stack variable */ 1439 1636 movq $0, 5*8(%rsp) 1440 - jmp irq_return 1441 - CFI_ENDPROC 1637 + INTERRUPT_RETURN 1442 1638 END(nmi) 1443 1639 1444 1640 ENTRY(ignore_sysret) 1445 - CFI_STARTPROC 1446 1641 mov $-ENOSYS,%eax 1447 1642 sysret 1448 - CFI_ENDPROC 1449 1643 END(ignore_sysret) 1450 1644
+1 -1
arch/x86/kernel/head64.c
··· 167 167 clear_bss(); 168 168 169 169 for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) 170 - set_intr_gate(i, early_idt_handlers[i]); 170 + set_intr_gate(i, early_idt_handler_array[i]); 171 171 load_idt((const struct desc_ptr *)&idt_descr); 172 172 173 173 copy_bootdata(__va(real_mode_data));
+18 -15
arch/x86/kernel/head_32.S
··· 478 478 __INIT 479 479 setup_once: 480 480 /* 481 - * Set up a idt with 256 entries pointing to ignore_int, 482 - * interrupt gates. It doesn't actually load idt - that needs 483 - * to be done on each CPU. Interrupts are enabled elsewhere, 484 - * when we can be relatively sure everything is ok. 481 + * Set up a idt with 256 interrupt gates that push zero if there 482 + * is no error code and then jump to early_idt_handler_common. 483 + * It doesn't actually load the idt - that needs to be done on 484 + * each CPU. Interrupts are enabled elsewhere, when we can be 485 + * relatively sure everything is ok. 485 486 */ 486 487 487 488 movl $idt_table,%edi 488 - movl $early_idt_handlers,%eax 489 + movl $early_idt_handler_array,%eax 489 490 movl $NUM_EXCEPTION_VECTORS,%ecx 490 491 1: 491 492 movl %eax,(%edi) 492 493 movl %eax,4(%edi) 493 494 /* interrupt gate, dpl=0, present */ 494 495 movl $(0x8E000000 + __KERNEL_CS),2(%edi) 495 - addl $9,%eax 496 + addl $EARLY_IDT_HANDLER_SIZE,%eax 496 497 addl $8,%edi 497 498 loop 1b 498 499 ··· 525 524 andl $0,setup_once_ref /* Once is enough, thanks */ 526 525 ret 527 526 528 - ENTRY(early_idt_handlers) 527 + ENTRY(early_idt_handler_array) 529 528 # 36(%esp) %eflags 530 529 # 32(%esp) %cs 531 530 # 28(%esp) %eip 532 531 # 24(%rsp) error code 533 532 i = 0 534 533 .rept NUM_EXCEPTION_VECTORS 535 - .if (EXCEPTION_ERRCODE_MASK >> i) & 1 536 - ASM_NOP2 537 - .else 534 + .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 538 535 pushl $0 # Dummy error code, to make stack frame uniform 539 536 .endif 540 537 pushl $i # 20(%esp) Vector number 541 - jmp early_idt_handler 538 + jmp early_idt_handler_common 542 539 i = i + 1 540 + .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc 543 541 .endr 544 - ENDPROC(early_idt_handlers) 542 + ENDPROC(early_idt_handler_array) 545 543 546 - /* This is global to keep gas from relaxing the jumps */ 547 - ENTRY(early_idt_handler) 544 + early_idt_handler_common: 545 + /* 546 + * The stack is the hardware frame, an error code or zero, and the 547 + * vector number. 548 + */ 548 549 cld 549 550 550 551 cmpl $2,(%esp) # X86_TRAP_NMI ··· 606 603 .Lis_nmi: 607 604 addl $8,%esp /* drop vector number and error code */ 608 605 iret 609 - ENDPROC(early_idt_handler) 606 + ENDPROC(early_idt_handler_common) 610 607 611 608 /* This is the default interrupt "handler" :-) */ 612 609 ALIGN
+11 -9
arch/x86/kernel/head_64.S
··· 321 321 jmp bad_address 322 322 323 323 __INIT 324 - .globl early_idt_handlers 325 - early_idt_handlers: 324 + ENTRY(early_idt_handler_array) 326 325 # 104(%rsp) %rflags 327 326 # 96(%rsp) %cs 328 327 # 88(%rsp) %rip 329 328 # 80(%rsp) error code 330 329 i = 0 331 330 .rept NUM_EXCEPTION_VECTORS 332 - .if (EXCEPTION_ERRCODE_MASK >> i) & 1 333 - ASM_NOP2 334 - .else 331 + .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 335 332 pushq $0 # Dummy error code, to make stack frame uniform 336 333 .endif 337 334 pushq $i # 72(%rsp) Vector number 338 - jmp early_idt_handler 335 + jmp early_idt_handler_common 339 336 i = i + 1 337 + .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc 340 338 .endr 339 + ENDPROC(early_idt_handler_array) 341 340 342 - /* This is global to keep gas from relaxing the jumps */ 343 - ENTRY(early_idt_handler) 341 + early_idt_handler_common: 342 + /* 343 + * The stack is the hardware frame, an error code or zero, and the 344 + * vector number. 345 + */ 344 346 cld 345 347 346 348 cmpl $2,(%rsp) # X86_TRAP_NMI ··· 414 412 .Lis_nmi: 415 413 addq $16,%rsp # drop vector number and error code 416 414 INTERRUPT_RETURN 417 - ENDPROC(early_idt_handler) 415 + ENDPROC(early_idt_handler_common) 418 416 419 417 __INITDATA 420 418
+3 -3
arch/x86/kernel/syscall_32.c arch/x86/entry/syscall_32.c
··· 10 10 #else 11 11 #define SYM(sym, compat) sym 12 12 #define ia32_sys_call_table sys_call_table 13 - #define __NR_ia32_syscall_max __NR_syscall_max 13 + #define __NR_entry_INT80_compat_max __NR_syscall_max 14 14 #endif 15 15 16 16 #define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void SYM(sym, compat)(void) ; ··· 23 23 24 24 extern asmlinkage void sys_ni_syscall(void); 25 25 26 - __visible const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = { 26 + __visible const sys_call_ptr_t ia32_sys_call_table[__NR_entry_INT80_compat_max+1] = { 27 27 /* 28 28 * Smells like a compiler bug -- it doesn't work 29 29 * when the & below is removed. 30 30 */ 31 - [0 ... __NR_ia32_syscall_max] = &sys_ni_syscall, 31 + [0 ... __NR_entry_INT80_compat_max] = &sys_ni_syscall, 32 32 #include <asm/syscalls_32.h> 33 33 };
arch/x86/kernel/syscall_64.c arch/x86/entry/syscall_64.c
+3 -4
arch/x86/kernel/traps.c
··· 72 72 #else 73 73 #include <asm/processor-flags.h> 74 74 #include <asm/setup.h> 75 - 76 - asmlinkage int system_call(void); 75 + #include <asm/proto.h> 77 76 #endif 78 77 79 78 /* Must be page-aligned because the real IDT is used in a fixmap. */ ··· 979 980 set_bit(i, used_vectors); 980 981 981 982 #ifdef CONFIG_IA32_EMULATION 982 - set_system_intr_gate(IA32_SYSCALL_VECTOR, ia32_syscall); 983 + set_system_intr_gate(IA32_SYSCALL_VECTOR, entry_INT80_compat); 983 984 set_bit(IA32_SYSCALL_VECTOR, used_vectors); 984 985 #endif 985 986 986 987 #ifdef CONFIG_X86_32 987 - set_system_trap_gate(IA32_SYSCALL_VECTOR, &system_call); 988 + set_system_trap_gate(IA32_SYSCALL_VECTOR, entry_INT80_32); 988 989 set_bit(IA32_SYSCALL_VECTOR, used_vectors); 989 990 #endif 990 991
arch/x86/kernel/vsyscall_64.c arch/x86/entry/vsyscall/vsyscall_64.c
arch/x86/kernel/vsyscall_emu_64.S arch/x86/entry/vsyscall/vsyscall_emu_64.S
arch/x86/kernel/vsyscall_gtod.c arch/x86/entry/vsyscall/vsyscall_gtod.c
+1 -1
arch/x86/kernel/vsyscall_trace.h arch/x86/entry/vsyscall/vsyscall_trace.h
··· 24 24 #endif 25 25 26 26 #undef TRACE_INCLUDE_PATH 27 - #define TRACE_INCLUDE_PATH ../../arch/x86/kernel 27 + #define TRACE_INCLUDE_PATH ../../arch/x86/entry/vsyscall/ 28 28 #define TRACE_INCLUDE_FILE vsyscall_trace 29 29 #include <trace/define_trace.h>
-1
arch/x86/lib/Makefile
··· 17 17 obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o 18 18 19 19 lib-y := delay.o misc.o cmdline.o 20 - lib-y += thunk_$(BITS).o 21 20 lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o 22 21 lib-y += memcpy_$(BITS).o 23 22 lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
+2 -5
arch/x86/lib/atomic64_386_32.S
··· 11 11 12 12 #include <linux/linkage.h> 13 13 #include <asm/alternative-asm.h> 14 - #include <asm/dwarf2.h> 15 14 16 15 /* if you want SMP support, implement these with real spinlocks */ 17 16 .macro LOCK reg 18 - pushfl_cfi 17 + pushfl 19 18 cli 20 19 .endm 21 20 22 21 .macro UNLOCK reg 23 - popfl_cfi 22 + popfl 24 23 .endm 25 24 26 25 #define BEGIN(op) \ 27 26 .macro endp; \ 28 - CFI_ENDPROC; \ 29 27 ENDPROC(atomic64_##op##_386); \ 30 28 .purgem endp; \ 31 29 .endm; \ 32 30 ENTRY(atomic64_##op##_386); \ 33 - CFI_STARTPROC; \ 34 31 LOCK v; 35 32 36 33 #define ENDP endp
+20 -41
arch/x86/lib/atomic64_cx8_32.S
··· 11 11 12 12 #include <linux/linkage.h> 13 13 #include <asm/alternative-asm.h> 14 - #include <asm/dwarf2.h> 15 14 16 15 .macro read64 reg 17 16 movl %ebx, %eax ··· 21 22 .endm 22 23 23 24 ENTRY(atomic64_read_cx8) 24 - CFI_STARTPROC 25 - 26 25 read64 %ecx 27 26 ret 28 - CFI_ENDPROC 29 27 ENDPROC(atomic64_read_cx8) 30 28 31 29 ENTRY(atomic64_set_cx8) 32 - CFI_STARTPROC 33 - 34 30 1: 35 31 /* we don't need LOCK_PREFIX since aligned 64-bit writes 36 32 * are atomic on 586 and newer */ ··· 33 39 jne 1b 34 40 35 41 ret 36 - CFI_ENDPROC 37 42 ENDPROC(atomic64_set_cx8) 38 43 39 44 ENTRY(atomic64_xchg_cx8) 40 - CFI_STARTPROC 41 - 42 45 1: 43 46 LOCK_PREFIX 44 47 cmpxchg8b (%esi) 45 48 jne 1b 46 49 47 50 ret 48 - CFI_ENDPROC 49 51 ENDPROC(atomic64_xchg_cx8) 50 52 51 53 .macro addsub_return func ins insc 52 54 ENTRY(atomic64_\func\()_return_cx8) 53 - CFI_STARTPROC 54 - pushl_cfi_reg ebp 55 - pushl_cfi_reg ebx 56 - pushl_cfi_reg esi 57 - pushl_cfi_reg edi 55 + pushl %ebp 56 + pushl %ebx 57 + pushl %esi 58 + pushl %edi 58 59 59 60 movl %eax, %esi 60 61 movl %edx, %edi ··· 68 79 10: 69 80 movl %ebx, %eax 70 81 movl %ecx, %edx 71 - popl_cfi_reg edi 72 - popl_cfi_reg esi 73 - popl_cfi_reg ebx 74 - popl_cfi_reg ebp 82 + popl %edi 83 + popl %esi 84 + popl %ebx 85 + popl %ebp 75 86 ret 76 - CFI_ENDPROC 77 87 ENDPROC(atomic64_\func\()_return_cx8) 78 88 .endm 79 89 ··· 81 93 82 94 .macro incdec_return func ins insc 83 95 ENTRY(atomic64_\func\()_return_cx8) 84 - CFI_STARTPROC 85 - pushl_cfi_reg ebx 96 + pushl %ebx 86 97 87 98 read64 %esi 88 99 1: ··· 96 109 10: 97 110 movl %ebx, %eax 98 111 movl %ecx, %edx 99 - popl_cfi_reg ebx 112 + popl %ebx 100 113 ret 101 - CFI_ENDPROC 102 114 ENDPROC(atomic64_\func\()_return_cx8) 103 115 .endm 104 116 ··· 105 119 incdec_return dec sub sbb 106 120 107 121 ENTRY(atomic64_dec_if_positive_cx8) 108 - CFI_STARTPROC 109 - pushl_cfi_reg ebx 122 + pushl %ebx 110 123 111 124 read64 %esi 112 125 1: ··· 121 136 2: 122 137 movl %ebx, %eax 123 138 movl %ecx, %edx 124 - popl_cfi_reg ebx 139 + popl %ebx 125 140 ret 126 - CFI_ENDPROC 127 141 ENDPROC(atomic64_dec_if_positive_cx8) 128 142 129 143 ENTRY(atomic64_add_unless_cx8) 130 - CFI_STARTPROC 131 - pushl_cfi_reg ebp 132 - pushl_cfi_reg ebx 144 + pushl %ebp 145 + pushl %ebx 133 146 /* these just push these two parameters on the stack */ 134 - pushl_cfi_reg edi 135 - pushl_cfi_reg ecx 147 + pushl %edi 148 + pushl %ecx 136 149 137 150 movl %eax, %ebp 138 151 movl %edx, %edi ··· 151 168 movl $1, %eax 152 169 3: 153 170 addl $8, %esp 154 - CFI_ADJUST_CFA_OFFSET -8 155 - popl_cfi_reg ebx 156 - popl_cfi_reg ebp 171 + popl %ebx 172 + popl %ebp 157 173 ret 158 174 4: 159 175 cmpl %edx, 4(%esp) 160 176 jne 2b 161 177 xorl %eax, %eax 162 178 jmp 3b 163 - CFI_ENDPROC 164 179 ENDPROC(atomic64_add_unless_cx8) 165 180 166 181 ENTRY(atomic64_inc_not_zero_cx8) 167 - CFI_STARTPROC 168 - pushl_cfi_reg ebx 182 + pushl %ebx 169 183 170 184 read64 %esi 171 185 1: ··· 179 199 180 200 movl $1, %eax 181 201 3: 182 - popl_cfi_reg ebx 202 + popl %ebx 183 203 ret 184 - CFI_ENDPROC 185 204 ENDPROC(atomic64_inc_not_zero_cx8)
+21 -31
arch/x86/lib/checksum_32.S
··· 26 26 */ 27 27 28 28 #include <linux/linkage.h> 29 - #include <asm/dwarf2.h> 30 29 #include <asm/errno.h> 31 30 #include <asm/asm.h> 32 31 ··· 49 50 * alignment for the unrolled loop. 50 51 */ 51 52 ENTRY(csum_partial) 52 - CFI_STARTPROC 53 - pushl_cfi_reg esi 54 - pushl_cfi_reg ebx 53 + pushl %esi 54 + pushl %ebx 55 55 movl 20(%esp),%eax # Function arg: unsigned int sum 56 56 movl 16(%esp),%ecx # Function arg: int len 57 57 movl 12(%esp),%esi # Function arg: unsigned char *buff ··· 127 129 jz 8f 128 130 roll $8, %eax 129 131 8: 130 - popl_cfi_reg ebx 131 - popl_cfi_reg esi 132 + popl %ebx 133 + popl %esi 132 134 ret 133 - CFI_ENDPROC 134 135 ENDPROC(csum_partial) 135 136 136 137 #else ··· 137 140 /* Version for PentiumII/PPro */ 138 141 139 142 ENTRY(csum_partial) 140 - CFI_STARTPROC 141 - pushl_cfi_reg esi 142 - pushl_cfi_reg ebx 143 + pushl %esi 144 + pushl %ebx 143 145 movl 20(%esp),%eax # Function arg: unsigned int sum 144 146 movl 16(%esp),%ecx # Function arg: int len 145 147 movl 12(%esp),%esi # Function arg: const unsigned char *buf ··· 245 249 jz 90f 246 250 roll $8, %eax 247 251 90: 248 - popl_cfi_reg ebx 249 - popl_cfi_reg esi 252 + popl %ebx 253 + popl %esi 250 254 ret 251 - CFI_ENDPROC 252 255 ENDPROC(csum_partial) 253 256 254 257 #endif ··· 282 287 #define FP 12 283 288 284 289 ENTRY(csum_partial_copy_generic) 285 - CFI_STARTPROC 286 290 subl $4,%esp 287 - CFI_ADJUST_CFA_OFFSET 4 288 - pushl_cfi_reg edi 289 - pushl_cfi_reg esi 290 - pushl_cfi_reg ebx 291 + pushl %edi 292 + pushl %esi 293 + pushl %ebx 291 294 movl ARGBASE+16(%esp),%eax # sum 292 295 movl ARGBASE+12(%esp),%ecx # len 293 296 movl ARGBASE+4(%esp),%esi # src ··· 394 401 395 402 .previous 396 403 397 - popl_cfi_reg ebx 398 - popl_cfi_reg esi 399 - popl_cfi_reg edi 400 - popl_cfi %ecx # equivalent to addl $4,%esp 404 + popl %ebx 405 + popl %esi 406 + popl %edi 407 + popl %ecx # equivalent to addl $4,%esp 401 408 ret 402 - CFI_ENDPROC 403 409 ENDPROC(csum_partial_copy_generic) 404 410 405 411 #else ··· 418 426 #define ARGBASE 12 419 427 420 428 ENTRY(csum_partial_copy_generic) 421 - CFI_STARTPROC 422 - pushl_cfi_reg ebx 423 - pushl_cfi_reg edi 424 - pushl_cfi_reg esi 429 + pushl %ebx 430 + pushl %edi 431 + pushl %esi 425 432 movl ARGBASE+4(%esp),%esi #src 426 433 movl ARGBASE+8(%esp),%edi #dst 427 434 movl ARGBASE+12(%esp),%ecx #len ··· 480 489 jmp 7b 481 490 .previous 482 491 483 - popl_cfi_reg esi 484 - popl_cfi_reg edi 485 - popl_cfi_reg ebx 492 + popl %esi 493 + popl %edi 494 + popl %ebx 486 495 ret 487 - CFI_ENDPROC 488 496 ENDPROC(csum_partial_copy_generic) 489 497 490 498 #undef ROUND
-7
arch/x86/lib/clear_page_64.S
··· 1 1 #include <linux/linkage.h> 2 - #include <asm/dwarf2.h> 3 2 #include <asm/cpufeature.h> 4 3 #include <asm/alternative-asm.h> 5 4 ··· 14 15 * %rdi - page 15 16 */ 16 17 ENTRY(clear_page) 17 - CFI_STARTPROC 18 18 19 19 ALTERNATIVE_2 "jmp clear_page_orig", "", X86_FEATURE_REP_GOOD, \ 20 20 "jmp clear_page_c_e", X86_FEATURE_ERMS ··· 22 24 xorl %eax,%eax 23 25 rep stosq 24 26 ret 25 - CFI_ENDPROC 26 27 ENDPROC(clear_page) 27 28 28 29 ENTRY(clear_page_orig) 29 - CFI_STARTPROC 30 30 31 31 xorl %eax,%eax 32 32 movl $4096/64,%ecx ··· 44 48 jnz .Lloop 45 49 nop 46 50 ret 47 - CFI_ENDPROC 48 51 ENDPROC(clear_page_orig) 49 52 50 53 ENTRY(clear_page_c_e) 51 - CFI_STARTPROC 52 54 movl $4096,%ecx 53 55 xorl %eax,%eax 54 56 rep stosb 55 57 ret 56 - CFI_ENDPROC 57 58 ENDPROC(clear_page_c_e)
+3 -9
arch/x86/lib/cmpxchg16b_emu.S
··· 6 6 * 7 7 */ 8 8 #include <linux/linkage.h> 9 - #include <asm/dwarf2.h> 10 9 #include <asm/percpu.h> 11 10 12 11 .text ··· 20 21 * %al : Operation successful 21 22 */ 22 23 ENTRY(this_cpu_cmpxchg16b_emu) 23 - CFI_STARTPROC 24 24 25 25 # 26 26 # Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in %al not ··· 30 32 # *atomic* on a single cpu (as provided by the this_cpu_xx class of 31 33 # macros). 32 34 # 33 - pushfq_cfi 35 + pushfq 34 36 cli 35 37 36 38 cmpq PER_CPU_VAR((%rsi)), %rax ··· 41 43 movq %rbx, PER_CPU_VAR((%rsi)) 42 44 movq %rcx, PER_CPU_VAR(8(%rsi)) 43 45 44 - CFI_REMEMBER_STATE 45 - popfq_cfi 46 + popfq 46 47 mov $1, %al 47 48 ret 48 49 49 - CFI_RESTORE_STATE 50 50 .Lnot_same: 51 - popfq_cfi 51 + popfq 52 52 xor %al,%al 53 53 ret 54 - 55 - CFI_ENDPROC 56 54 57 55 ENDPROC(this_cpu_cmpxchg16b_emu)
+3 -8
arch/x86/lib/cmpxchg8b_emu.S
··· 7 7 */ 8 8 9 9 #include <linux/linkage.h> 10 - #include <asm/dwarf2.h> 11 10 12 11 .text 13 12 ··· 19 20 * %ecx : high 32 bits of new value 20 21 */ 21 22 ENTRY(cmpxchg8b_emu) 22 - CFI_STARTPROC 23 23 24 24 # 25 25 # Emulate 'cmpxchg8b (%esi)' on UP except we don't 26 26 # set the whole ZF thing (caller will just compare 27 27 # eax:edx with the expected value) 28 28 # 29 - pushfl_cfi 29 + pushfl 30 30 cli 31 31 32 32 cmpl (%esi), %eax ··· 36 38 movl %ebx, (%esi) 37 39 movl %ecx, 4(%esi) 38 40 39 - CFI_REMEMBER_STATE 40 - popfl_cfi 41 + popfl 41 42 ret 42 43 43 - CFI_RESTORE_STATE 44 44 .Lnot_same: 45 45 movl (%esi), %eax 46 46 .Lhalf_same: 47 47 movl 4(%esi), %edx 48 48 49 - popfl_cfi 49 + popfl 50 50 ret 51 51 52 - CFI_ENDPROC 53 52 ENDPROC(cmpxchg8b_emu)
-11
arch/x86/lib/copy_page_64.S
··· 1 1 /* Written 2003 by Andi Kleen, based on a kernel by Evandro Menezes */ 2 2 3 3 #include <linux/linkage.h> 4 - #include <asm/dwarf2.h> 5 4 #include <asm/cpufeature.h> 6 5 #include <asm/alternative-asm.h> 7 6 ··· 12 13 */ 13 14 ALIGN 14 15 ENTRY(copy_page) 15 - CFI_STARTPROC 16 16 ALTERNATIVE "jmp copy_page_regs", "", X86_FEATURE_REP_GOOD 17 17 movl $4096/8, %ecx 18 18 rep movsq 19 19 ret 20 - CFI_ENDPROC 21 20 ENDPROC(copy_page) 22 21 23 22 ENTRY(copy_page_regs) 24 - CFI_STARTPROC 25 23 subq $2*8, %rsp 26 - CFI_ADJUST_CFA_OFFSET 2*8 27 24 movq %rbx, (%rsp) 28 - CFI_REL_OFFSET rbx, 0 29 25 movq %r12, 1*8(%rsp) 30 - CFI_REL_OFFSET r12, 1*8 31 26 32 27 movl $(4096/64)-5, %ecx 33 28 .p2align 4 ··· 80 87 jnz .Loop2 81 88 82 89 movq (%rsp), %rbx 83 - CFI_RESTORE rbx 84 90 movq 1*8(%rsp), %r12 85 - CFI_RESTORE r12 86 91 addq $2*8, %rsp 87 - CFI_ADJUST_CFA_OFFSET -2*8 88 92 ret 89 - CFI_ENDPROC 90 93 ENDPROC(copy_page_regs)
-15
arch/x86/lib/copy_user_64.S
··· 7 7 */ 8 8 9 9 #include <linux/linkage.h> 10 - #include <asm/dwarf2.h> 11 10 #include <asm/current.h> 12 11 #include <asm/asm-offsets.h> 13 12 #include <asm/thread_info.h> ··· 17 18 18 19 /* Standard copy_to_user with segment limit checking */ 19 20 ENTRY(_copy_to_user) 20 - CFI_STARTPROC 21 21 GET_THREAD_INFO(%rax) 22 22 movq %rdi,%rcx 23 23 addq %rdx,%rcx ··· 28 30 X86_FEATURE_REP_GOOD, \ 29 31 "jmp copy_user_enhanced_fast_string", \ 30 32 X86_FEATURE_ERMS 31 - CFI_ENDPROC 32 33 ENDPROC(_copy_to_user) 33 34 34 35 /* Standard copy_from_user with segment limit checking */ 35 36 ENTRY(_copy_from_user) 36 - CFI_STARTPROC 37 37 GET_THREAD_INFO(%rax) 38 38 movq %rsi,%rcx 39 39 addq %rdx,%rcx ··· 43 47 X86_FEATURE_REP_GOOD, \ 44 48 "jmp copy_user_enhanced_fast_string", \ 45 49 X86_FEATURE_ERMS 46 - CFI_ENDPROC 47 50 ENDPROC(_copy_from_user) 48 51 49 52 .section .fixup,"ax" 50 53 /* must zero dest */ 51 54 ENTRY(bad_from_user) 52 55 bad_from_user: 53 - CFI_STARTPROC 54 56 movl %edx,%ecx 55 57 xorl %eax,%eax 56 58 rep ··· 56 62 bad_to_user: 57 63 movl %edx,%eax 58 64 ret 59 - CFI_ENDPROC 60 65 ENDPROC(bad_from_user) 61 66 .previous 62 67 ··· 73 80 * eax uncopied bytes or 0 if successful. 74 81 */ 75 82 ENTRY(copy_user_generic_unrolled) 76 - CFI_STARTPROC 77 83 ASM_STAC 78 84 cmpl $8,%edx 79 85 jb 20f /* less then 8 bytes, go to byte copy loop */ ··· 154 162 _ASM_EXTABLE(19b,40b) 155 163 _ASM_EXTABLE(21b,50b) 156 164 _ASM_EXTABLE(22b,50b) 157 - CFI_ENDPROC 158 165 ENDPROC(copy_user_generic_unrolled) 159 166 160 167 /* Some CPUs run faster using the string copy instructions. ··· 175 184 * eax uncopied bytes or 0 if successful. 176 185 */ 177 186 ENTRY(copy_user_generic_string) 178 - CFI_STARTPROC 179 187 ASM_STAC 180 188 cmpl $8,%edx 181 189 jb 2f /* less than 8 bytes, go to byte copy loop */ ··· 199 209 200 210 _ASM_EXTABLE(1b,11b) 201 211 _ASM_EXTABLE(3b,12b) 202 - CFI_ENDPROC 203 212 ENDPROC(copy_user_generic_string) 204 213 205 214 /* ··· 214 225 * eax uncopied bytes or 0 if successful. 215 226 */ 216 227 ENTRY(copy_user_enhanced_fast_string) 217 - CFI_STARTPROC 218 228 ASM_STAC 219 229 movl %edx,%ecx 220 230 1: rep ··· 228 240 .previous 229 241 230 242 _ASM_EXTABLE(1b,12b) 231 - CFI_ENDPROC 232 243 ENDPROC(copy_user_enhanced_fast_string) 233 244 234 245 /* ··· 235 248 * This will force destination/source out of cache for more performance. 236 249 */ 237 250 ENTRY(__copy_user_nocache) 238 - CFI_STARTPROC 239 251 ASM_STAC 240 252 cmpl $8,%edx 241 253 jb 20f /* less then 8 bytes, go to byte copy loop */ ··· 318 332 _ASM_EXTABLE(19b,40b) 319 333 _ASM_EXTABLE(21b,50b) 320 334 _ASM_EXTABLE(22b,50b) 321 - CFI_ENDPROC 322 335 ENDPROC(__copy_user_nocache)
-17
arch/x86/lib/csum-copy_64.S
··· 6 6 * for more details. No warranty for anything given at all. 7 7 */ 8 8 #include <linux/linkage.h> 9 - #include <asm/dwarf2.h> 10 9 #include <asm/errno.h> 11 10 #include <asm/asm.h> 12 11 ··· 46 47 47 48 48 49 ENTRY(csum_partial_copy_generic) 49 - CFI_STARTPROC 50 50 cmpl $3*64, %edx 51 51 jle .Lignore 52 52 53 53 .Lignore: 54 54 subq $7*8, %rsp 55 - CFI_ADJUST_CFA_OFFSET 7*8 56 55 movq %rbx, 2*8(%rsp) 57 - CFI_REL_OFFSET rbx, 2*8 58 56 movq %r12, 3*8(%rsp) 59 - CFI_REL_OFFSET r12, 3*8 60 57 movq %r14, 4*8(%rsp) 61 - CFI_REL_OFFSET r14, 4*8 62 58 movq %r13, 5*8(%rsp) 63 - CFI_REL_OFFSET r13, 5*8 64 59 movq %rbp, 6*8(%rsp) 65 - CFI_REL_OFFSET rbp, 6*8 66 60 67 61 movq %r8, (%rsp) 68 62 movq %r9, 1*8(%rsp) ··· 198 206 addl %ebx, %eax 199 207 adcl %r9d, %eax /* carry */ 200 208 201 - CFI_REMEMBER_STATE 202 209 .Lende: 203 210 movq 2*8(%rsp), %rbx 204 - CFI_RESTORE rbx 205 211 movq 3*8(%rsp), %r12 206 - CFI_RESTORE r12 207 212 movq 4*8(%rsp), %r14 208 - CFI_RESTORE r14 209 213 movq 5*8(%rsp), %r13 210 - CFI_RESTORE r13 211 214 movq 6*8(%rsp), %rbp 212 - CFI_RESTORE rbp 213 215 addq $7*8, %rsp 214 - CFI_ADJUST_CFA_OFFSET -7*8 215 216 ret 216 - CFI_RESTORE_STATE 217 217 218 218 /* Exception handlers. Very simple, zeroing is done in the wrappers */ 219 219 .Lbad_source: ··· 221 237 jz .Lende 222 238 movl $-EFAULT, (%rax) 223 239 jmp .Lende 224 - CFI_ENDPROC 225 240 ENDPROC(csum_partial_copy_generic)
-13
arch/x86/lib/getuser.S
··· 26 26 */ 27 27 28 28 #include <linux/linkage.h> 29 - #include <asm/dwarf2.h> 30 29 #include <asm/page_types.h> 31 30 #include <asm/errno.h> 32 31 #include <asm/asm-offsets.h> ··· 35 36 36 37 .text 37 38 ENTRY(__get_user_1) 38 - CFI_STARTPROC 39 39 GET_THREAD_INFO(%_ASM_DX) 40 40 cmp TI_addr_limit(%_ASM_DX),%_ASM_AX 41 41 jae bad_get_user ··· 43 45 xor %eax,%eax 44 46 ASM_CLAC 45 47 ret 46 - CFI_ENDPROC 47 48 ENDPROC(__get_user_1) 48 49 49 50 ENTRY(__get_user_2) 50 - CFI_STARTPROC 51 51 add $1,%_ASM_AX 52 52 jc bad_get_user 53 53 GET_THREAD_INFO(%_ASM_DX) ··· 56 60 xor %eax,%eax 57 61 ASM_CLAC 58 62 ret 59 - CFI_ENDPROC 60 63 ENDPROC(__get_user_2) 61 64 62 65 ENTRY(__get_user_4) 63 - CFI_STARTPROC 64 66 add $3,%_ASM_AX 65 67 jc bad_get_user 66 68 GET_THREAD_INFO(%_ASM_DX) ··· 69 75 xor %eax,%eax 70 76 ASM_CLAC 71 77 ret 72 - CFI_ENDPROC 73 78 ENDPROC(__get_user_4) 74 79 75 80 ENTRY(__get_user_8) 76 - CFI_STARTPROC 77 81 #ifdef CONFIG_X86_64 78 82 add $7,%_ASM_AX 79 83 jc bad_get_user ··· 96 104 ASM_CLAC 97 105 ret 98 106 #endif 99 - CFI_ENDPROC 100 107 ENDPROC(__get_user_8) 101 108 102 109 103 110 bad_get_user: 104 - CFI_STARTPROC 105 111 xor %edx,%edx 106 112 mov $(-EFAULT),%_ASM_AX 107 113 ASM_CLAC 108 114 ret 109 - CFI_ENDPROC 110 115 END(bad_get_user) 111 116 112 117 #ifdef CONFIG_X86_32 113 118 bad_get_user_8: 114 - CFI_STARTPROC 115 119 xor %edx,%edx 116 120 xor %ecx,%ecx 117 121 mov $(-EFAULT),%_ASM_AX 118 122 ASM_CLAC 119 123 ret 120 - CFI_ENDPROC 121 124 END(bad_get_user_8) 122 125 #endif 123 126
-3
arch/x86/lib/iomap_copy_64.S
··· 16 16 */ 17 17 18 18 #include <linux/linkage.h> 19 - #include <asm/dwarf2.h> 20 19 21 20 /* 22 21 * override generic version in lib/iomap_copy.c 23 22 */ 24 23 ENTRY(__iowrite32_copy) 25 - CFI_STARTPROC 26 24 movl %edx,%ecx 27 25 rep movsd 28 26 ret 29 - CFI_ENDPROC 30 27 ENDPROC(__iowrite32_copy)
-3
arch/x86/lib/memcpy_64.S
··· 2 2 3 3 #include <linux/linkage.h> 4 4 #include <asm/cpufeature.h> 5 - #include <asm/dwarf2.h> 6 5 #include <asm/alternative-asm.h> 7 6 8 7 /* ··· 52 53 ENDPROC(memcpy_erms) 53 54 54 55 ENTRY(memcpy_orig) 55 - CFI_STARTPROC 56 56 movq %rdi, %rax 57 57 58 58 cmpq $0x20, %rdx ··· 176 178 177 179 .Lend: 178 180 retq 179 - CFI_ENDPROC 180 181 ENDPROC(memcpy_orig)
-3
arch/x86/lib/memmove_64.S
··· 6 6 * - Copyright 2011 Fenghua Yu <fenghua.yu@intel.com> 7 7 */ 8 8 #include <linux/linkage.h> 9 - #include <asm/dwarf2.h> 10 9 #include <asm/cpufeature.h> 11 10 #include <asm/alternative-asm.h> 12 11 ··· 26 27 27 28 ENTRY(memmove) 28 29 ENTRY(__memmove) 29 - CFI_STARTPROC 30 30 31 31 /* Handle more 32 bytes in loop */ 32 32 mov %rdi, %rax ··· 205 207 movb %r11b, (%rdi) 206 208 13: 207 209 retq 208 - CFI_ENDPROC 209 210 ENDPROC(__memmove) 210 211 ENDPROC(memmove)
-5
arch/x86/lib/memset_64.S
··· 1 1 /* Copyright 2002 Andi Kleen, SuSE Labs */ 2 2 3 3 #include <linux/linkage.h> 4 - #include <asm/dwarf2.h> 5 4 #include <asm/cpufeature.h> 6 5 #include <asm/alternative-asm.h> 7 6 ··· 65 66 ENDPROC(memset_erms) 66 67 67 68 ENTRY(memset_orig) 68 - CFI_STARTPROC 69 69 movq %rdi,%r10 70 70 71 71 /* expand byte value */ ··· 76 78 movl %edi,%r9d 77 79 andl $7,%r9d 78 80 jnz .Lbad_alignment 79 - CFI_REMEMBER_STATE 80 81 .Lafter_bad_alignment: 81 82 82 83 movq %rdx,%rcx ··· 125 128 movq %r10,%rax 126 129 ret 127 130 128 - CFI_RESTORE_STATE 129 131 .Lbad_alignment: 130 132 cmpq $7,%rdx 131 133 jbe .Lhandle_7 ··· 135 139 subq %r8,%rdx 136 140 jmp .Lafter_bad_alignment 137 141 .Lfinal: 138 - CFI_ENDPROC 139 142 ENDPROC(memset_orig)
+17 -27
arch/x86/lib/msr-reg.S
··· 1 1 #include <linux/linkage.h> 2 2 #include <linux/errno.h> 3 - #include <asm/dwarf2.h> 4 3 #include <asm/asm.h> 5 4 #include <asm/msr.h> 6 5 ··· 12 13 */ 13 14 .macro op_safe_regs op 14 15 ENTRY(\op\()_safe_regs) 15 - CFI_STARTPROC 16 - pushq_cfi_reg rbx 17 - pushq_cfi_reg rbp 16 + pushq %rbx 17 + pushq %rbp 18 18 movq %rdi, %r10 /* Save pointer */ 19 19 xorl %r11d, %r11d /* Return value */ 20 20 movl (%rdi), %eax ··· 23 25 movl 20(%rdi), %ebp 24 26 movl 24(%rdi), %esi 25 27 movl 28(%rdi), %edi 26 - CFI_REMEMBER_STATE 27 28 1: \op 28 29 2: movl %eax, (%r10) 29 30 movl %r11d, %eax /* Return value */ ··· 32 35 movl %ebp, 20(%r10) 33 36 movl %esi, 24(%r10) 34 37 movl %edi, 28(%r10) 35 - popq_cfi_reg rbp 36 - popq_cfi_reg rbx 38 + popq %rbp 39 + popq %rbx 37 40 ret 38 41 3: 39 - CFI_RESTORE_STATE 40 42 movl $-EIO, %r11d 41 43 jmp 2b 42 44 43 45 _ASM_EXTABLE(1b, 3b) 44 - CFI_ENDPROC 45 46 ENDPROC(\op\()_safe_regs) 46 47 .endm 47 48 ··· 47 52 48 53 .macro op_safe_regs op 49 54 ENTRY(\op\()_safe_regs) 50 - CFI_STARTPROC 51 - pushl_cfi_reg ebx 52 - pushl_cfi_reg ebp 53 - pushl_cfi_reg esi 54 - pushl_cfi_reg edi 55 - pushl_cfi $0 /* Return value */ 56 - pushl_cfi %eax 55 + pushl %ebx 56 + pushl %ebp 57 + pushl %esi 58 + pushl %edi 59 + pushl $0 /* Return value */ 60 + pushl %eax 57 61 movl 4(%eax), %ecx 58 62 movl 8(%eax), %edx 59 63 movl 12(%eax), %ebx ··· 60 66 movl 24(%eax), %esi 61 67 movl 28(%eax), %edi 62 68 movl (%eax), %eax 63 - CFI_REMEMBER_STATE 64 69 1: \op 65 - 2: pushl_cfi %eax 70 + 2: pushl %eax 66 71 movl 4(%esp), %eax 67 - popl_cfi (%eax) 72 + popl (%eax) 68 73 addl $4, %esp 69 - CFI_ADJUST_CFA_OFFSET -4 70 74 movl %ecx, 4(%eax) 71 75 movl %edx, 8(%eax) 72 76 movl %ebx, 12(%eax) 73 77 movl %ebp, 20(%eax) 74 78 movl %esi, 24(%eax) 75 79 movl %edi, 28(%eax) 76 - popl_cfi %eax 77 - popl_cfi_reg edi 78 - popl_cfi_reg esi 79 - popl_cfi_reg ebp 80 - popl_cfi_reg ebx 80 + popl %eax 81 + popl %edi 82 + popl %esi 83 + popl %ebp 84 + popl %ebx 81 85 ret 82 86 3: 83 - CFI_RESTORE_STATE 84 87 movl $-EIO, 4(%esp) 85 88 jmp 2b 86 89 87 90 _ASM_EXTABLE(1b, 3b) 88 - CFI_ENDPROC 89 91 ENDPROC(\op\()_safe_regs) 90 92 .endm 91 93
+2 -6
arch/x86/lib/putuser.S
··· 11 11 * return value. 12 12 */ 13 13 #include <linux/linkage.h> 14 - #include <asm/dwarf2.h> 15 14 #include <asm/thread_info.h> 16 15 #include <asm/errno.h> 17 16 #include <asm/asm.h> ··· 29 30 * as they get called from within inline assembly. 30 31 */ 31 32 32 - #define ENTER CFI_STARTPROC ; \ 33 - GET_THREAD_INFO(%_ASM_BX) 33 + #define ENTER GET_THREAD_INFO(%_ASM_BX) 34 34 #define EXIT ASM_CLAC ; \ 35 - ret ; \ 36 - CFI_ENDPROC 35 + ret 37 36 38 37 .text 39 38 ENTRY(__put_user_1) ··· 84 87 ENDPROC(__put_user_8) 85 88 86 89 bad_put_user: 87 - CFI_STARTPROC 88 90 movl $-EFAULT,%eax 89 91 EXIT 90 92 END(bad_put_user)
+20 -29
arch/x86/lib/rwsem.S
··· 15 15 16 16 #include <linux/linkage.h> 17 17 #include <asm/alternative-asm.h> 18 - #include <asm/dwarf2.h> 19 18 20 19 #define __ASM_HALF_REG(reg) __ASM_SEL(reg, e##reg) 21 20 #define __ASM_HALF_SIZE(inst) __ASM_SEL(inst##w, inst##l) ··· 33 34 */ 34 35 35 36 #define save_common_regs \ 36 - pushl_cfi_reg ecx 37 + pushl %ecx 37 38 38 39 #define restore_common_regs \ 39 - popl_cfi_reg ecx 40 + popl %ecx 40 41 41 42 /* Avoid uglifying the argument copying x86-64 needs to do. */ 42 43 .macro movq src, dst ··· 63 64 */ 64 65 65 66 #define save_common_regs \ 66 - pushq_cfi_reg rdi; \ 67 - pushq_cfi_reg rsi; \ 68 - pushq_cfi_reg rcx; \ 69 - pushq_cfi_reg r8; \ 70 - pushq_cfi_reg r9; \ 71 - pushq_cfi_reg r10; \ 72 - pushq_cfi_reg r11 67 + pushq %rdi; \ 68 + pushq %rsi; \ 69 + pushq %rcx; \ 70 + pushq %r8; \ 71 + pushq %r9; \ 72 + pushq %r10; \ 73 + pushq %r11 73 74 74 75 #define restore_common_regs \ 75 - popq_cfi_reg r11; \ 76 - popq_cfi_reg r10; \ 77 - popq_cfi_reg r9; \ 78 - popq_cfi_reg r8; \ 79 - popq_cfi_reg rcx; \ 80 - popq_cfi_reg rsi; \ 81 - popq_cfi_reg rdi 76 + popq %r11; \ 77 + popq %r10; \ 78 + popq %r9; \ 79 + popq %r8; \ 80 + popq %rcx; \ 81 + popq %rsi; \ 82 + popq %rdi 82 83 83 84 #endif 84 85 85 86 /* Fix up special calling conventions */ 86 87 ENTRY(call_rwsem_down_read_failed) 87 - CFI_STARTPROC 88 88 save_common_regs 89 - __ASM_SIZE(push,_cfi_reg) __ASM_REG(dx) 89 + __ASM_SIZE(push,) %__ASM_REG(dx) 90 90 movq %rax,%rdi 91 91 call rwsem_down_read_failed 92 - __ASM_SIZE(pop,_cfi_reg) __ASM_REG(dx) 92 + __ASM_SIZE(pop,) %__ASM_REG(dx) 93 93 restore_common_regs 94 94 ret 95 - CFI_ENDPROC 96 95 ENDPROC(call_rwsem_down_read_failed) 97 96 98 97 ENTRY(call_rwsem_down_write_failed) 99 - CFI_STARTPROC 100 98 save_common_regs 101 99 movq %rax,%rdi 102 100 call rwsem_down_write_failed 103 101 restore_common_regs 104 102 ret 105 - CFI_ENDPROC 106 103 ENDPROC(call_rwsem_down_write_failed) 107 104 108 105 ENTRY(call_rwsem_wake) 109 - CFI_STARTPROC 110 106 /* do nothing if still outstanding active readers */ 111 107 __ASM_HALF_SIZE(dec) %__ASM_HALF_REG(dx) 112 108 jnz 1f ··· 110 116 call rwsem_wake 111 117 restore_common_regs 112 118 1: ret 113 - CFI_ENDPROC 114 119 ENDPROC(call_rwsem_wake) 115 120 116 121 ENTRY(call_rwsem_downgrade_wake) 117 - CFI_STARTPROC 118 122 save_common_regs 119 - __ASM_SIZE(push,_cfi_reg) __ASM_REG(dx) 123 + __ASM_SIZE(push,) %__ASM_REG(dx) 120 124 movq %rax,%rdi 121 125 call rwsem_downgrade_wake 122 - __ASM_SIZE(pop,_cfi_reg) __ASM_REG(dx) 126 + __ASM_SIZE(pop,) %__ASM_REG(dx) 123 127 restore_common_regs 124 128 ret 125 - CFI_ENDPROC 126 129 ENDPROC(call_rwsem_downgrade_wake)
+6 -9
arch/x86/lib/thunk_32.S arch/x86/entry/thunk_32.S
··· 6 6 */ 7 7 #include <linux/linkage.h> 8 8 #include <asm/asm.h> 9 - #include <asm/dwarf2.h> 10 9 11 10 /* put return address in eax (arg1) */ 12 11 .macro THUNK name, func, put_ret_addr_in_eax=0 13 12 .globl \name 14 13 \name: 15 - CFI_STARTPROC 16 - pushl_cfi_reg eax 17 - pushl_cfi_reg ecx 18 - pushl_cfi_reg edx 14 + pushl %eax 15 + pushl %ecx 16 + pushl %edx 19 17 20 18 .if \put_ret_addr_in_eax 21 19 /* Place EIP in the arg1 */ ··· 21 23 .endif 22 24 23 25 call \func 24 - popl_cfi_reg edx 25 - popl_cfi_reg ecx 26 - popl_cfi_reg eax 26 + popl %edx 27 + popl %ecx 28 + popl %eax 27 29 ret 28 - CFI_ENDPROC 29 30 _ASM_NOKPROBE(\name) 30 31 .endm 31 32
+20 -26
arch/x86/lib/thunk_64.S arch/x86/entry/thunk_64.S
··· 6 6 * Subject to the GNU public license, v.2. No warranty of any kind. 7 7 */ 8 8 #include <linux/linkage.h> 9 - #include <asm/dwarf2.h> 10 - #include <asm/calling.h> 9 + #include "calling.h" 11 10 #include <asm/asm.h> 12 11 13 12 /* rdi: arg1 ... normal C conventions. rax is saved/restored. */ 14 13 .macro THUNK name, func, put_ret_addr_in_rdi=0 15 14 .globl \name 16 15 \name: 17 - CFI_STARTPROC 18 16 19 17 /* this one pushes 9 elems, the next one would be %rIP */ 20 - pushq_cfi_reg rdi 21 - pushq_cfi_reg rsi 22 - pushq_cfi_reg rdx 23 - pushq_cfi_reg rcx 24 - pushq_cfi_reg rax 25 - pushq_cfi_reg r8 26 - pushq_cfi_reg r9 27 - pushq_cfi_reg r10 28 - pushq_cfi_reg r11 18 + pushq %rdi 19 + pushq %rsi 20 + pushq %rdx 21 + pushq %rcx 22 + pushq %rax 23 + pushq %r8 24 + pushq %r9 25 + pushq %r10 26 + pushq %r11 29 27 30 28 .if \put_ret_addr_in_rdi 31 29 /* 9*8(%rsp) is return addr on stack */ 32 - movq_cfi_restore 9*8, rdi 30 + movq 9*8(%rsp), %rdi 33 31 .endif 34 32 35 33 call \func 36 34 jmp restore 37 - CFI_ENDPROC 38 35 _ASM_NOKPROBE(\name) 39 36 .endm 40 37 ··· 54 57 #if defined(CONFIG_TRACE_IRQFLAGS) \ 55 58 || defined(CONFIG_DEBUG_LOCK_ALLOC) \ 56 59 || defined(CONFIG_PREEMPT) 57 - CFI_STARTPROC 58 - CFI_ADJUST_CFA_OFFSET 9*8 59 60 restore: 60 - popq_cfi_reg r11 61 - popq_cfi_reg r10 62 - popq_cfi_reg r9 63 - popq_cfi_reg r8 64 - popq_cfi_reg rax 65 - popq_cfi_reg rcx 66 - popq_cfi_reg rdx 67 - popq_cfi_reg rsi 68 - popq_cfi_reg rdi 61 + popq %r11 62 + popq %r10 63 + popq %r9 64 + popq %r8 65 + popq %rax 66 + popq %rcx 67 + popq %rdx 68 + popq %rsi 69 + popq %rdi 69 70 ret 70 - CFI_ENDPROC 71 71 _ASM_NOKPROBE(restore) 72 72 #endif
-1
arch/x86/net/bpf_jit.S
··· 8 8 * of the License. 9 9 */ 10 10 #include <linux/linkage.h> 11 - #include <asm/dwarf2.h> 12 11 13 12 /* 14 13 * Calling convention :
+2 -2
arch/x86/syscalls/Makefile arch/x86/entry/syscalls/Makefile
··· 1 - out := $(obj)/../include/generated/asm 2 - uapi := $(obj)/../include/generated/uapi/asm 1 + out := $(obj)/../../include/generated/asm 2 + uapi := $(obj)/../../include/generated/uapi/asm 3 3 4 4 # Create output directory if not already present 5 5 _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
arch/x86/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl
arch/x86/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
arch/x86/syscalls/syscallhdr.sh arch/x86/entry/syscalls/syscallhdr.sh
arch/x86/syscalls/syscalltbl.sh arch/x86/entry/syscalls/syscalltbl.sh
+1 -1
arch/x86/um/Makefile
··· 26 26 27 27 obj-y += syscalls_64.o vdso/ 28 28 29 - subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../lib/thunk_64.o \ 29 + subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk_64.o \ 30 30 ../lib/rwsem.o 31 31 32 32 endif
arch/x86/vdso/.gitignore arch/x86/entry/vdso/.gitignore
arch/x86/vdso/Makefile arch/x86/entry/vdso/Makefile
arch/x86/vdso/checkundef.sh arch/x86/entry/vdso/checkundef.sh
arch/x86/vdso/vclock_gettime.c arch/x86/entry/vdso/vclock_gettime.c
arch/x86/vdso/vdso-layout.lds.S arch/x86/entry/vdso/vdso-layout.lds.S
arch/x86/vdso/vdso-note.S arch/x86/entry/vdso/vdso-note.S
arch/x86/vdso/vdso.lds.S arch/x86/entry/vdso/vdso.lds.S
arch/x86/vdso/vdso2c.c arch/x86/entry/vdso/vdso2c.c
arch/x86/vdso/vdso2c.h arch/x86/entry/vdso/vdso2c.h
arch/x86/vdso/vdso32-setup.c arch/x86/entry/vdso/vdso32-setup.c
arch/x86/vdso/vdso32/.gitignore arch/x86/entry/vdso/vdso32/.gitignore
arch/x86/vdso/vdso32/int80.S arch/x86/entry/vdso/vdso32/int80.S
arch/x86/vdso/vdso32/note.S arch/x86/entry/vdso/vdso32/note.S
arch/x86/vdso/vdso32/sigreturn.S arch/x86/entry/vdso/vdso32/sigreturn.S
arch/x86/vdso/vdso32/syscall.S arch/x86/entry/vdso/vdso32/syscall.S
arch/x86/vdso/vdso32/sysenter.S arch/x86/entry/vdso/vdso32/sysenter.S
arch/x86/vdso/vdso32/vclock_gettime.c arch/x86/entry/vdso/vdso32/vclock_gettime.c
arch/x86/vdso/vdso32/vdso-fakesections.c arch/x86/entry/vdso/vdso32/vdso-fakesections.c
arch/x86/vdso/vdso32/vdso32.lds.S arch/x86/entry/vdso/vdso32/vdso32.lds.S
arch/x86/vdso/vdsox32.lds.S arch/x86/entry/vdso/vdsox32.lds.S
arch/x86/vdso/vgetcpu.c arch/x86/entry/vdso/vgetcpu.c
arch/x86/vdso/vma.c arch/x86/entry/vdso/vma.c
+3 -3
arch/x86/xen/xen-asm_64.S
··· 114 114 /* Normal 64-bit system call target */ 115 115 ENTRY(xen_syscall_target) 116 116 undo_xen_syscall 117 - jmp system_call_after_swapgs 117 + jmp entry_SYSCALL_64_after_swapgs 118 118 ENDPROC(xen_syscall_target) 119 119 120 120 #ifdef CONFIG_IA32_EMULATION ··· 122 122 /* 32-bit compat syscall target */ 123 123 ENTRY(xen_syscall32_target) 124 124 undo_xen_syscall 125 - jmp ia32_cstar_target 125 + jmp entry_SYSCALL_compat 126 126 ENDPROC(xen_syscall32_target) 127 127 128 128 /* 32-bit compat sysenter target */ 129 129 ENTRY(xen_sysenter_target) 130 130 undo_xen_syscall 131 - jmp ia32_sysenter_target 131 + jmp entry_SYSENTER_compat 132 132 ENDPROC(xen_sysenter_target) 133 133 134 134 #else /* !CONFIG_IA32_EMULATION */
+1 -1
scripts/checksyscalls.sh
··· 212 212 ) 213 213 } 214 214 215 - (ignore_list && syscall_list $(dirname $0)/../arch/x86/syscalls/syscall_32.tbl) | \ 215 + (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \ 216 216 $* -E -x c - > /dev/null