summaryrefslogtreecommitdiff
path: root/Kernel/Interrupts
AgeCommit message (Collapse)Author
2020-12-02Kernel: Fix counting interruptsTom
Move counting interrupts out of the handle_interrupt method so that it is done in all cases without the interrupt handler having to implement it explicitly. Also make the counter an atomic value as e.g. the LocalAPIC interrupts may be triggered on multiple processors simultaneously. Fixes #4297
2020-11-01Kernel: Don't remap IOAPIC registers every time we try to read/writeTom
Remapping these registers every time we try to read from or write to them causes a lot of SMP broadcasts and a lot of other overhead. This improves boot time noticeably.
2020-10-26Kernel: Various APIC timer fixesTom
2020-10-25Kernel: Set up and calibrate APIC timer, and enable timer on all CPUsTom
This enables the APIC timer on all CPUs, which means Scheduler::timer_tick is now called on all CPUs independently. We still don't do anything on the APs as it instantly crashes due to a number of other problems.
2020-10-18Kernel: Unbreak /proc/interrupts when running with APICAndreas Kling
We can't assert here since these are exposed through /proc JSON.
2020-10-18Kernel: Tweak strange PAGE_ROUND_UP(1) in APIC codeAndreas Kling
2020-09-25Meta+Kernel: Make clang-format-10 cleanBen Wiederhake
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.