fix: define the idt struct

This commit is contained in:
Starnakin 2024-09-30 15:44:34 +02:00
parent 0c540a11da
commit 8b73e8850a
2 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,9 @@
#pragma once
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
struct {
struct idt_descriptor {
uint16_t size;
uint32_t offset;
} __attribute__((packed)) idt_descriptor;
} __attribute__((packed));
#define IDT_SIZE 256

View File

@ -4,7 +4,7 @@
#include "idt.h"
uint16_t idt_entries[IDT_SIZE * 4];
struct idt_descriptor *idtr = (struct gdt_descriptor *)GDT_ADDRESS;
struct idt_descriptor idtr;
static void set_idt_entry_value(uint16_t *target, uint32_t offset,
uint16_t selector, uint8_t dpl,
@ -31,6 +31,6 @@ static void set_idt_entry_value(uint16_t *target, uint32_t offset,
void init_idt(void)
{
idtr->size = 8 * IDT_SIZE - 1;
idtr->offset = (uint32_t)&idt_entries;
idtr.size = 8 * IDT_SIZE - 1;
idtr.offset = (uint32_t)&idt_entries;
}