Split gdt.* from interrupts.*

This commit is contained in:
Justin C. Miller
2018-05-17 09:26:57 -07:00
parent abaa007c54
commit 4005e9e791
5 changed files with 302 additions and 245 deletions

27
src/kernel/gdt.h Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
/// \file gdt.h
/// Definitions relating to system descriptor tables: GDT, IDT, TSS
#include <stdint.h>
#include "kutil/memory.h"
/// Set up the GDT and TSS, and switch segment registers to point
/// to them.
void gdt_init();
/// Set an entry in the IDT
/// \arg i Index in the IDT (vector of the interrupt this handles)
/// \arg addr Address of the handler
/// \arg selector GDT selector to set when invoking this handler
/// \arg flags Descriptor flags to set
void idt_set_entry(uint8_t i, uint64_t addr, uint16_t selector, uint8_t flags);
/// Set the stack pointer for a given ring in the TSS
/// \arg ring Ring to set for (0-2)
/// \arg rsp Stack pointer to set
void tss_set_stack(int ring, addr_t rsp);
/// Dump information about the current GDT to the screen
void gdt_dump();
/// Dump information about the current IDT to the screen
void idt_dump();