Skip to content

Commit 8ec9069

Browse files
H. Peter Anvin (Intel)KAGA-KOKO
authored andcommitted
x86/idt: Remove address argument from idt_invalidate()
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. The most "sensible" address to set here is a NULL pointer - virtual address zero, just as a visual marker. This also makes it possible to mark the struct desc_ptr in idt_invalidate() as static const. Signed-off-by: H. Peter Anvin (Intel) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ff85100 commit 8ec9069

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

arch/x86/include/asm/desc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,6 @@ static inline void idt_setup_early_pf(void) { }
427427
static inline void idt_setup_ist_traps(void) { }
428428
#endif
429429

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

432432
#endif /* _ASM_X86_DESC_H */

arch/x86/kernel/idt.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,10 @@ void __init idt_setup_early_handler(void)
331331

332332
/**
333333
* idt_invalidate - Invalidate interrupt descriptor table
334-
* @addr: The virtual address of the 'invalid' IDT
335334
*/
336-
void idt_invalidate(void *addr)
335+
void idt_invalidate(void)
337336
{
338-
struct desc_ptr idt = { .address = (unsigned long) addr, .size = 0 };
337+
static const struct desc_ptr idt = { .address = 0, .size = 0 };
339338

340339
load_idt(&idt);
341340
}

arch/x86/kernel/machine_kexec_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void machine_kexec(struct kimage *image)
232232
* The gdt & idt are now invalid.
233233
* If you want to load them you must set up your own idt & gdt.
234234
*/
235-
idt_invalidate(phys_to_virt(0));
235+
idt_invalidate();
236236
set_gdt(phys_to_virt(0), 0);
237237

238238
/* now call it */

arch/x86/kernel/reboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ static void native_machine_emergency_restart(void)
669669
break;
670670

671671
case BOOT_TRIPLE:
672-
idt_invalidate(NULL);
672+
idt_invalidate();
673673
__asm__ __volatile__("int3");
674674

675675
/* We're probably dead after this, but... */

0 commit comments

Comments
 (0)