summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-06-22 17:40:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-24 00:38:23 +0200
commit62f9377656a18bcca1b1616f43dc3ba85dedd8c0 (patch)
treec7026c4d994088e332d8c1021481336f51ebbf35
parent925be2758ec5d2bce226a5284dd8960b7bd3f09a (diff)
downloadserenity-62f9377656a18bcca1b1616f43dc3ba85dedd8c0.zip
Kernel: Move special sections into Sections.h
This also removes a lot of CPU.h includes infavor for Sections.h
-rw-r--r--Kernel/ACPI/DynamicParser.cpp1
-rw-r--r--Kernel/ACPI/Initialize.cpp1
-rw-r--r--Kernel/ACPI/MultiProcessorParser.cpp1
-rw-r--r--Kernel/ACPI/Parser.cpp1
-rw-r--r--Kernel/Arch/x86/CPU.h3
-rw-r--r--Kernel/Arch/x86/common/ASM_wrapper.cpp2
-rw-r--r--Kernel/Arch/x86/common/Interrupts.cpp1
-rw-r--r--Kernel/Arch/x86/common/Processor.cpp2
-rw-r--r--Kernel/Arch/x86/i386/ASM_wrapper.cpp2
-rw-r--r--Kernel/Arch/x86/i386/Processor.cpp2
-rw-r--r--Kernel/Arch/x86/x86_64/ASM_wrapper.cpp2
-rw-r--r--Kernel/Arch/x86/x86_64/Processor.cpp2
-rw-r--r--Kernel/CommandLine.cpp2
-rw-r--r--Kernel/ConsoleDevice.cpp1
-rw-r--r--Kernel/DMI.cpp1
-rw-r--r--Kernel/Devices/FullDevice.cpp2
-rw-r--r--Kernel/Devices/HID/HIDManagement.cpp1
-rw-r--r--Kernel/Devices/HID/I8042Controller.cpp1
-rw-r--r--Kernel/Devices/HID/KeyboardDevice.cpp2
-rw-r--r--Kernel/Devices/HID/PS2KeyboardDevice.cpp2
-rw-r--r--Kernel/Devices/HID/PS2MouseDevice.cpp1
-rw-r--r--Kernel/Devices/HID/VMWareMouseDevice.cpp1
-rw-r--r--Kernel/Devices/MemoryDevice.cpp1
-rw-r--r--Kernel/Devices/NullDevice.cpp3
-rw-r--r--Kernel/Devices/PCISerialDevice.cpp1
-rw-r--r--Kernel/Devices/PCSpeaker.cpp1
-rw-r--r--Kernel/Devices/RandomDevice.cpp1
-rw-r--r--Kernel/Devices/SB16.cpp1
-rw-r--r--Kernel/Devices/SerialDevice.cpp1
-rw-r--r--Kernel/Devices/USB/UHCIController.cpp1
-rw-r--r--Kernel/Devices/VMWareBackdoor.cpp2
-rw-r--r--Kernel/Devices/ZeroDevice.cpp3
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp1
-rw-r--r--Kernel/Graphics/BochsGraphicsAdapter.cpp1
-rw-r--r--Kernel/Graphics/Console/TextModeConsole.cpp1
-rw-r--r--Kernel/Graphics/Console/VGAConsole.cpp1
-rw-r--r--Kernel/Graphics/FramebufferDevice.cpp4
-rw-r--r--Kernel/Graphics/GraphicsManagement.cpp1
-rw-r--r--Kernel/Graphics/VGACompatibleAdapter.cpp1
-rw-r--r--Kernel/Heap/SlabAllocator.cpp1
-rw-r--r--Kernel/Heap/kmalloc.cpp2
-rw-r--r--Kernel/Interrupts/APIC.cpp1
-rw-r--r--Kernel/Interrupts/IOAPIC.cpp1
-rw-r--r--Kernel/Interrupts/InterruptManagement.cpp1
-rw-r--r--Kernel/Interrupts/PIC.cpp1
-rw-r--r--Kernel/Interrupts/SharedIRQHandler.cpp1
-rw-r--r--Kernel/Interrupts/SpuriousInterruptHandler.cpp1
-rw-r--r--Kernel/KSyms.cpp1
-rw-r--r--Kernel/Net/E1000ENetworkAdapter.cpp1
-rw-r--r--Kernel/Net/E1000NetworkAdapter.cpp1
-rw-r--r--Kernel/Net/NE2000NetworkAdapter.cpp1
-rw-r--r--Kernel/Net/NetworkingManagement.cpp1
-rw-r--r--Kernel/Net/RTL8139NetworkAdapter.cpp1
-rw-r--r--Kernel/Net/RTL8168NetworkAdapter.cpp1
-rw-r--r--Kernel/PCI/Access.cpp2
-rw-r--r--Kernel/PCI/IOAccess.cpp2
-rw-r--r--Kernel/PCI/Initializer.cpp1
-rw-r--r--Kernel/PCI/MMIOAccess.cpp2
-rw-r--r--Kernel/PCI/WindowedMMIOAccess.cpp2
-rw-r--r--Kernel/Process.cpp1
-rw-r--r--Kernel/Random.cpp1
-rw-r--r--Kernel/Scheduler.cpp1
-rw-r--r--Kernel/Sections.h12
-rw-r--r--Kernel/Storage/AHCIController.h2
-rw-r--r--Kernel/Storage/AHCIPort.h1
-rw-r--r--Kernel/Storage/AHCIPortHandler.h1
-rw-r--r--Kernel/Storage/BMIDEChannel.cpp1
-rw-r--r--Kernel/Storage/IDEChannel.cpp1
-rw-r--r--Kernel/Storage/IDEController.cpp1
-rw-r--r--Kernel/Storage/PATADiskDevice.cpp1
-rw-r--r--Kernel/Syscall.cpp1
-rw-r--r--Kernel/TTY/ConsoleManagement.cpp1
-rw-r--r--Kernel/TTY/PTYMultiplexer.cpp1
-rw-r--r--Kernel/TTY/VirtualConsole.cpp2
-rw-r--r--Kernel/Tasks/FinalizerTask.cpp1
-rw-r--r--Kernel/Tasks/SyncTask.cpp1
-rw-r--r--Kernel/Thread.cpp1
-rw-r--r--Kernel/Time/APICTimer.cpp2
-rw-r--r--Kernel/Time/HPET.cpp1
-rw-r--r--Kernel/Time/HPETComparator.cpp2
-rw-r--r--Kernel/Time/PIT.cpp3
-rw-r--r--Kernel/Time/TimeManagement.cpp1
-rw-r--r--Kernel/TimerQueue.cpp2
-rw-r--r--Kernel/VM/MemoryManager.cpp2
-rw-r--r--Kernel/VM/PageDirectory.cpp1
-rw-r--r--Kernel/VM/PhysicalPage.h1
-rw-r--r--Kernel/VM/Range.cpp2
-rw-r--r--Kernel/VM/RangeAllocator.h1
-rw-r--r--Kernel/VirtIO/VirtIO.cpp1
-rw-r--r--Kernel/VirtIO/VirtIOConsole.cpp1
-rw-r--r--Kernel/VirtIO/VirtIORNG.cpp1
-rw-r--r--Kernel/WorkQueue.cpp1
-rw-r--r--Kernel/init.cpp1
93 files changed, 104 insertions, 34 deletions
diff --git a/Kernel/ACPI/DynamicParser.cpp b/Kernel/ACPI/DynamicParser.cpp
index 7c6d6c6a60..b2d9f1aa59 100644
--- a/Kernel/ACPI/DynamicParser.cpp
+++ b/Kernel/ACPI/DynamicParser.cpp
@@ -6,6 +6,7 @@
#include <Kernel/ACPI/DynamicParser.h>
#include <Kernel/ACPI/Parser.h>
+#include <Kernel/Sections.h>
namespace Kernel {
namespace ACPI {
diff --git a/Kernel/ACPI/Initialize.cpp b/Kernel/ACPI/Initialize.cpp
index 9988a19a2d..9b40ceaa01 100644
--- a/Kernel/ACPI/Initialize.cpp
+++ b/Kernel/ACPI/Initialize.cpp
@@ -7,6 +7,7 @@
#include <Kernel/ACPI/DynamicParser.h>
#include <Kernel/CommandLine.h>
+#include <Kernel/Sections.h>
namespace Kernel {
namespace ACPI {
diff --git a/Kernel/ACPI/MultiProcessorParser.cpp b/Kernel/ACPI/MultiProcessorParser.cpp
index 6ef63622e8..8266d6411e 100644
--- a/Kernel/ACPI/MultiProcessorParser.cpp
+++ b/Kernel/ACPI/MultiProcessorParser.cpp
@@ -10,6 +10,7 @@
#include <Kernel/Arch/PC/BIOS.h>
#include <Kernel/Debug.h>
#include <Kernel/Interrupts/IOAPIC.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/TypedMapping.h>
diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp
index 9b56d2acbf..1706445c7e 100644
--- a/Kernel/ACPI/Parser.cpp
+++ b/Kernel/ACPI/Parser.cpp
@@ -13,6 +13,7 @@
#include <Kernel/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/PCI/Access.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/TypedMapping.h>
diff --git a/Kernel/Arch/x86/CPU.h b/Kernel/Arch/x86/CPU.h
index 32c1bde4f2..298ed8d12a 100644
--- a/Kernel/Arch/x86/CPU.h
+++ b/Kernel/Arch/x86/CPU.h
@@ -11,9 +11,6 @@
#include <Kernel/Arch/x86/DescriptorTable.h>
-#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
-#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
-
/* Map IRQ0-15 @ ISR 0x50-0x5F */
#define IRQ_VECTOR_BASE 0x50
#define GENERIC_INTERRUPT_HANDLERS_COUNT (256 - IRQ_VECTOR_BASE)
diff --git a/Kernel/Arch/x86/common/ASM_wrapper.cpp b/Kernel/Arch/x86/common/ASM_wrapper.cpp
index 787f291225..49f33dd3e8 100644
--- a/Kernel/Arch/x86/common/ASM_wrapper.cpp
+++ b/Kernel/Arch/x86/common/ASM_wrapper.cpp
@@ -7,8 +7,8 @@
#include <AK/Types.h>
#include <Kernel/Arch/x86/ASM_wrapper.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/Processor.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp
index bcd5e5e663..a5b619735f 100644
--- a/Kernel/Arch/x86/common/Interrupts.cpp
+++ b/Kernel/Arch/x86/common/Interrupts.cpp
@@ -15,6 +15,7 @@
#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <LibC/mallocdefs.h>
diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp
index 17d798cc20..96281902d7 100644
--- a/Kernel/Arch/x86/common/Processor.cpp
+++ b/Kernel/Arch/x86/common/Processor.cpp
@@ -12,11 +12,11 @@
#include <Kernel/Interrupts/APIC.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/Thread.h>
#include <Kernel/VM/ProcessPagingScope.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/CPUID.h>
#include <Kernel/Arch/x86/Interrupts.h>
#include <Kernel/Arch/x86/Processor.h>
diff --git a/Kernel/Arch/x86/i386/ASM_wrapper.cpp b/Kernel/Arch/x86/i386/ASM_wrapper.cpp
index f5ba002a5a..449529e8f2 100644
--- a/Kernel/Arch/x86/i386/ASM_wrapper.cpp
+++ b/Kernel/Arch/x86/i386/ASM_wrapper.cpp
@@ -7,8 +7,8 @@
#include <AK/Types.h>
#include <Kernel/Arch/x86/ASM_wrapper.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/Processor.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Arch/x86/i386/Processor.cpp b/Kernel/Arch/x86/i386/Processor.cpp
index 4c35e351d9..dd08a0813a 100644
--- a/Kernel/Arch/x86/i386/Processor.cpp
+++ b/Kernel/Arch/x86/i386/Processor.cpp
@@ -5,12 +5,12 @@
*/
#include <AK/StdLibExtras.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/Processor.h>
#include <Kernel/Arch/x86/TrapFrame.h>
#include <Kernel/Panic.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
namespace Kernel {
diff --git a/Kernel/Arch/x86/x86_64/ASM_wrapper.cpp b/Kernel/Arch/x86/x86_64/ASM_wrapper.cpp
index 9a463bf1b4..754f453fe7 100644
--- a/Kernel/Arch/x86/x86_64/ASM_wrapper.cpp
+++ b/Kernel/Arch/x86/x86_64/ASM_wrapper.cpp
@@ -7,8 +7,8 @@
#include <AK/Types.h>
#include <Kernel/Arch/x86/ASM_wrapper.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/Processor.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Arch/x86/x86_64/Processor.cpp b/Kernel/Arch/x86/x86_64/Processor.cpp
index 17dae9352b..7db6c9ad4c 100644
--- a/Kernel/Arch/x86/x86_64/Processor.cpp
+++ b/Kernel/Arch/x86/x86_64/Processor.cpp
@@ -5,12 +5,12 @@
*/
#include <AK/StdLibExtras.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/Processor.h>
#include <Kernel/Arch/x86/TrapFrame.h>
#include <Kernel/Panic.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
namespace Kernel {
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index 3d10641e2f..18ac77c149 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -5,9 +5,9 @@
*/
#include <AK/StringBuilder.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/CommandLine.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
namespace Kernel {
diff --git a/Kernel/ConsoleDevice.cpp b/Kernel/ConsoleDevice.cpp
index dc4529047e..944ea48fe3 100644
--- a/Kernel/ConsoleDevice.cpp
+++ b/Kernel/ConsoleDevice.cpp
@@ -7,6 +7,7 @@
#include <AK/Singleton.h>
#include <Kernel/ConsoleDevice.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/kstdio.h>
diff --git a/Kernel/DMI.cpp b/Kernel/DMI.cpp
index 293c99db28..8d821c3287 100644
--- a/Kernel/DMI.cpp
+++ b/Kernel/DMI.cpp
@@ -10,6 +10,7 @@
#include <AK/Types.h>
#include <Kernel/Arch/PC/BIOS.h>
#include <Kernel/DMI.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/MappedROM.h>
#include <Kernel/VM/TypedMapping.h>
diff --git a/Kernel/Devices/FullDevice.cpp b/Kernel/Devices/FullDevice.cpp
index 855d6a85f3..fec5cc50c9 100644
--- a/Kernel/Devices/FullDevice.cpp
+++ b/Kernel/Devices/FullDevice.cpp
@@ -7,8 +7,8 @@
#include "FullDevice.h"
#include <AK/Memory.h>
#include <AK/StdLibExtras.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <LibC/errno_numbers.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/HIDManagement.cpp b/Kernel/Devices/HID/HIDManagement.cpp
index 03e8068f08..67c2073007 100644
--- a/Kernel/Devices/HID/HIDManagement.cpp
+++ b/Kernel/Devices/HID/HIDManagement.cpp
@@ -9,6 +9,7 @@
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/HID/HIDManagement.h>
#include <Kernel/Devices/HID/I8042Controller.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Devices/HID/I8042Controller.cpp
index 1a45a35326..26d4d1f687 100644
--- a/Kernel/Devices/HID/I8042Controller.cpp
+++ b/Kernel/Devices/HID/I8042Controller.cpp
@@ -9,6 +9,7 @@
#include <Kernel/Devices/HID/PS2MouseDevice.h>
#include <Kernel/Devices/HID/VMWareMouseDevice.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/KeyboardDevice.cpp b/Kernel/Devices/HID/KeyboardDevice.cpp
index 0d8facdd96..f7f04b05f4 100644
--- a/Kernel/Devices/HID/KeyboardDevice.cpp
+++ b/Kernel/Devices/HID/KeyboardDevice.cpp
@@ -10,10 +10,10 @@
#include <AK/Singleton.h>
#include <AK/StringView.h>
#include <AK/Types.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/HID/KeyboardDevice.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
#include <Kernel/TTY/VirtualConsole.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.cpp b/Kernel/Devices/HID/PS2KeyboardDevice.cpp
index ea739ab6be..743319d6b7 100644
--- a/Kernel/Devices/HID/PS2KeyboardDevice.cpp
+++ b/Kernel/Devices/HID/PS2KeyboardDevice.cpp
@@ -10,11 +10,11 @@
#include <AK/Singleton.h>
#include <AK/StringView.h>
#include <AK/Types.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/HID/HIDManagement.h>
#include <Kernel/Devices/HID/PS2KeyboardDevice.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
#include <Kernel/TTY/ConsoleManagement.h>
#include <Kernel/WorkQueue.h>
diff --git a/Kernel/Devices/HID/PS2MouseDevice.cpp b/Kernel/Devices/HID/PS2MouseDevice.cpp
index a565e85252..942dbdfb5e 100644
--- a/Kernel/Devices/HID/PS2MouseDevice.cpp
+++ b/Kernel/Devices/HID/PS2MouseDevice.cpp
@@ -10,6 +10,7 @@
#include <Kernel/Devices/HID/PS2MouseDevice.h>
#include <Kernel/Devices/VMWareBackdoor.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/VMWareMouseDevice.cpp b/Kernel/Devices/HID/VMWareMouseDevice.cpp
index 2c54a285cb..6fb1dd197d 100644
--- a/Kernel/Devices/HID/VMWareMouseDevice.cpp
+++ b/Kernel/Devices/HID/VMWareMouseDevice.cpp
@@ -6,6 +6,7 @@
#include <Kernel/Devices/HID/VMWareMouseDevice.h>
#include <Kernel/Devices/VMWareBackdoor.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp
index 5e644a9d21..4a7ee97e56 100644
--- a/Kernel/Devices/MemoryDevice.cpp
+++ b/Kernel/Devices/MemoryDevice.cpp
@@ -9,6 +9,7 @@
#include <AK/StdLibExtras.h>
#include <Kernel/Arch/PC/BIOS.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/TypedMapping.h>
diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp
index 9ceda5a96f..f54d132a50 100644
--- a/Kernel/Devices/NullDevice.cpp
+++ b/Kernel/Devices/NullDevice.cpp
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include "NullDevice.h"
#include <AK/Singleton.h>
#include <AK/StdLibExtras.h>
+#include <Kernel/Devices/NullDevice.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/PCISerialDevice.cpp b/Kernel/Devices/PCISerialDevice.cpp
index 8e3449ec59..4ade853fee 100644
--- a/Kernel/Devices/PCISerialDevice.cpp
+++ b/Kernel/Devices/PCISerialDevice.cpp
@@ -5,6 +5,7 @@
*/
#include <Kernel/Devices/PCISerialDevice.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/PCSpeaker.cpp b/Kernel/Devices/PCSpeaker.cpp
index 15f4773d4f..f4707f535e 100644
--- a/Kernel/Devices/PCSpeaker.cpp
+++ b/Kernel/Devices/PCSpeaker.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Devices/PCSpeaker.h>
#include <Kernel/IO.h>
#include <Kernel/Time/PIT.h>
diff --git a/Kernel/Devices/RandomDevice.cpp b/Kernel/Devices/RandomDevice.cpp
index b2f0cf5e4b..302ab4a00b 100644
--- a/Kernel/Devices/RandomDevice.cpp
+++ b/Kernel/Devices/RandomDevice.cpp
@@ -7,6 +7,7 @@
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/Panic.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp
index 94a9f1b6b1..81a3ea3934 100644
--- a/Kernel/Devices/SB16.cpp
+++ b/Kernel/Devices/SB16.cpp
@@ -11,6 +11,7 @@
#include <Kernel/Debug.h>
#include <Kernel/Devices/SB16.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/MemoryManager.h>
diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp
index e97f2059eb..cf8b4e8127 100644
--- a/Kernel/Devices/SerialDevice.cpp
+++ b/Kernel/Devices/SerialDevice.cpp
@@ -8,6 +8,7 @@
#include <Kernel/Devices/SerialDevice.h>
#include <Kernel/IO.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/USB/UHCIController.cpp b/Kernel/Devices/USB/UHCIController.cpp
index e5b3af0cf8..153c825b58 100644
--- a/Kernel/Devices/USB/UHCIController.cpp
+++ b/Kernel/Devices/USB/UHCIController.cpp
@@ -11,6 +11,7 @@
#include <Kernel/Devices/USB/UHCIController.h>
#include <Kernel/Devices/USB/USBRequest.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/Time/TimeManagement.h>
#include <Kernel/VM/AnonymousVMObject.h>
diff --git a/Kernel/Devices/VMWareBackdoor.cpp b/Kernel/Devices/VMWareBackdoor.cpp
index 7d65ac97a1..17e61bed08 100644
--- a/Kernel/Devices/VMWareBackdoor.cpp
+++ b/Kernel/Devices/VMWareBackdoor.cpp
@@ -7,11 +7,11 @@
#include <AK/OwnPtr.h>
#include <AK/Singleton.h>
#include <Kernel/API/MousePacket.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/CommandLine.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/VMWareBackdoor.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp
index 45cbf9f802..37324d2376 100644
--- a/Kernel/Devices/ZeroDevice.cpp
+++ b/Kernel/Devices/ZeroDevice.cpp
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include "ZeroDevice.h"
#include <AK/Memory.h>
#include <AK/StdLibExtras.h>
+#include <Kernel/Devices/ZeroDevice.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index cce7e71f53..621ec6a779 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -16,6 +16,7 @@
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/KSyms.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <LibC/errno_numbers.h>
namespace Kernel {
diff --git a/Kernel/Graphics/BochsGraphicsAdapter.cpp b/Kernel/Graphics/BochsGraphicsAdapter.cpp
index 6e947113f5..5d764e2a05 100644
--- a/Kernel/Graphics/BochsGraphicsAdapter.cpp
+++ b/Kernel/Graphics/BochsGraphicsAdapter.cpp
@@ -15,6 +15,7 @@
#include <Kernel/IO.h>
#include <Kernel/PCI/Access.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/TypedMapping.h>
diff --git a/Kernel/Graphics/Console/TextModeConsole.cpp b/Kernel/Graphics/Console/TextModeConsole.cpp
index 25bce279c9..2739ba4c7e 100644
--- a/Kernel/Graphics/Console/TextModeConsole.cpp
+++ b/Kernel/Graphics/Console/TextModeConsole.cpp
@@ -7,6 +7,7 @@
#include <Kernel/Graphics/Console/TextModeConsole.h>
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
namespace Kernel::Graphics {
diff --git a/Kernel/Graphics/Console/VGAConsole.cpp b/Kernel/Graphics/Console/VGAConsole.cpp
index 70472b55e7..73bcabb7e2 100644
--- a/Kernel/Graphics/Console/VGAConsole.cpp
+++ b/Kernel/Graphics/Console/VGAConsole.cpp
@@ -5,6 +5,7 @@
*/
#include <Kernel/Graphics/Console/VGAConsole.h>
+#include <Kernel/Sections.h>
namespace Kernel::Graphics {
diff --git a/Kernel/Graphics/FramebufferDevice.cpp b/Kernel/Graphics/FramebufferDevice.cpp
index 7f4447b144..b66583ff50 100644
--- a/Kernel/Graphics/FramebufferDevice.cpp
+++ b/Kernel/Graphics/FramebufferDevice.cpp
@@ -9,15 +9,15 @@
#include <Kernel/Debug.h>
#include <Kernel/Graphics/FramebufferDevice.h>
#include <Kernel/Graphics/GraphicsManagement.h>
+#include <Kernel/Panic.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/TypedMapping.h>
#include <LibC/errno_numbers.h>
#include <LibC/sys/ioctl_numbers.h>
-#include <Kernel/Panic.h>
-
#define MAX_RESOLUTION_WIDTH 4096
#define MAX_RESOLUTION_HEIGHT 2160
diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp
index 6fde82ee5c..69a1528eb7 100644
--- a/Kernel/Graphics/GraphicsManagement.cpp
+++ b/Kernel/Graphics/GraphicsManagement.cpp
@@ -18,6 +18,7 @@
#include <Kernel/Multiboot.h>
#include <Kernel/PCI/IDs.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/AnonymousVMObject.h>
namespace Kernel {
diff --git a/Kernel/Graphics/VGACompatibleAdapter.cpp b/Kernel/Graphics/VGACompatibleAdapter.cpp
index 19ece12e59..53603bbce6 100644
--- a/Kernel/Graphics/VGACompatibleAdapter.cpp
+++ b/Kernel/Graphics/VGACompatibleAdapter.cpp
@@ -9,6 +9,7 @@
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/Graphics/VGACompatibleAdapter.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Heap/SlabAllocator.cpp b/Kernel/Heap/SlabAllocator.cpp
index d5980ad2aa..c83f3fd72c 100644
--- a/Kernel/Heap/SlabAllocator.cpp
+++ b/Kernel/Heap/SlabAllocator.cpp
@@ -8,6 +8,7 @@
#include <AK/Memory.h>
#include <Kernel/Heap/SlabAllocator.h>
#include <Kernel/Heap/kmalloc.h>
+#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/VM/Region.h>
diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp
index 4562e82936..e6538cc561 100644
--- a/Kernel/Heap/kmalloc.cpp
+++ b/Kernel/Heap/kmalloc.cpp
@@ -12,7 +12,6 @@
#include <AK/Assertions.h>
#include <AK/NonnullOwnPtrVector.h>
#include <AK/Types.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/Heap/Heap.h>
#include <Kernel/Heap/kmalloc.h>
@@ -21,6 +20,7 @@
#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/MemoryManager.h>
diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp
index 1c43d55da0..fe8de2a2c8 100644
--- a/Kernel/Interrupts/APIC.cpp
+++ b/Kernel/Interrupts/APIC.cpp
@@ -16,6 +16,7 @@
#include <Kernel/Interrupts/APIC.h>
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <Kernel/Time/APICTimer.h>
#include <Kernel/VM/MemoryManager.h>
diff --git a/Kernel/Interrupts/IOAPIC.cpp b/Kernel/Interrupts/IOAPIC.cpp
index 8f498a2bc9..551327b598 100644
--- a/Kernel/Interrupts/IOAPIC.cpp
+++ b/Kernel/Interrupts/IOAPIC.cpp
@@ -11,6 +11,7 @@
#include <Kernel/Interrupts/APIC.h>
#include <Kernel/Interrupts/IOAPIC.h>
#include <Kernel/Interrupts/InterruptManagement.h>
+#include <Kernel/Sections.h>
#define IOAPIC_REDIRECTION_ENTRY_OFFSET 0x10
namespace Kernel {
diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp
index 3d7098ac39..c9444cf19a 100644
--- a/Kernel/Interrupts/InterruptManagement.cpp
+++ b/Kernel/Interrupts/InterruptManagement.cpp
@@ -17,6 +17,7 @@
#include <Kernel/Interrupts/SharedIRQHandler.h>
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
#include <Kernel/Interrupts/UnhandledInterruptHandler.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/TypedMapping.h>
#define PCAT_COMPAT_FLAG 0x1
diff --git a/Kernel/Interrupts/PIC.cpp b/Kernel/Interrupts/PIC.cpp
index 2045bf145d..ad7ea1423a 100644
--- a/Kernel/Interrupts/PIC.cpp
+++ b/Kernel/Interrupts/PIC.cpp
@@ -10,6 +10,7 @@
#include <Kernel/IO.h>
#include <Kernel/Interrupts/GenericInterruptHandler.h>
#include <Kernel/Interrupts/PIC.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Interrupts/SharedIRQHandler.cpp b/Kernel/Interrupts/SharedIRQHandler.cpp
index 130025b5eb..25d065e2de 100644
--- a/Kernel/Interrupts/SharedIRQHandler.cpp
+++ b/Kernel/Interrupts/SharedIRQHandler.cpp
@@ -10,6 +10,7 @@
#include <Kernel/Interrupts/InterruptManagement.h>
#include <Kernel/Interrupts/PIC.h>
#include <Kernel/Interrupts/SharedIRQHandler.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.cpp b/Kernel/Interrupts/SpuriousInterruptHandler.cpp
index 979a157fa5..fd9ec678e7 100644
--- a/Kernel/Interrupts/SpuriousInterruptHandler.cpp
+++ b/Kernel/Interrupts/SpuriousInterruptHandler.cpp
@@ -6,6 +6,7 @@
#include <Kernel/Interrupts/InterruptManagement.h>
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp
index 8a21a9e661..6e138f6b04 100644
--- a/Kernel/KSyms.cpp
+++ b/Kernel/KSyms.cpp
@@ -11,6 +11,7 @@
#include <Kernel/KSyms.h>
#include <Kernel/Process.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Net/E1000ENetworkAdapter.cpp b/Kernel/Net/E1000ENetworkAdapter.cpp
index 0a5716bb20..63749e1ce9 100644
--- a/Kernel/Net/E1000ENetworkAdapter.cpp
+++ b/Kernel/Net/E1000ENetworkAdapter.cpp
@@ -8,6 +8,7 @@
#include <Kernel/Debug.h>
#include <Kernel/Net/E1000ENetworkAdapter.h>
#include <Kernel/PCI/IDs.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp
index e51cd6878d..d8c831e499 100644
--- a/Kernel/Net/E1000NetworkAdapter.cpp
+++ b/Kernel/Net/E1000NetworkAdapter.cpp
@@ -8,6 +8,7 @@
#include <Kernel/Debug.h>
#include <Kernel/Net/E1000NetworkAdapter.h>
#include <Kernel/PCI/IDs.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Net/NE2000NetworkAdapter.cpp b/Kernel/Net/NE2000NetworkAdapter.cpp
index 596882825b..438d40867d 100644
--- a/Kernel/Net/NE2000NetworkAdapter.cpp
+++ b/Kernel/Net/NE2000NetworkAdapter.cpp
@@ -8,6 +8,7 @@
#include <Kernel/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/Net/NE2000NetworkAdapter.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp
index 36e08853e1..8db21be7af 100644
--- a/Kernel/Net/NetworkingManagement.cpp
+++ b/Kernel/Net/NetworkingManagement.cpp
@@ -18,6 +18,7 @@
#include <Kernel/Net/RTL8139NetworkAdapter.h>
#include <Kernel/Net/RTL8168NetworkAdapter.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/AnonymousVMObject.h>
namespace Kernel {
diff --git a/Kernel/Net/RTL8139NetworkAdapter.cpp b/Kernel/Net/RTL8139NetworkAdapter.cpp
index a5a655467c..2a970ce12c 100644
--- a/Kernel/Net/RTL8139NetworkAdapter.cpp
+++ b/Kernel/Net/RTL8139NetworkAdapter.cpp
@@ -8,6 +8,7 @@
#include <Kernel/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/Net/RTL8139NetworkAdapter.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Net/RTL8168NetworkAdapter.cpp b/Kernel/Net/RTL8168NetworkAdapter.cpp
index ae3aebe86e..344e2935c3 100644
--- a/Kernel/Net/RTL8168NetworkAdapter.cpp
+++ b/Kernel/Net/RTL8168NetworkAdapter.cpp
@@ -9,6 +9,7 @@
#include <Kernel/IO.h>
#include <Kernel/Net/RTL8168NetworkAdapter.h>
#include <Kernel/PCI/IDs.h>
+#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/PCI/Access.cpp b/Kernel/PCI/Access.cpp
index eeb4099ad5..54ddb65d38 100644
--- a/Kernel/PCI/Access.cpp
+++ b/Kernel/PCI/Access.cpp
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/PCI/Access.h>
#include <Kernel/PCI/IOAccess.h>
+#include <Kernel/Sections.h>
namespace Kernel {
namespace PCI {
diff --git a/Kernel/PCI/IOAccess.cpp b/Kernel/PCI/IOAccess.cpp
index 15e991e2aa..663f4f5e3a 100644
--- a/Kernel/PCI/IOAccess.cpp
+++ b/Kernel/PCI/IOAccess.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/IO.h>
#include <Kernel/PCI/IOAccess.h>
+#include <Kernel/Sections.h>
namespace Kernel {
namespace PCI {
diff --git a/Kernel/PCI/Initializer.cpp b/Kernel/PCI/Initializer.cpp
index 36d449f641..f4074e90ce 100644
--- a/Kernel/PCI/Initializer.cpp
+++ b/Kernel/PCI/Initializer.cpp
@@ -12,6 +12,7 @@
#include <Kernel/PCI/MMIOAccess.h>
#include <Kernel/PCI/WindowedMMIOAccess.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
namespace Kernel {
namespace PCI {
diff --git a/Kernel/PCI/MMIOAccess.cpp b/Kernel/PCI/MMIOAccess.cpp
index 8107901534..7522204b83 100644
--- a/Kernel/PCI/MMIOAccess.cpp
+++ b/Kernel/PCI/MMIOAccess.cpp
@@ -6,10 +6,10 @@
#include <AK/Optional.h>
#include <AK/StringView.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/Debug.h>
#include <Kernel/PCI/MMIOAccess.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/MemoryManager.h>
namespace Kernel {
diff --git a/Kernel/PCI/WindowedMMIOAccess.cpp b/Kernel/PCI/WindowedMMIOAccess.cpp
index 1415d5d0a9..4eeef08bf5 100644
--- a/Kernel/PCI/WindowedMMIOAccess.cpp
+++ b/Kernel/PCI/WindowedMMIOAccess.cpp
@@ -6,10 +6,10 @@
#include <AK/Optional.h>
#include <AK/StringView.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/Debug.h>
#include <Kernel/PCI/WindowedMMIOAccess.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/MemoryManager.h>
namespace Kernel {
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 820cc538bf..f5e4aad973 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -24,6 +24,7 @@
#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/RTC.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/TTY/TTY.h>
#include <Kernel/Thread.h>
diff --git a/Kernel/Random.cpp b/Kernel/Random.cpp
index 3b0e8b0d5b..ca72e613bf 100644
--- a/Kernel/Random.cpp
+++ b/Kernel/Random.cpp
@@ -9,6 +9,7 @@
#include <Kernel/Arch/x86/Processor.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/HPET.h>
#include <Kernel/Time/RTC.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index 62062ab38d..a3b25aad4b 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -15,6 +15,7 @@
#include <Kernel/Process.h>
#include <Kernel/RTC.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/TimeManagement.h>
#include <Kernel/TimerQueue.h>
diff --git a/Kernel/Sections.h b/Kernel/Sections.h
new file mode 100644
index 0000000000..5cd82429eb
--- /dev/null
+++ b/Kernel/Sections.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Platform.h>
+
+#define READONLY_AFTER_INIT __attribute__((section(".ro_after_init")))
+#define UNMAP_AFTER_INIT NEVER_INLINE __attribute__((section(".unmap_after_init")))
diff --git a/Kernel/Storage/AHCIController.h b/Kernel/Storage/AHCIController.h
index ba57706506..f873ddd15f 100644
--- a/Kernel/Storage/AHCIController.h
+++ b/Kernel/Storage/AHCIController.h
@@ -9,6 +9,7 @@
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <AK/Types.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/AHCI.h>
#include <Kernel/Storage/StorageController.h>
#include <Kernel/Storage/StorageDevice.h>
@@ -24,7 +25,6 @@ class AHCIController final : public StorageController
friend class AHCIPort;
AK_MAKE_ETERNAL
public:
-public:
UNMAP_AFTER_INIT static NonnullRefPtr<AHCIController> initialize(PCI::Address address);
virtual ~AHCIController() override;
diff --git a/Kernel/Storage/AHCIPort.h b/Kernel/Storage/AHCIPort.h
index 0b49490e98..a8730272b3 100644
--- a/Kernel/Storage/AHCIPort.h
+++ b/Kernel/Storage/AHCIPort.h
@@ -14,6 +14,7 @@
#include <Kernel/Lock.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/Storage/AHCI.h>
#include <Kernel/Storage/AHCIPortHandler.h>
diff --git a/Kernel/Storage/AHCIPortHandler.h b/Kernel/Storage/AHCIPortHandler.h
index 48673b3947..1d5fe52321 100644
--- a/Kernel/Storage/AHCIPortHandler.h
+++ b/Kernel/Storage/AHCIPortHandler.h
@@ -14,6 +14,7 @@
#include <Kernel/Lock.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/AHCIController.h>
#include <Kernel/Storage/AHCIPort.h>
#include <Kernel/Storage/StorageDevice.h>
diff --git a/Kernel/Storage/BMIDEChannel.cpp b/Kernel/Storage/BMIDEChannel.cpp
index b1e9c34a45..4636300699 100644
--- a/Kernel/Storage/BMIDEChannel.cpp
+++ b/Kernel/Storage/BMIDEChannel.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Kernel/Sections.h>
#include <Kernel/Storage/ATA.h>
#include <Kernel/Storage/BMIDEChannel.h>
#include <Kernel/Storage/IDEController.h>
diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp
index 6239f7c834..188cf20553 100644
--- a/Kernel/Storage/IDEChannel.cpp
+++ b/Kernel/Storage/IDEChannel.cpp
@@ -9,6 +9,7 @@
#include <AK/StringView.h>
#include <Kernel/IO.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/ATA.h>
#include <Kernel/Storage/IDEChannel.h>
#include <Kernel/Storage/IDEController.h>
diff --git a/Kernel/Storage/IDEController.cpp b/Kernel/Storage/IDEController.cpp
index a347081637..b0412b14d5 100644
--- a/Kernel/Storage/IDEController.cpp
+++ b/Kernel/Storage/IDEController.cpp
@@ -8,6 +8,7 @@
#include <AK/RefPtr.h>
#include <AK/Types.h>
#include <Kernel/FileSystem/ProcFS.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/BMIDEChannel.h>
#include <Kernel/Storage/IDEController.h>
#include <Kernel/Storage/PATADiskDevice.h>
diff --git a/Kernel/Storage/PATADiskDevice.cpp b/Kernel/Storage/PATADiskDevice.cpp
index 294c1cf30f..078d69e53f 100644
--- a/Kernel/Storage/PATADiskDevice.cpp
+++ b/Kernel/Storage/PATADiskDevice.cpp
@@ -7,6 +7,7 @@
#include <AK/Memory.h>
#include <AK/StringView.h>
#include <Kernel/FileSystem/FileDescription.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/IDEChannel.h>
#include <Kernel/Storage/IDEController.h>
#include <Kernel/Storage/PATADiskDevice.h>
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index e88e300687..f7b32d1748 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -10,6 +10,7 @@
#include <Kernel/Arch/x86/TrapFrame.h>
#include <Kernel/Panic.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/ThreadTracer.h>
#include <Kernel/VM/MemoryManager.h>
diff --git a/Kernel/TTY/ConsoleManagement.cpp b/Kernel/TTY/ConsoleManagement.cpp
index c1cf6d0d15..f768fca6a4 100644
--- a/Kernel/TTY/ConsoleManagement.cpp
+++ b/Kernel/TTY/ConsoleManagement.cpp
@@ -9,6 +9,7 @@
#include <Kernel/Debug.h>
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/Panic.h>
+#include <Kernel/Sections.h>
#include <Kernel/TTY/ConsoleManagement.h>
namespace Kernel {
diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp
index 467bcec8cf..1005fad74c 100644
--- a/Kernel/TTY/PTYMultiplexer.cpp
+++ b/Kernel/TTY/PTYMultiplexer.cpp
@@ -10,6 +10,7 @@
#include <Kernel/Debug.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <LibC/errno_numbers.h>
namespace Kernel {
diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp
index 318b2f414f..7dfc4a66d2 100644
--- a/Kernel/TTY/VirtualConsole.cpp
+++ b/Kernel/TTY/VirtualConsole.cpp
@@ -9,12 +9,12 @@
#include "VirtualConsole.h"
#include <AK/StdLibExtras.h>
#include <AK/String.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/HID/HIDManagement.h>
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/Heap/kmalloc.h>
#include <Kernel/IO.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/TTY/ConsoleManagement.h>
#include <LibVT/Color.h>
diff --git a/Kernel/Tasks/FinalizerTask.cpp b/Kernel/Tasks/FinalizerTask.cpp
index a66109d9da..ffdfb09ef3 100644
--- a/Kernel/Tasks/FinalizerTask.cpp
+++ b/Kernel/Tasks/FinalizerTask.cpp
@@ -5,6 +5,7 @@
*/
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/Tasks/FinalizerTask.h>
namespace Kernel {
diff --git a/Kernel/Tasks/SyncTask.cpp b/Kernel/Tasks/SyncTask.cpp
index 313cfb1528..f660e5c451 100644
--- a/Kernel/Tasks/SyncTask.cpp
+++ b/Kernel/Tasks/SyncTask.cpp
@@ -6,6 +6,7 @@
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/Tasks/SyncTask.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index c84cdf127d..9e8f851004 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -17,6 +17,7 @@
#include <Kernel/PerformanceEventBuffer.h>
#include <Kernel/Process.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <Kernel/ThreadTracer.h>
#include <Kernel/TimerQueue.h>
diff --git a/Kernel/Time/APICTimer.cpp b/Kernel/Time/APICTimer.cpp
index c46d3afc6f..ab5932a3c8 100644
--- a/Kernel/Time/APICTimer.cpp
+++ b/Kernel/Time/APICTimer.cpp
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/IO.h>
#include <Kernel/Interrupts/APIC.h>
#include <Kernel/Panic.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <Kernel/Time/APICTimer.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Time/HPET.cpp b/Kernel/Time/HPET.cpp
index c1d77dbffe..a7e331138e 100644
--- a/Kernel/Time/HPET.cpp
+++ b/Kernel/Time/HPET.cpp
@@ -8,6 +8,7 @@
#include <Kernel/ACPI/Parser.h>
#include <Kernel/Debug.h>
#include <Kernel/Interrupts/InterruptManagement.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/HPET.h>
#include <Kernel/Time/HPETComparator.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Time/HPETComparator.cpp b/Kernel/Time/HPETComparator.cpp
index 5e383e3ea3..55718053da 100644
--- a/Kernel/Time/HPETComparator.cpp
+++ b/Kernel/Time/HPETComparator.cpp
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/Assertions.h>
#include <Kernel/Debug.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/HPETComparator.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Time/PIT.cpp b/Kernel/Time/PIT.cpp
index ed683320d9..68ec1fde87 100644
--- a/Kernel/Time/PIT.cpp
+++ b/Kernel/Time/PIT.cpp
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/IO.h>
+#include <Kernel/Interrupts/GenericInterruptHandler.h>
#include <Kernel/Interrupts/PIC.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Thread.h>
#include <Kernel/Time/PIT.h>
#include <Kernel/Time/TimeManagement.h>
diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp
index fc23f3e5cc..5c0028b938 100644
--- a/Kernel/Time/TimeManagement.cpp
+++ b/Kernel/Time/TimeManagement.cpp
@@ -13,6 +13,7 @@
#include <Kernel/Interrupts/APIC.h>
#include <Kernel/PerformanceManager.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/APICTimer.h>
#include <Kernel/Time/HPET.h>
#include <Kernel/Time/HPETComparator.h>
diff --git a/Kernel/TimerQueue.cpp b/Kernel/TimerQueue.cpp
index 26856ec60f..fc6e59f3ef 100644
--- a/Kernel/TimerQueue.cpp
+++ b/Kernel/TimerQueue.cpp
@@ -7,8 +7,8 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/Singleton.h>
#include <AK/Time.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Time/TimeManagement.h>
#include <Kernel/TimerQueue.h>
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index 33b7be6c76..cccfca3fc1 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -7,12 +7,12 @@
#include <AK/Assertions.h>
#include <AK/Memory.h>
#include <AK/StringView.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/CMOS.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Heap/kmalloc.h>
#include <Kernel/Multiboot.h>
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/ContiguousVMObject.h>
diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp
index b6b5287b48..27ef82a368 100644
--- a/Kernel/VM/PageDirectory.cpp
+++ b/Kernel/VM/PageDirectory.cpp
@@ -8,6 +8,7 @@
#include <AK/Singleton.h>
#include <Kernel/Process.h>
#include <Kernel/Random.h>
+#include <Kernel/Sections.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/PageDirectory.h>
diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h
index 5d2b572409..713815cf2d 100644
--- a/Kernel/VM/PhysicalPage.h
+++ b/Kernel/VM/PhysicalPage.h
@@ -7,7 +7,6 @@
#pragma once
#include <AK/NonnullRefPtr.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/Assertions.h>
#include <Kernel/Heap/SlabAllocator.h>
#include <Kernel/PhysicalAddress.h>
diff --git a/Kernel/VM/Range.cpp b/Kernel/VM/Range.cpp
index 6b846daaea..4dc3c01bbc 100644
--- a/Kernel/VM/Range.cpp
+++ b/Kernel/VM/Range.cpp
@@ -6,9 +6,9 @@
*/
#include <AK/Vector.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/Range.h>
+#include <LibC/limits.h>
namespace Kernel {
diff --git a/Kernel/VM/RangeAllocator.h b/Kernel/VM/RangeAllocator.h
index de8148f6f2..bb5e866ab9 100644
--- a/Kernel/VM/RangeAllocator.h
+++ b/Kernel/VM/RangeAllocator.h
@@ -8,7 +8,6 @@
#include <AK/Traits.h>
#include <AK/Vector.h>
-#include <Kernel/Arch/x86/CPU.h>
#include <Kernel/SpinLock.h>
#include <Kernel/VM/Range.h>
diff --git a/Kernel/VirtIO/VirtIO.cpp b/Kernel/VirtIO/VirtIO.cpp
index ba6b95f1a6..6594af428c 100644
--- a/Kernel/VirtIO/VirtIO.cpp
+++ b/Kernel/VirtIO/VirtIO.cpp
@@ -6,6 +6,7 @@
#include <Kernel/CommandLine.h>
#include <Kernel/PCI/IDs.h>
+#include <Kernel/Sections.h>
#include <Kernel/VirtIO/VirtIO.h>
#include <Kernel/VirtIO/VirtIOConsole.h>
#include <Kernel/VirtIO/VirtIORNG.h>
diff --git a/Kernel/VirtIO/VirtIOConsole.cpp b/Kernel/VirtIO/VirtIOConsole.cpp
index 3c97e24dac..17ccbff8c5 100644
--- a/Kernel/VirtIO/VirtIOConsole.cpp
+++ b/Kernel/VirtIO/VirtIOConsole.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Kernel/Sections.h>
#include <Kernel/VirtIO/VirtIOConsole.h>
namespace Kernel {
diff --git a/Kernel/VirtIO/VirtIORNG.cpp b/Kernel/VirtIO/VirtIORNG.cpp
index 8ce4d88048..87e5df815f 100644
--- a/Kernel/VirtIO/VirtIORNG.cpp
+++ b/Kernel/VirtIO/VirtIORNG.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Kernel/Sections.h>
#include <Kernel/VirtIO/VirtIORNG.h>
namespace Kernel {
diff --git a/Kernel/WorkQueue.cpp b/Kernel/WorkQueue.cpp
index d1a79b0c90..1d00dcef1a 100644
--- a/Kernel/WorkQueue.cpp
+++ b/Kernel/WorkQueue.cpp
@@ -5,6 +5,7 @@
*/
#include <Kernel/Process.h>
+#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/WaitQueue.h>
#include <Kernel/WorkQueue.h>
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index 9807bc3c33..50133c5c0b 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -42,6 +42,7 @@
#include <Kernel/RTC.h>
#include <Kernel/Random.h>
#include <Kernel/Scheduler.h>
+#include <Kernel/Sections.h>
#include <Kernel/Storage/StorageManagement.h>
#include <Kernel/TTY/ConsoleManagement.h>
#include <Kernel/TTY/PTYMultiplexer.h>