fix: define the idt struct
This commit is contained in:
parent
0c540a11da
commit
8b73e8850a
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
|
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
|
||||||
struct {
|
struct idt_descriptor {
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
} __attribute__((packed)) idt_descriptor;
|
} __attribute__((packed));
|
||||||
|
|
||||||
#define IDT_SIZE 256
|
#define IDT_SIZE 256
|
@ -4,7 +4,7 @@
|
|||||||
#include "idt.h"
|
#include "idt.h"
|
||||||
|
|
||||||
uint16_t idt_entries[IDT_SIZE * 4];
|
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,
|
static void set_idt_entry_value(uint16_t *target, uint32_t offset,
|
||||||
uint16_t selector, uint8_t dpl,
|
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)
|
void init_idt(void)
|
||||||
{
|
{
|
||||||
idtr->size = 8 * IDT_SIZE - 1;
|
idtr.size = 8 * IDT_SIZE - 1;
|
||||||
idtr->offset = (uint32_t)&idt_entries;
|
idtr.offset = (uint32_t)&idt_entries;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user