Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gdt::gdt(const tss& _tss) : tss_entry(_tss) {
- entries[Null] = gdt_entry{};
- entries[Kernel_Code] = {
- Present | Segment | Read_Write | Executable,
- Long_Mode,
- };
- entries[Kernel_Data] = {
- Present | Segment | Read_Write,
- 0,
- };
- entries[User_Data] = {
- Present | Segment | Read_Write | User,
- 0,
- };
- entries[User_Code] = {
- Present | Segment | Read_Write | Executable | User,
- Long_Mode,
- };
- }
- void init() {
- tss _tss = {};
- gdt _gdt = {_tss};
- gdt_descriptor descriptor = {_gdt};
- descriptor.load();
- tss_update();
- for (size_t i = 0; i < gdt::Length - 1; i++) {
- log::debug.print("GDT[%lu]: 0x%016lX", i, (_gdt.entries[i]));
- }
- log::debug.print("GDT[TSS]: 0x%016lX", _gdt.tss_entry);
- log::info.print("GDT Initialization - Success");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement