pic: enable legacy pic serial interrupts
This commit is contained in:
parent
667d01e418
commit
9a4ff385bd
12 changed files with 201 additions and 33 deletions
|
|
@ -108,7 +108,7 @@ struct madt_x2_lapic {
|
|||
struct apic_redirect {
|
||||
union {
|
||||
struct {
|
||||
uint64_t vector : 8;
|
||||
uint64_t isr : 8;
|
||||
uint64_t delv_mode : 3;
|
||||
uint64_t dest_mode : 1;
|
||||
uint64_t delv_status : 1;
|
||||
|
|
@ -118,16 +118,20 @@ struct apic_redirect {
|
|||
uint64_t mask : 1;
|
||||
uint64_t reserved : 39;
|
||||
uint64_t dest : 8;
|
||||
};
|
||||
} PACKED;
|
||||
struct {
|
||||
uint32_t low;
|
||||
uint32_t high;
|
||||
};
|
||||
} PACKED;
|
||||
};
|
||||
} PACKED;
|
||||
|
||||
void apic_init();
|
||||
int madt_parse_next_entry(int offset);
|
||||
uint32_t ioapic_read(uintptr_t addr, uint8_t reg);
|
||||
void ioapic_write(uintptr_t addr, uint8_t reg, uint32_t value);
|
||||
uint32_t lapic_read(uintptr_t addr, unsigned int regoffset);
|
||||
uint32_t lapic_write(uintptr_t addr, unsigned int regoffset, uint32_t value);
|
||||
|
||||
#endif /* __ASM__ */
|
||||
#endif /* _APIC_H_ */
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@
|
|||
|
||||
#define COM1 0x3F8
|
||||
|
||||
#ifndef __ASM__
|
||||
|
||||
void isr_serial_input();
|
||||
void isr_serial_input_1();
|
||||
void serial_write(char c);
|
||||
int serial_init();
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SERIAL_H_ */
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -16,4 +16,9 @@ static inline uint8_t inb(uint16_t port)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline void iowait()
|
||||
{
|
||||
outb(0x80, 0);
|
||||
}
|
||||
|
||||
#endif /* _PIO_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue