aboutsummaryrefslogtreecommitdiff
path: root/src/bits64/dtables.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bits64/dtables.rs')
-rw-r--r--src/bits64/dtables.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bits64/dtables.rs b/src/bits64/dtables.rs
new file mode 100644
index 0000000..2bc06c8
--- /dev/null
+++ b/src/bits64/dtables.rs
@@ -0,0 +1,18 @@
+//! Functions to load descriptor tables.
+use dtables::DescriptorTablePointer;
+use bits64::segmentation::Descriptor64;
+
+/// Load GDT table with 64-bits descriptors.
+pub unsafe fn lgdt(gdt: &DescriptorTablePointer<Descriptor64>) {
+ asm!("lgdt ($0)" :: "r" (gdt) : "memory");
+}
+
+/// Load LDT table with 64-bits descriptors.
+pub unsafe fn lldt(ldt: &DescriptorTablePointer<Descriptor64>) {
+ asm!("lldt ($0)" :: "r" (ldt) : "memory");
+}
+
+/// Load IDT table with 64-bits descriptors.
+pub unsafe fn lidt(idt: &DescriptorTablePointer<Descriptor64>) {
+ asm!("lidt ($0)" :: "r" (idt) : "memory");
+}