Revert "sys/pic: Reinitialise PICs in pic_flush() to clear stale IRR/ISR state"

This reverts commit bfde2899fc.
This commit is contained in:
Mintsuki
2026-02-26 00:47:37 +01:00
parent d8c3d364f0
commit 57d6fb0d8f
3 changed files with 7 additions and 24 deletions

View File

@@ -36,7 +36,7 @@ int irq_flush_type = IRQ_NO_FLUSH;
void flush_irqs(void) {
switch (irq_flush_type) {
case IRQ_PIC_ONLY_FLUSH:
pic_flush(0x08, 0x70);
pic_flush();
// FALLTHRU
case IRQ_NO_FLUSH:
return;
@@ -56,7 +56,7 @@ void flush_irqs(void) {
asm volatile ("lidt %0" :: "m"(new_idt) : "memory");
// Flush the legacy PIC so we know the remaining ints come from the LAPIC
pic_flush(0x20, 0x28);
pic_flush();
asm volatile ("sti" ::: "memory");

View File

@@ -15,26 +15,10 @@ void pic_eoi(int irq) {
outb(0x20, 0x20);
}
// Flush all pending IRQs by reinitialising the PICs, preserving the IMR
void pic_flush(uint8_t master_base, uint8_t slave_base) {
uint8_t master_imr = inb(0x21);
uint8_t slave_imr = inb(0xa1);
outb(0xa1, 0xff);
outb(0x21, 0xff);
outb(0x20, 0x11);
outb(0x21, master_base);
outb(0x21, 0x04);
outb(0x21, 0x01);
outb(0xa0, 0x11);
outb(0xa1, slave_base);
outb(0xa1, 0x02);
outb(0xa1, 0x01);
outb(0xa1, slave_imr);
outb(0x21, master_imr);
// Flush all potentially pending IRQs
void pic_flush(void) {
for (int i = 0; i < 16; i++)
pic_eoi(i);
}
void pic_set_mask(int line, bool status) {

View File

@@ -1,11 +1,10 @@
#ifndef SYS__PIC_H__
#define SYS__PIC_H__
#include <stdint.h>
#include <stdbool.h>
void pic_eoi(int irq);
void pic_flush(uint8_t master_base, uint8_t slave_base);
void pic_flush(void);
void pic_set_mask(int line, bool status);
void pic_mask_all(void);