hawkw / mycelium

🍄 an alleged 'operating system'
https://mycelium.elizas.website
MIT License
548 stars 21 forks source link

hal: masking APIs for individual IRQs #30

Open hawkw opened 4 years ago

hawkw commented 4 years ago

this will probably help with IOAPIC (#28) and PIC drivers.

probably something like the existing Control::enable_irq/disable_irq, but for a specific vector https://github.com/hawkw/mycelium/blob/ff48f5732338f00be8026e758a2913e855452bd0/hal-core/src/interrupt.rs#L10-L14

we can then use this to implement a drop guard API, like enter_critical: https://github.com/hawkw/mycelium/blob/ff48f5732338f00be8026e758a2913e855452bd0/hal-core/src/interrupt.rs#L34-L39

(possibly enable_irq and disable_irq should be renamed to enable_all/disable_all or something — that naming incorrectly implies that they enable/disable a specific IRQ...)

hawkw commented 4 years ago

we might actually want the actual implementation of this to be in the Vector trait, with a ref to the interrupt controller; depending on the interrupt, the way it is masked might differ, for example, on x86, it could be a CPU interrupt, a PIC interrupt, or an IOAPIC interrupt...

hawkw commented 4 years ago

cc @iximeow