@@ -538,17 +538,48 @@ END(irq_entries_start)
538
538
.endm
539
539
540
540
/*
541
- * Switch to the thread stack. This is called with the IRET frame and
542
- * orig_ax on the stack. (That is, RDI..R12 are not on the stack and
543
- * space has not been allocated for them.)
541
+ * Interrupt entry helper function.
542
+ *
543
+ * Entry runs with interrupts off. Stack layout at entry:
544
+ * +----------------------------------------------------+
545
+ * | regs->ss |
546
+ * | regs->rsp |
547
+ * | regs->eflags |
548
+ * | regs->cs |
549
+ * | regs->ip |
550
+ * +----------------------------------------------------+
551
+ * | regs->orig_ax = ~(interrupt number) |
552
+ * +----------------------------------------------------+
553
+ * | return address |
554
+ * +----------------------------------------------------+
544
555
*/
545
- .macro DO_SWITCH_TO_THREAD_STACK
556
+ ENTRY(interrupt_entry)
557
+ UNWIND_HINT_FUNC
558
+ ASM_CLAC
559
+ cld
560
+
561
+ testb $3 , CS -ORIG_RAX+8 (%rsp )
562
+ jz 1f
563
+ SWAPGS
564
+
565
+ /*
566
+ * Switch to the thread stack. The IRET frame and orig_ax are
567
+ * on the stack, as well as the return address. RDI..R12 are
568
+ * not (yet) on the stack and space has not (yet) been
569
+ * allocated for them.
570
+ */
546
571
pushq %rdi
572
+
547
573
/* Need to switch before accessing the thread stack. */
548
574
SWITCH_TO_KERNEL_CR3 scratch_reg =%rdi
549
575
movq %rsp , %rdi
550
576
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
551
- UNWIND_HINT sp_offset =16 sp_reg = ORC_REG_DI
577
+
578
+ /*
579
+ * We have RDI, return address, and orig_ax on the stack on
580
+ * top of the IRET frame. That means offset=24
581
+ */
582
+ UNWIND_HINT_IRET_REGS base =%rdi offset =24
552
583
553
584
pushq 7*8 (%rdi ) /* regs->ss */
554
585
pushq 6*8 (%rdi ) /* regs->rsp */
@@ -560,25 +591,6 @@ END(irq_entries_start)
560
591
UNWIND_HINT_FUNC
561
592
562
593
movq (%rdi ), %rdi
563
- .endm
564
-
565
- /*
566
- * Interrupt entry/exit.
567
- *
568
- * Interrupt entry points save only callee clobbered registers in fast path.
569
- *
570
- * Entry runs with interrupts off.
571
- */
572
- /* 8(%rsp): ~(interrupt number) */
573
- ENTRY(interrupt_entry)
574
- UNWIND_HINT_FUNC
575
- ASM_CLAC
576
- cld
577
-
578
- testb $3 , CS -ORIG_RAX+8 (%rsp )
579
- jz 1f
580
- SWAPGS
581
- DO_SWITCH_TO_THREAD_STACK
582
594
1:
583
595
584
596
PUSH_AND_CLEAR_REGS save_ret =1
@@ -592,7 +604,7 @@ ENTRY(interrupt_entry)
592
604
*
593
605
* We need to tell lockdep that IRQs are off. We can't do this until
594
606
* we fix gsbase, and we should do it before enter_from_user_mode
595
- * (which can take locks). Since TRACE_IRQS_OFF idempotent,
607
+ * (which can take locks). Since TRACE_IRQS_OFF is idempotent,
596
608
* the simplest way to handle it is to just call it twice if
597
609
* we enter from user mode. There's no reason to optimize this since
598
610
* TRACE_IRQS_OFF is a no-op if lockdep is off.
@@ -609,6 +621,9 @@ ENTRY(interrupt_entry)
609
621
ret
610
622
END(interrupt_entry)
611
623
624
+
625
+ /* Interrupt entry/exit. */
626
+
612
627
/*
613
628
* The interrupt stubs push (~vector+0x80) onto the stack and
614
629
* then jump to common_interrupt.
@@ -878,17 +893,6 @@ apicinterrupt IRQ_WORK_VECTOR irq_work_interrupt smp_irq_work_interrupt
878
893
*/
879
894
#define CPU_TSS_IST(x) PER_CPU_VAR(cpu_tss_rw) + (TSS_ist + ((x) - 1 ) * 8 )
880
895
881
- #if defined(CONFIG_IA32_EMULATION)
882
- /* entry_64_compat.S::entry_INT80_compat expects this to be an ASM function */
883
- ENTRY(switch_to_thread_stack)
884
- UNWIND_HINT_FUNC
885
-
886
- DO_SWITCH_TO_THREAD_STACK
887
-
888
- ret
889
- END(switch_to_thread_stack)
890
- #endif
891
-
892
896
.macro idtentry sym do_sym has_error_code: req paranoid =0 shift_ist =-1
893
897
ENTRY(\sym)
894
898
UNWIND_HINT_IRET_REGS offset = \has_error_code*8
0 commit comments