[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210515014400.2999028-6-hpa@zytor.com>
Date: Fri, 14 May 2021 18:43:57 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 5/9] x86/desc: add native_[ig]dt_invalidate() to <asm/desc.h>
From: "H. Peter Anvin (Intel)" <hpa@...or.com>
In some places, we want the native forms of descriptor table
invalidation. Rather than open-coding them, add explicitly native
functions to invalidate the GDT and IDT.
Signed-off-by: H. Peter Anvin (Intel) <hpa@...or.com>
---
arch/x86/include/asm/desc.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index b8429ae50b71..aa366b2bbc41 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -224,6 +224,21 @@ static inline void store_idt(struct desc_ptr *dtr)
asm volatile("sidt %0":"=m" (*dtr));
}
+static const struct desc_ptr __invalid_gdt_idt_ptr __maybe_unused = {
+ .address = 0,
+ .size = 0
+};
+
+static inline void native_gdt_invalidate(void)
+{
+ native_load_gdt(&__invalid_gdt_idt_ptr);
+}
+
+static inline void native_idt_invalidate(void)
+{
+ native_load_idt(&__invalid_gdt_idt_ptr);
+}
+
/*
* The LTR instruction marks the TSS GDT entry as busy. On 64-bit, the GDT is
* a read-only remapping. To prevent a page fault, the GDT is switched to the
--
2.31.1
Powered by blists - more mailing lists