diff options
-rw-r--r-- | arch/x86/machine/cpu.c | 29 | ||||
-rw-r--r-- | arch/x86/machine/cpu_asm.S | 13 |
2 files changed, 15 insertions, 27 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index 2067d09d..520faecc 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -203,10 +203,8 @@ void cpu_load_gdt(struct cpu_pseudo_desc *gdtr); * Return a pointer to the processor-local interrupt stack. * * This function is called by the low level exception handling code. - * - * Return NULL if no stack switching is required. */ -void * cpu_get_intr_stack(void); +void * cpu_get_intr_stack_ptr(void); /* * Common entry points for exceptions and interrupts. @@ -434,19 +432,6 @@ cpu_delay(unsigned long usecs) } while (total > 0); } -void * -cpu_get_intr_stack(void) -{ - struct cpu *cpu; - - if (thread_interrupted()) { - return NULL; - } - - cpu = cpu_local_ptr(cpu_desc); - return cpu->intr_stack + sizeof(cpu->intr_stack); -} - static void cpu_show_thread(void) { @@ -844,6 +829,7 @@ cpu_tss_init(struct cpu_tss *tss, const void *intr_stack_top, tss->ist[CPU_TSS_IST_INTR] = (uintptr_t)intr_stack_top; tss->ist[CPU_TSS_IST_DF] = (uintptr_t)df_stack_top; #else /* __LP64__ */ + (void)intr_stack_top; (void)df_stack_top; #endif /* __LP64__ */ } @@ -1203,6 +1189,17 @@ INIT_OP_DEFINE(cpu_check_bsp, INIT_OP_DEP(cpu_setup, true), INIT_OP_DEP(panic_setup, true)); +void * +cpu_get_intr_stack_ptr(void) +{ + struct cpu *cpu; + + assert(!thread_interrupted()); + + cpu = cpu_local_ptr(cpu_desc); + return cpu_get_intr_stack_top(cpu); +} + void __init cpu_log_info(const struct cpu *cpu) { diff --git a/arch/x86/machine/cpu_asm.S b/arch/x86/machine/cpu_asm.S index 04b16083..2c4fd2c4 100644 --- a/arch/x86/machine/cpu_asm.S +++ b/arch/x86/machine/cpu_asm.S @@ -106,12 +106,8 @@ .macro cpu_ll_intr_handle vector cpu_ll_exc_enter \vector - movq %rbx, %rdi - call cpu_get_intr_stack - testq %rax, %rax /* switch stack ? */ - jz 1f + call cpu_get_intr_stack_ptr movq %rax, %rsp /* switch to interrupt stack */ -1: movq %rbx, %rdi call cpu_intr_main cpu_ll_exc_leave @@ -168,13 +164,8 @@ .macro cpu_ll_intr_handle vector cpu_ll_exc_enter \vector - pushl %ebx - call cpu_get_intr_stack - addl $4, %esp /* fix up stack pointer */ - testl %eax, %eax /* switch stack ? */ - jz 1f + call cpu_get_intr_stack_ptr movl %eax, %esp /* switch to interrupt stack */ -1: pushl %ebx call cpu_intr_main cpu_ll_exc_leave |