aboutsummaryrefslogtreecommitdiff
path: root/src/dtables.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dtables.rs')
-rw-r--r--src/dtables.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dtables.rs b/src/dtables.rs
index 19baa9a..43eb13b 100644
--- a/src/dtables.rs
+++ b/src/dtables.rs
@@ -31,3 +31,18 @@ impl<T> fmt::Debug for DescriptorTablePointer<T> {
unsafe { write!(f, "DescriptorTablePointer ({} {:?})", self.limit, self.base) }
}
}
+
+/// Load GDT table with 32bit descriptors
+pub unsafe fn lgdt<T>(gdt: &DescriptorTablePointer<T>) {
+ asm!("lgdt ($0)" :: "r" (gdt) : "memory");
+}
+
+/// Load LDT table with 32bit descriptors.
+pub unsafe fn lldt<T>(ldt: &DescriptorTablePointer<T>) {
+ asm!("lldt ($0)" :: "r" (ldt) : "memory");
+}
+
+/// Load IDT table with 32bit descriptors.
+pub unsafe fn lidt<T>(idt: &DescriptorTablePointer<T>) {
+ asm!("lidt ($0)" :: "r" (idt) : "memory");
+}