lkml.org 
[lkml]   [2021]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3/6] x86/idt: remove address argument to idt_invalidate()
    Date
    From: "H. Peter Anvin (Intel)" <hpa@zytor.com>

    There is no reason to specify any specific address to
    idt_invalidate(). It looks mostly like an artifact of unifying code
    done differently by accident.

    Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
    ---
    arch/x86/include/asm/desc.h | 2 +-
    arch/x86/kernel/idt.c | 5 ++---
    arch/x86/kernel/machine_kexec_32.c | 4 ++--
    arch/x86/kernel/reboot.c | 2 +-
    4 files changed, 6 insertions(+), 7 deletions(-)

    diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
    index 476082a83d1c..b8429ae50b71 100644
    --- a/arch/x86/include/asm/desc.h
    +++ b/arch/x86/include/asm/desc.h
    @@ -427,6 +427,6 @@ static inline void idt_setup_early_pf(void) { }
    static inline void idt_setup_ist_traps(void) { }
    #endif

    -extern void idt_invalidate(void *addr);
    +extern void idt_invalidate(void);

    #endif /* _ASM_X86_DESC_H */
    diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
    index d552f177eca0..17f824462f5e 100644
    --- a/arch/x86/kernel/idt.c
    +++ b/arch/x86/kernel/idt.c
    @@ -331,11 +331,10 @@ void __init idt_setup_early_handler(void)

    /**
    * idt_invalidate - Invalidate interrupt descriptor table
    - * @addr: The virtual address of the 'invalid' IDT
    */
    -void idt_invalidate(void *addr)
    +void idt_invalidate(void)
    {
    - struct desc_ptr idt = { .address = (unsigned long) addr, .size = 0 };
    + struct desc_ptr idt = { .address = 0, .size = 0 };

    load_idt(&idt);
    }
    diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
    index 64b00b0d7fe8..6ba90f47d8c3 100644
    --- a/arch/x86/kernel/machine_kexec_32.c
    +++ b/arch/x86/kernel/machine_kexec_32.c
    @@ -232,8 +232,8 @@ void machine_kexec(struct kimage *image)
    * The gdt & idt are now invalid.
    * If you want to load them you must set up your own idt & gdt.
    */
    - idt_invalidate(phys_to_virt(0));
    - set_gdt(phys_to_virt(0), 0);
    + idt_invalidate();
    + set_gdt(0, 0);

    /* now call it */
    image->start = relocate_kernel_ptr((unsigned long)image->head,
    diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
    index b29657b76e3f..ebfb91108232 100644
    --- a/arch/x86/kernel/reboot.c
    +++ b/arch/x86/kernel/reboot.c
    @@ -669,7 +669,7 @@ static void native_machine_emergency_restart(void)
    break;

    case BOOT_TRIPLE:
    - idt_invalidate(NULL);
    + idt_invalidate();
    __asm__ __volatile__("int3");

    /* We're probably dead after this, but... */
    --
    2.31.1
    \
     
     \ /
      Last update: 2021-05-11 02:57    [W:3.860 / U:0.620 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site