Skip to content

Commit 283fa3b

Browse files
H. Peter Anvin (Intel)KAGA-KOKO
authored andcommitted
x86: Add native_[ig]dt_invalidate()
In some places, the native forms of descriptor table invalidation is required. Rather than open-coding them, add explicitly native functions to invalidate the GDT and IDT. 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 8ec9069 commit 283fa3b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arch/x86/include/asm/desc.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,26 @@ static inline void store_idt(struct desc_ptr *dtr)
224224
asm volatile("sidt %0":"=m" (*dtr));
225225
}
226226

227+
static inline void native_gdt_invalidate(void)
228+
{
229+
const struct desc_ptr invalid_gdt = {
230+
.address = 0,
231+
.size = 0
232+
};
233+
234+
native_load_gdt(&invalid_gdt);
235+
}
236+
237+
static inline void native_idt_invalidate(void)
238+
{
239+
const struct desc_ptr invalid_idt = {
240+
.address = 0,
241+
.size = 0
242+
};
243+
244+
native_load_idt(&invalid_idt);
245+
}
246+
227247
/*
228248
* The LTR instruction marks the TSS GDT entry as busy. On 64-bit, the GDT is
229249
* a read-only remapping. To prevent a page fault, the GDT is switched to the

0 commit comments

Comments
 (0)