Commit graph

2397 commits

Author SHA1 Message Date
Liav A bb73802b15 CPU: Use the new interrupt components
Now we use the GenericInterruptHandler class instead of IRQHandler in
the CPU functions.
This commit adds an include to the ISR stub macros header file.
Also, this commit adds support for IRQ sharing, so when an IRQHandler
will try to register to already-assigned IRQ number, a SharedIRQHandler
will be created to register both IRQHandlers.
2020-02-24 11:27:03 +01:00
Liav A 9e66eb160c Kernel: Add the new APIC namespace
Also, the enable() function is now correct and will use the right
registers and values. In addition to that, write_register() and
read_registers() are not relying on identity mapping anymore.
2020-02-24 11:27:03 +01:00
Liav A 71371d39b3 CPU: Add 2 files with ISR stub macros 2020-02-24 11:27:03 +01:00
Liav A c51a57fb32 Kernel: Update SB16 driver to use the new IRQHandler class
Also, add methods to allow changing of IRQ line in the SB16 card.
2020-02-24 11:27:03 +01:00
Liav A 895e874eb4 Kernel: Include the new PIT class in system components 2020-02-24 11:27:03 +01:00
Liav A b3c132ffb7 Kernel: Update PATAChannel implementation to use the PIT class
Also, update the class implementation to use PCI::Device class
accordingly.
The create() helper will now search for an IDE controller in the
PCI bus, allowing to simplify the initialize() method.
2020-02-24 11:27:03 +01:00
Liav A 83aa868c17 Kernel: Update PATAChannel class to use the PCI::Device class
PATAChannel class will inherit from the PCI::Device class, thus,
can still implement IRQ handling.
2020-02-24 11:27:03 +01:00
Liav A 12dbb7ca49 Kernel: Add MSIHandler class
This is a stub for now, since we don't support Message Signaled
Interrupts yet.
2020-02-24 11:27:03 +01:00
Liav A 9d281b4b15 Kernel: Add UnhandledInterruptHandler class
This class will be used to represent an IRQ vector handler that wasn't
assigned to any IRQ Handler.
2020-02-24 11:27:03 +01:00
Liav A 9587f2d3ee Kernel: Add SharedIRQHandler class
This class represents a shared interrupt handler. This class will not be
created automatically but only if two IRQ Handlers are sharing the same
IRQ number.
2020-02-24 11:27:03 +01:00
Liav A 740534cd67 Kernel: Update system components to use the new IRQHandler class 2020-02-24 11:27:03 +01:00
Liav A a46120b4a8 ACPI: Run clang-format on the definitions file 2020-02-24 11:27:03 +01:00
Liav A 16055de978 Kernel: Introduce the PIT class
The PIT class inherits from HardwareTimer class, and is replacing
the PIT namespace.
2020-02-24 11:27:03 +01:00
Liav A d83a3eff1f Kernel: Update Network adapter classes to use the PCI::Device class
Those classes will inherit from the PCI::Device class, thus,
they can still implement IRQ handling.
2020-02-24 11:27:03 +01:00
Liav A 73a7e5875e Kernel: Update PCI::Device class to use the new IRQHandler class 2020-02-24 11:27:03 +01:00
Liav A ea1251d465 Kernel: Add HardwareTimer class
This is an abstraction layer for future hardware timers
that will be implemented.
2020-02-24 11:27:03 +01:00
Liav A dd7522bdb2 Kernel: Add new IRQHandler class
This class will replace the old IRQHandler class later.
2020-02-24 11:27:03 +01:00
Liav A b201b23363 Kernel: Add Interrupt Management and Generic Interrupt Handler
The GenericInterruptHandler class will be used to represent
an abstract interrupt handler. The InterruptManagement class will
represent a centralized component to manage interrupts.
2020-02-24 11:27:03 +01:00
Liav A ebe30ed11e ACPI: Adding definitions for HPET
Also, definitions were added for MADT entries, like IOAPIC and GSI
overriding information.
2020-02-24 11:27:03 +01:00
Liav A e760ebcacb Kernel: Add the IOAPIC class
This class inherits from IRQController class, and represents
the 82093AA IOAPIC chip.
2020-02-24 11:27:03 +01:00
Liav A 7d59a67504 Kernel: Add the PIC class
This class inherits from IRQController class, and represents
the common Intel 8259 PIC chip.
2020-02-24 11:27:03 +01:00
Liav A b56afbea17 Kernel: Add IRQController class
This class is an abstraction layer for different IRQ controllers
that are present in a typical system.
2020-02-24 11:27:03 +01:00
Liav A 35f27231b3 Kernel: Fix a wrong debug message in ACPIStaticParser 2020-02-24 11:27:03 +01:00
Liav A 3539666ac9 Kernel: Add PCI helpers to enable and disable the interrupt line 2020-02-24 11:27:03 +01:00
Liav A ca05d54b2b Kernel: Add MultiProcessor Parser 2020-02-24 11:27:03 +01:00
Andreas Kling 0763f67043 AK: Make Bitmap use size_t for its size
Also rework its API's to return Optional<size_t> instead of int with -1
as the error value.
2020-02-24 09:56:07 +01:00
thatlittlegit ab9e5755ba Userland+Kernel: Set shutdown/reboot to only be run by the phys group 2020-02-23 22:03:03 +01:00
thatlittlegit 30556a0a93 SystemMenu: Move SystemDialog into SystemMenu and remove INI config
I probably would've done INI config removal in another commit, but it
fit well here because I didn't want to pledge wpath for SystemMenu if I
didn't need to.

