Document amd64 platform-specific code
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#define TSS 0x80
|
||||
#define TSS_PRESENT 0x89
|
||||
|
||||
/// Set a GDT entry
|
||||
static void amd64_gdt_set (volatile struct gdt_entry* ent, uint32_t base, uint32_t limit,
|
||||
uint8_t acc, uint8_t gran) {
|
||||
ent->baselow = (base & 0xFFFF);
|
||||
@@ -24,6 +25,7 @@ static void amd64_gdt_set (volatile struct gdt_entry* ent, uint32_t base, uint32
|
||||
ent->access = acc;
|
||||
}
|
||||
|
||||
/// Initialize GDT and TSS structures for a given CPU
|
||||
static void amd64_gdt_init (struct cpu* cpu) {
|
||||
volatile struct tss* tss = &cpu->tss;
|
||||
volatile struct gdt_extended* gdt = &cpu->gdt;
|
||||
@@ -75,6 +77,13 @@ static void amd64_gdt_init (struct cpu* cpu) {
|
||||
__asm__ volatile ("ltr %0" ::"r"((uint16_t)GDT_TSS));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize essentials (GDT, TSS, IDT) for a given CPU
|
||||
*
|
||||
* @param load_idt
|
||||
* Tell whether the IDT needs to be loaded. It only has to be loaded once on
|
||||
* the BSP
|
||||
*/
|
||||
void amd64_init (struct cpu* cpu, bool load_idt) {
|
||||
amd64_gdt_init (cpu);
|
||||
if (load_idt)
|
||||
|
||||
Reference in New Issue
Block a user