pic: enable legacy pic serial interrupts

This commit is contained in:
Michael Shaw 2023-03-14 04:25:06 -04:00
commit 9a4ff385bd
12 changed files with 201 additions and 33 deletions

View file

@ -11,9 +11,11 @@
#define GDT_ACCESS_DATA_RING3 0b11110010
#define GDT_ACCESS_CODE_RING3 0b11111010
#define GDT_SEGMENT_CODE_RING0 0x28
#ifndef __ASM__
#include <stdint.h>
#include <kernel/common.h>
struct gdt_desc {
uint16_t limit;
@ -22,12 +24,12 @@ struct gdt_desc {
uint8_t access;
uint8_t flags;
uint8_t base_3;
};
} PACKED;
struct gdtr {
uint16_t size;
uint64_t offset;
};
} PACKED;
extern struct gdtr __gdtr;
extern struct gdt_desc __gdt[GDT_NUMDESC];

View file

@ -11,7 +11,7 @@
#ifndef __ASM__
#include <stdint.h>
#include <kernel/common.h>
struct irqdesc {
uint16_t offset_low;
@ -21,14 +21,16 @@ struct irqdesc {
uint16_t offset_mid;
uint32_t offset_high;
uint32_t reserved;
};
} PACKED;
struct idtr {
uint16_t size;
uint64_t offset;
};
} PACKED;
void idt_init();
void cli();
void sti();
extern struct idtr __idtr;
extern struct irqdesc __idt[IDT_NUM_VECTORS];

View file

@ -16,4 +16,9 @@ static inline uint8_t inb(uint16_t port)
return ret;
}
static inline void iowait()
{
outb(0x80, 0);
}
#endif /* _PIO_H_ */