mirror of
https://github.com/tailix/kernel.git
synced 2024-12-11 11:35:39 -05:00
Some refactoring
This commit is contained in:
parent
9b192a6780
commit
ef2a7507b7
3 changed files with 8 additions and 5 deletions
|
@ -9,15 +9,15 @@
|
|||
#define PIC_SLAVE_COMMAND 0xA0
|
||||
#define PIC_SLAVE_DATA 0xA1
|
||||
|
||||
void pic_initialize()
|
||||
void pic_remap(const unsigned char master_irq_start, const unsigned char slave_irq_start)
|
||||
{
|
||||
logger_info_from("pic", "Remap the IRQ table.");
|
||||
|
||||
outportb(PIC_MASTER_COMMAND, 0x11);
|
||||
outportb(PIC_SLAVE_COMMAND, 0x11);
|
||||
|
||||
outportb(PIC_MASTER_DATA, 0x20);
|
||||
outportb(PIC_SLAVE_DATA, 0x28);
|
||||
outportb(PIC_MASTER_DATA, master_irq_start);
|
||||
outportb(PIC_SLAVE_DATA, slave_irq_start);
|
||||
|
||||
outportb(PIC_MASTER_DATA, 0x04);
|
||||
outportb(PIC_SLAVE_DATA, 0x02);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef KERNELMQ_INCLUDED_PIC
|
||||
#define KERNELMQ_INCLUDED_PIC 1
|
||||
|
||||
void pic_initialize();
|
||||
void pic_remap(unsigned char master_irq_start, unsigned char slave_irq_start);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ void idt_flush(const struct IdtPointer *pointer);
|
|||
|
||||
void protected_initialize(const struct KernelMQ_Info *const kinfo)
|
||||
{
|
||||
pic_initialize();
|
||||
pic_remap(32, 40);
|
||||
|
||||
logger_info_from("protected", "Setup GDT.");
|
||||
|
||||
|
@ -102,6 +102,7 @@ void protected_initialize(const struct KernelMQ_Info *const kinfo)
|
|||
idt_set_gate(30, (unsigned int)interrupt_30, 0x08, 0x8E);
|
||||
idt_set_gate(31, (unsigned int)interrupt_31, 0x08, 0x8E);
|
||||
|
||||
// Master PIC
|
||||
idt_set_gate(32, (unsigned int)interrupt_32, 0x08, 0x8E);
|
||||
idt_set_gate(33, (unsigned int)interrupt_33, 0x08, 0x8E);
|
||||
idt_set_gate(34, (unsigned int)interrupt_34, 0x08, 0x8E);
|
||||
|
@ -110,6 +111,8 @@ void protected_initialize(const struct KernelMQ_Info *const kinfo)
|
|||
idt_set_gate(37, (unsigned int)interrupt_37, 0x08, 0x8E);
|
||||
idt_set_gate(38, (unsigned int)interrupt_38, 0x08, 0x8E);
|
||||
idt_set_gate(39, (unsigned int)interrupt_39, 0x08, 0x8E);
|
||||
|
||||
// Slave PIC
|
||||
idt_set_gate(40, (unsigned int)interrupt_40, 0x08, 0x8E);
|
||||
idt_set_gate(41, (unsigned int)interrupt_41, 0x08, 0x8E);
|
||||
idt_set_gate(42, (unsigned int)interrupt_42, 0x08, 0x8E);
|
||||
|
|
Loading…
Reference in a new issue