Frankly, that's something that I think should be done: allow ConfigFile
to be used read-only.
2020-02-23 22:03:03 +01:00
Andreas Kling bbc02af090 Demos: Remove silly HelloWorld2 demo
This was just a tiny test app made with the old VisualBuilder. It's not
really useful for anything.
2020-02-23 12:27:53 +01:00
Andreas Kling 7ec758773c Kernel: Dump all kernel regions when we hit a page fault during IRQ
This way you can try to figure out what the faulting address is.
2020-02-23 11:10:52 +01:00
Andreas Kling a70cc5ca1d Kernel: Commit the entire region up front in KBuffer::copy()
Since we know exactly how much physical memory we'll need, we might as
well commit it up front instead of letting page faults drive it.
2020-02-23 11:10:52 +01:00
Andreas Kling a731ccd4a0 Kernel: Build without debugging symbols by default
Compiling with -g adds roughly 30% to kernel build times. Anyone who
wants this can turn it on locally instead.
2020-02-22 21:27:08 +01:00
Andreas Kling 97e9deccf0 Ext2FS: Add Missing HashMap.h include 2020-02-22 16:37:51 +01:00
Andreas Kling e334c36757 Kernel: Remove unnecessary allocation metadata from kmalloc() chunks
Each allocation header was tracking its index into the chunk bitmap,
but that index can be computed from the allocation address anyway.

Removing this means that each allocation gets 4 more bytes of memory
and this avoids allocating an extra chunk in many cases. :^)
2020-02-22 15:11:31 +01:00
Andreas Kling 3e973bfe14 Kernel: Make FileDescription slab-allocated 2020-02-22 14:37:58 +01:00
Andreas Kling 9fc54ba931 Kernel: Tweak SlabAllocator's slab sizes
Nobody was using the 8-byte slab size, so get rid of it and move all of
its capacity to the new 64-byte slab size (which replaces 48-byte.)
2020-02-22 14:36:45 +01:00
Andreas Kling 6428669a37 Kernel: Make Custody slab-allocated 2020-02-22 14:33:51 +01:00
Andreas Kling ba83bf8a0d Kernel: Increase kmalloc chunk size from 8 bytes to 32 bytes
This gives a huge speedup when running "git status" in a SerenityOS
repository directory. Most of the time was spent allocating strings.
2020-02-22 14:18:34 +01:00
Andreas Kling fc5ebe2a50 Kernel: Disown shared buffers on sys$execve()
When committing to a new executable, disown any shared buffers that the
process was previously co-owning.

Otherwise accessing the same shared buffer ID from the new program
would cause the kernel to find a cached (and stale!) reference to the
previous program's VM region corresponding to that shared buffer,
leading to a Region* use-after-free.

Fixes #1270.
2020-02-22 12:29:38 +01:00
Andreas Kling ece2971112 Kernel: Disable profiling during the critical section of sys$execve()
Since we're gonna throw away these stacks at the end of exec anyway,
we might as well disable profiling before starting to mess with the
process page tables. One less weird situation to worry about in the
sampling code.
2020-02-22 11:09:03 +01:00
Andreas Kling d7a13dbaa7 Kernel: Reset profiling state on exec() (but keep it going)
We now log the new executable on exec() and throw away all the samples
we've accumulated so far. But profiling keeps going.
2020-02-22 10:54:50 +01:00
Andreas Kling 983b4bd9f2 Kernel+ProfileViewer: Move symbolication to userspace for time profiles
This makes the time profiles look like the memory profiles so we can
use the userspace symbolication code in ProfileViewer.
2020-02-22 10:09:54 +01:00
Andreas Kling 94652fd2fb Kernel: Fully validate pointers when walking stack during profiling
It's not enough to just check that things wouldn't page fault, we also
need to verify that addresses are accessible to the profiled thread.
2020-02-22 10:09:54 +01:00
Andreas Kling f020081a38 Kernel: Put "Couldn't find user region" spam behind MM_DEBUG
This basically never tells us anything actionable anyway, and it's a
real annoyance when doing something validation-heavy like profiling.
2020-02-22 10:09:54 +01:00
Andreas Kling b6887bd9cd Ext2FS: The max current block count of a file is size/block_size
Turns out that i_blocks does not take block list holes into account.
2020-02-21 19:07:23 +01:00
Andreas Kling b298c01e92 Kernel: Log instead of crashing when getting a page fault during IRQ
This is definitely a bug, but it seems to happen randomly every now
and then and we need more info to track it down, so let's log for now.
2020-02-21 19:05:45 +01:00
Andreas Kling 59c052a72a Ext2FS: Allow holes in block lists
Linux creates holes in block lists for all-zero content. This is very
reasonable and we can now handle that situation as well.

Note that we're not smart enough to generate these holes ourselves yet,
but now we can at least read from such files.
2020-02-21 17:50:51 +01:00
Andreas Kling 04e40da188 Kernel: Fix crash when reading /proc/PID/vmobjects
InodeVMObjects can have nulled-out physical page slots. That just means
we haven't cached that page from disk right now.
2020-02-21 16:03:56 +01:00
Andreas Kling 59b9e49bcd Kernel: Don't trigger page faults during profiling stack walk
The kernel sampling profiler will walk thread stacks during the timer
tick handler. Since it's not safe to trigger page faults during IRQ's,
we now avoid this by checking the page tables manually before accessing
each stack location.
2020-02-21 15:49:39 +01:00
Andreas Kling f9a138aa4b Kernel: Commit the profiling sample buffer memory up front
This avoids getting page faults while storing samples in the timer IRQ.
2020-02-21 15:49:37 +01:00