diff options
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 8a445a0c989e..d656f68371a4 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -297,27 +297,26 @@ ENDPROC(native_usergs_sysret64) | |||
297 | .endm | 297 | .endm |
298 | 298 | ||
299 | /* save partial stack frame */ | 299 | /* save partial stack frame */ |
300 | .pushsection .kprobes.text, "ax" | 300 | .macro SAVE_ARGS_IRQ |
301 | ENTRY(save_args) | ||
302 | XCPT_FRAME | ||
303 | cld | 301 | cld |
304 | /* | 302 | /* start from rbp in pt_regs and jump over */ |
305 | * start from rbp in pt_regs and jump over | 303 | movq_cfi rdi, RDI-RBP |
306 | * return address. | 304 | movq_cfi rsi, RSI-RBP |
307 | */ | 305 | movq_cfi rdx, RDX-RBP |
308 | movq_cfi rdi, RDI+8-RBP | 306 | movq_cfi rcx, RCX-RBP |
309 | movq_cfi rsi, RSI+8-RBP | 307 | movq_cfi rax, RAX-RBP |
310 | movq_cfi rdx, RDX+8-RBP | 308 | movq_cfi r8, R8-RBP |
311 | movq_cfi rcx, RCX+8-RBP | 309 | movq_cfi r9, R9-RBP |
312 | movq_cfi rax, RAX+8-RBP | 310 | movq_cfi r10, R10-RBP |
313 | movq_cfi r8, R8+8-RBP | 311 | movq_cfi r11, R11-RBP |
314 | movq_cfi r9, R9+8-RBP | 312 | |
315 | movq_cfi r10, R10+8-RBP | 313 | /* Save rbp so that we can unwind from get_irq_regs() */ |
316 | movq_cfi r11, R11+8-RBP | 314 | movq_cfi rbp, 0 |
317 | 315 | ||
318 | leaq -RBP+8(%rsp),%rdi /* arg1 for handler */ | 316 | /* Save previous stack value */ |
319 | movq_cfi rbp, 8 /* push %rbp */ | 317 | movq %rsp, %rsi |
320 | leaq 8(%rsp), %rbp /* mov %rsp, %ebp */ | 318 | |
319 | leaq -RBP(%rsp),%rdi /* arg1 for handler */ | ||
321 | testl $3, CS(%rdi) | 320 | testl $3, CS(%rdi) |
322 | je 1f | 321 | je 1f |
323 | SWAPGS | 322 | SWAPGS |
@@ -329,19 +328,14 @@ ENTRY(save_args) | |||
329 | */ | 328 | */ |
330 | 1: incl PER_CPU_VAR(irq_count) | 329 | 1: incl PER_CPU_VAR(irq_count) |
331 | jne 2f | 330 | jne 2f |
332 | popq_cfi %rax /* move return address... */ | ||
333 | mov PER_CPU_VAR(irq_stack_ptr),%rsp | 331 | mov PER_CPU_VAR(irq_stack_ptr),%rsp |
334 | EMPTY_FRAME 0 | 332 | EMPTY_FRAME 0 |
335 | pushq_cfi %rbp /* backlink for unwinder */ | 333 | |
336 | pushq_cfi %rax /* ... to the new stack */ | 334 | 2: /* Store previous stack value */ |
337 | /* | 335 | pushq %rsi |
338 | * We entered an interrupt context - irqs are off: | 336 | /* We entered an interrupt context - irqs are off: */ |
339 | */ | 337 | TRACE_IRQS_OFF |
340 | 2: TRACE_IRQS_OFF | 338 | .endm |
341 | ret | ||
342 | CFI_ENDPROC | ||
343 | END(save_args) | ||
344 | .popsection | ||
345 | 339 | ||
346 | ENTRY(save_rest) | 340 | ENTRY(save_rest) |
347 | PARTIAL_FRAME 1 REST_SKIP+8 | 341 | PARTIAL_FRAME 1 REST_SKIP+8 |
@@ -791,7 +785,7 @@ END(interrupt) | |||
791 | /* reserve pt_regs for scratch regs and rbp */ | 785 | /* reserve pt_regs for scratch regs and rbp */ |
792 | subq $ORIG_RAX-RBP, %rsp | 786 | subq $ORIG_RAX-RBP, %rsp |
793 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP | 787 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP |
794 | call save_args | 788 | SAVE_ARGS_IRQ |
795 | PARTIAL_FRAME 0 | 789 | PARTIAL_FRAME 0 |
796 | call \func | 790 | call \func |
797 | .endm | 791 | .endm |
@@ -814,15 +808,14 @@ ret_from_intr: | |||
814 | DISABLE_INTERRUPTS(CLBR_NONE) | 808 | DISABLE_INTERRUPTS(CLBR_NONE) |
815 | TRACE_IRQS_OFF | 809 | TRACE_IRQS_OFF |
816 | decl PER_CPU_VAR(irq_count) | 810 | decl PER_CPU_VAR(irq_count) |
817 | leaveq | ||
818 | 811 | ||
819 | CFI_RESTORE rbp | 812 | /* Restore saved previous stack */ |
813 | popq %rsi | ||
814 | leaq 16(%rsi), %rsp | ||
815 | |||
820 | CFI_DEF_CFA_REGISTER rsp | 816 | CFI_DEF_CFA_REGISTER rsp |
821 | CFI_ADJUST_CFA_OFFSET -8 | 817 | CFI_ADJUST_CFA_OFFSET -16 |
822 | 818 | ||
823 | /* we did not save rbx, restore only from ARGOFFSET */ | ||
824 | addq $8, %rsp | ||
825 | CFI_ADJUST_CFA_OFFSET -8 | ||
826 | exit_intr: | 819 | exit_intr: |
827 | GET_THREAD_INFO(%rcx) | 820 | GET_THREAD_INFO(%rcx) |
828 | testl $3,CS-ARGOFFSET(%rsp) | 821 | testl $3,CS-ARGOFFSET(%rsp) |