mirror of
https://github.com/tailix/kernel.git
synced 2024-10-30 12:03:52 -04:00
Improve function "pic_end_of_interrupt"
This commit is contained in:
parent
3413fbd3a8
commit
d18a31eec2
3 changed files with 6 additions and 9 deletions
|
@ -29,15 +29,10 @@ static hwint_handler_t handlers[INT_HWINT_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
|
||||||
void hwint_handler(struct IsrRegisters regs)
|
void hwint_handler(struct IsrRegisters regs)
|
||||||
{
|
{
|
||||||
if (
|
if (!pic_end_of_interrupt(regs.int_no)) {
|
||||||
!(regs.int_no >= INT_HWINT_FIRST &&
|
|
||||||
regs.int_no <= INT_HWINT_LAST)
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_end_of_interrupt(regs.int_no);
|
|
||||||
|
|
||||||
const unsigned char hwint_no = regs.int_no - INT_HWINT_FIRST;
|
const unsigned char hwint_no = regs.int_no - INT_HWINT_FIRST;
|
||||||
|
|
||||||
const hwint_handler_t handler = handlers[hwint_no];
|
const hwint_handler_t handler = handlers[hwint_no];
|
||||||
|
|
|
@ -47,13 +47,13 @@ void pic_remap(const unsigned char new_master_irq_start, const unsigned char new
|
||||||
outportb(SLAVE_DATA, slave_mask);
|
outportb(SLAVE_DATA, slave_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pic_end_of_interrupt(const unsigned char irq)
|
unsigned char pic_end_of_interrupt(const unsigned char irq)
|
||||||
{
|
{
|
||||||
const unsigned char to_master = master_irq_start <= irq && irq < master_irq_start + IRQS_COUNT;
|
const unsigned char to_master = master_irq_start <= irq && irq < master_irq_start + IRQS_COUNT;
|
||||||
const unsigned char to_slave = slave_irq_start <= irq && irq < slave_irq_start + IRQS_COUNT;
|
const unsigned char to_slave = slave_irq_start <= irq && irq < slave_irq_start + IRQS_COUNT;
|
||||||
|
|
||||||
if (!(to_master || to_slave)) {
|
if (!(to_master || to_slave)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_slave) {
|
if (to_slave) {
|
||||||
|
@ -61,4 +61,6 @@ void pic_end_of_interrupt(const unsigned char irq)
|
||||||
}
|
}
|
||||||
|
|
||||||
outportb(MASTER_COMMAND, 0x20);
|
outportb(MASTER_COMMAND, 0x20);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
void pic_remap(unsigned char master_irq_start, unsigned char slave_irq_start);
|
void pic_remap(unsigned char master_irq_start, unsigned char slave_irq_start);
|
||||||
|
|
||||||
void pic_end_of_interrupt(unsigned char irq);
|
unsigned char pic_end_of_interrupt(unsigned char irq);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue