summaryrefslogtreecommitdiff
path: root/Kernel/Interrupts
AgeCommit message (Collapse)Author
2020-09-19Kernel: Fix assertion statement in GenericInterruptHandlerLiav A
We need to assert if interrupts are not disabled when changing the interrupt number of an interrupt handler. Before this fix, any change like this would lead to a crash, because we are using InterruptDisabler in IRQHandler::change_irq_number.
2020-09-16Kernel: Return ENOMEM in more placesLuke
There are plenty of places in the kernel that aren't checking if they actually got their allocation. This fixes some of them, but definitely not all. Fixes #3390 Fixes #3391 Also, let's make find_one_free_page() return nullptr if it doesn't get a free index. This stops the kernel crashing when out of memory and allows memory purging to take place again. Fixes #3487
2020-09-08Refactor: Replace usages of FixedArray with Vector.asynts
2020-09-08Refactor: Replace usages of FixedArray with Array.asynts
2020-08-30Kernel: Unbreak building with extra debug macros, part 1Ben Wiederhake
2020-08-28Kernel: Remove the enabled concept of IRQ handlersLiav A
An IRQ handler should always be ready to respond to any IRQ. We must remember that hardware can generate IRQs without any interaction from our code at all. Ignoring IRQs in such cases is obviously not the right thing to do.
2020-08-28Kernel: Add and remove explicit keyword where neededLiav A
2020-08-25Kernel: Switch singletons to use new Singleton classTom
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
2020-08-22Revert "Kernel: Switch singletons to use new Singleton class"Andreas Kling
This reverts commit f48feae0b2a300992479abf0b2ded85e45ac6045.
2020-08-22Revert "Kernel: Move Singleton class to AK"Andreas Kling
This reverts commit f0906250a181c831508a45434b9f645ff98f33e4.
2020-08-22Revert "AK: Get rid of make_singleton function"Andreas Kling
This reverts commit 5a98e329d157a2db8379e0c97c6bdc1328027843.
2020-08-22AK: Get rid of make_singleton functionTom
Just default the InitFunction template argument.
2020-08-22Kernel: Move Singleton class to AKTom
2020-08-21Kernel: Switch singletons to use new Singleton classTom
Fixes #3226
2020-08-17Kernel: Remove unneeded header (#3196)Muhammad Zahalqa
AK/HashTable.h is not needed from SpuriousInterruptHandler
2020-08-10Kernel: Mark MSIHandler as finalBrian Gianforcaro
2020-07-09Kernel: Fix some flaws that caused crashes or hangs during bootTom
We need to halt the BSP briefly until all APs are ready for the first context switch, but we can't hold the same spinlock by all of them while doing so. So, while the APs are waiting on each other they need to release the scheduler lock, and then once signaled re-acquire it. Should solve some timing dependent hangs or crashes, most easily observed using qemu with kvm disabled.
2020-07-06Kernel: Add SMP IPI supportTom
We can now properly initialize all processors without crashing by sending SMP IPI messages to synchronize memory between processors. We now initialize the APs once we have the scheduler running. This is so that we can process IPI messages from the other cores. Also rework interrupt handling a bit so that it's more of a 1:1 mapping. We need to allocate non-sharable interrupts for IPIs. This also fixes the occasional hang/crash because all CPUs now synchronize memory with each other.
2020-07-04Kernel: Move headers intended for userspace use into Kernel/API/Andreas Kling
2020-07-01Kernel: Implement software context switching and Processor structureTom
Moving certain globals into a new Processor structure for each CPU allows us to eventually run an instance of the scheduler on each CPU.
2020-06-04Kernel: Detect APs and boot them into protected modeTom
This isn't fully working, the APs pretend like they're fully initialized and are just halted permanently for now.
2020-05-28Kernel: Remove outdated FIXME in InterruptManagement::locate_apic_dataAndreas Kling
2020-05-23Kernel: Use TypedMapping for accessing IOAPIC registersAndreas Kling
2020-05-23Kernel: Oops, we need to use map_typed_writable() for write access :^)Andreas Kling
2020-05-23Kernel: Use TypedMappings when looking for APIC informationAndreas Kling
2020-05-23Kernel: Use TypedMappings in the very unfinished APIC codeAndreas Kling
2020-05-23Kernel: Tweak some suspicious casts in InterruptManagementAndreas Kling
This code needs a closer looking-into at some point. It doesn't seem entirely safe to be casting u32's to pointers like it does.
2020-05-22Kernel: Simplify scanning BIOS/EBDA and MP parser initializationAndreas Kling
Add a MappedROM::find_chunk_starting_with() helper since that's a very common usage pattern in clients of this code. Also convert MultiProcessorParser from a persistent singleton object to a temporary object constructed via a failable factory function.
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
2020-05-16Kernel: Let's say that IO::delay(N) delays for N microsecondsAndreas Kling
Supposedly that's how much delay you get when doing I/O on port 0x80.
2020-05-16Kernel: Annotate UnhandledInterruptHandler::eoi with [[noreturn]]Shannon Booth
2020-05-08Kernel: Remove ref-counting from interrupt override metadataAndreas Kling
I don't see a reason for these to be reference-counted, and removing it simplifies a bunch of surrounding data structures.
2020-04-09Interrupts: Simplify initialization a bit moreLiav A
2020-04-09Interrupts: Remove irrelevant FIXME commentLiav A
2020-04-09Interrupts: Make the MultiProcessorParser functional againLiav A
2020-04-09Kernel: Simplify the Interrupt management initializationLiav A
2020-04-09Kernel: Use StringView for ACPI table signaturesAndreas Kling
2020-04-09Kernel: Add typed_map<T>(PhysicalAddress) and use it in ACPI parsingAndreas Kling
There was a frequently occurring pattern of "map this physical address into kernel VM, then read from it, then unmap it again". This new typed_map() encapsulates that logic by giving you back a typed pointer to the kind of structure you're interested in accessing. It returns a TypedMapping<T> that can be used mostly like a pointer. When destroyed, the TypedMapping object will unmap the memory. :^)
2020-03-24Interrupts: Handle spurious IRQs from eoi() methodLiav A
2020-03-24Interrupts: Use Optional container in IOAPICLiav A
We return the Optional container in find_redirection_entry_by_vector() method instead of a raw integer. This makes the code more readable and correct.
2020-03-24Interrupts: Simplify IRQ disabling & enabling in IRQController(s)Liav A
Instead of blindly setting masks, if we want to disable an IRQ and it's already masked, we just return. The same happens if we want to enable an IRQ and it's unmasked.
2020-03-24Interrupts: Remove unused methodsLiav A
2020-03-24Kernel: Simplify disable_irq() and enable_irq() methods in IRQHandlerLiav A
Setting the m_enabled variable to true or false can help with monitoring the IRQHandler object(s) later, and there's no good reason to have an if-else statement in those methods anyway.
2020-03-24Interrupts: Do a specific EOI when using the PICLiav A
Before this change, we did a non-specific EOI, which could lead to problems with other IRQs that are handled in the PIC. Since the original 8259A datasheet permits such functionality and we are not losing any functionality, this change is acceptable even though we don't experience problems with the EOI currently.
2020-03-24Interrupts: Assert if trying to install an handler on syscall vectorLiav A
Installing an interrupt handler on the syscall IDT vector can lead to fatal results, so we must assert if that happens.
2020-03-24Kernel: Abstract IRQ controller handling from Interrupt handlersLiav A
Now we don't send raw numbers, but we let the IRQController object to figure out the correct IRQ number. This helps in a situation when we have 2 or more IOAPICs, so if IOAPIC 1 is assigned for IRQs 0-23 and IOAPIC 2 is assigned for IRQs 24-47, if an IRQHandler of IRQ 25 invokes disable() for example, it will call his responsible IRQController (IOAPIC 2), and the IRQController will subtract the IRQ number with his assigned offset, and the result is that the second redirection entry in IOAPIC 2 will be masked.
2020-03-24Kernel: Correct Spurious Interrupt handlers' controller model() methodLiav A
We don't return blindly the IRQ controller's model(), if the Spurious IRQ handler is installed in IOAPIC environment, it's misleading to return "IOAPIC" string since IOAPIC doesn't really handle Spurious IRQs, therefore we return a "" string.
2020-03-24Kernel: Create an interface for conversion between IRQs and interruptsLiav A
2020-03-24Kernel: Ensure that we don't use a hard-disabled IRQControllerLiav A
2020-03-24Kernel: Change the Spurious Interrupt Handler offset in the APICLiav A
The Spurious Interrupt Handler number that is written to APIC_REG_SIV is correct now.