mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Create a static GDT
This commit is contained in:
10
src/gdt.rs
10
src/gdt.rs
@@ -1,4 +1,5 @@
|
||||
use lazy_static::lazy_static;
|
||||
use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable};
|
||||
use x86_64::structures::tss::TaskStateSegment;
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
@@ -18,3 +19,12 @@ lazy_static! {
|
||||
tss
|
||||
};
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref GDT: GlobalDescriptorTable = {
|
||||
let mut gdt = GlobalDescriptorTable::new();
|
||||
gdt.add_entry(Descriptor::kernel_code_segment());
|
||||
gdt.add_entry(Descriptor::tss_segment(&TSS));
|
||||
gdt
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user