From 336fb4f3135c4f41228f1393d85183dc44e8b92b Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 24 Feb 2023 20:33:43 +0200 Subject: Kernel: Move InterruptDisabler to the Interrupts subdirectory --- Kernel/Arch/aarch64/PageDirectory.cpp | 2 +- Kernel/Arch/aarch64/Processor.cpp | 2 +- Kernel/Arch/aarch64/TrapFrame.cpp | 2 +- Kernel/Arch/x86_64/Hypervisor/VMWareBackdoor.cpp | 2 +- Kernel/Arch/x86_64/InterruptManagement.cpp | 2 +- Kernel/Arch/x86_64/Interrupts/IOAPIC.cpp | 2 +- Kernel/Arch/x86_64/Interrupts/PIC.cpp | 2 +- Kernel/Arch/x86_64/PCI/MSI.cpp | 2 +- Kernel/Arch/x86_64/PageDirectory.cpp | 2 +- Kernel/Arch/x86_64/Processor.cpp | 2 +- Kernel/Arch/x86_64/Time/HPETComparator.cpp | 2 +- Kernel/Arch/x86_64/Time/PIT.cpp | 2 +- Kernel/Arch/x86_64/Time/RTC.cpp | 2 +- Kernel/Arch/x86_64/TrapFrame.cpp | 2 +- Kernel/Devices/Audio/AC97.cpp | 2 +- Kernel/FileSystem/FileSystem.cpp | 2 +- Kernel/FileSystem/ProcFS/ProcessExposed.cpp | 2 +- Kernel/Firmware/ACPI/Parser.cpp | 2 +- Kernel/InterruptDisabler.h | 32 ------------------------ Kernel/Interrupts/IRQHandler.cpp | 2 +- Kernel/Interrupts/InterruptDisabler.h | 32 ++++++++++++++++++++++++ Kernel/Library/DoubleBuffer.cpp | 2 +- Kernel/Memory/MemoryManager.cpp | 2 +- Kernel/Memory/Region.cpp | 2 +- Kernel/Memory/ScopedAddressSpaceSwitcher.cpp | 2 +- Kernel/Net/NetworkAdapter.cpp | 2 +- Kernel/Syscalls/sigaction.cpp | 2 +- Kernel/TTY/MasterPTY.cpp | 2 +- Kernel/TTY/TTY.cpp | 2 +- Kernel/Tasks/Process.cpp | 2 +- Kernel/Tasks/Scheduler.cpp | 2 +- Kernel/Tasks/Thread.cpp | 2 +- Kernel/Time/TimeManagement.cpp | 2 +- 33 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 Kernel/InterruptDisabler.h create mode 100644 Kernel/Interrupts/InterruptDisabler.h diff --git a/Kernel/Arch/aarch64/PageDirectory.cpp b/Kernel/Arch/aarch64/PageDirectory.cpp index e27f831ba9..a9424f9dcf 100644 --- a/Kernel/Arch/aarch64/PageDirectory.cpp +++ b/Kernel/Arch/aarch64/PageDirectory.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/aarch64/Processor.cpp b/Kernel/Arch/aarch64/Processor.cpp index b049ac4b9b..97015792ab 100644 --- a/Kernel/Arch/aarch64/Processor.cpp +++ b/Kernel/Arch/aarch64/Processor.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/aarch64/TrapFrame.cpp b/Kernel/Arch/aarch64/TrapFrame.cpp index 6455dcbfba..c5fa707905 100644 --- a/Kernel/Arch/aarch64/TrapFrame.cpp +++ b/Kernel/Arch/aarch64/TrapFrame.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include namespace Kernel { diff --git a/Kernel/Arch/x86_64/Hypervisor/VMWareBackdoor.cpp b/Kernel/Arch/x86_64/Hypervisor/VMWareBackdoor.cpp index 9f86a0ce3e..34810ff836 100644 --- a/Kernel/Arch/x86_64/Hypervisor/VMWareBackdoor.cpp +++ b/Kernel/Arch/x86_64/Hypervisor/VMWareBackdoor.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include namespace Kernel { diff --git a/Kernel/Arch/x86_64/InterruptManagement.cpp b/Kernel/Arch/x86_64/InterruptManagement.cpp index 245e6593a9..f392eff467 100644 --- a/Kernel/Arch/x86_64/InterruptManagement.cpp +++ b/Kernel/Arch/x86_64/InterruptManagement.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/x86_64/Interrupts/IOAPIC.cpp b/Kernel/Arch/x86_64/Interrupts/IOAPIC.cpp index 5b63d4b56f..92eda67683 100644 --- a/Kernel/Arch/x86_64/Interrupts/IOAPIC.cpp +++ b/Kernel/Arch/x86_64/Interrupts/IOAPIC.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #define IOAPIC_REDIRECTION_ENTRY_OFFSET 0x10 diff --git a/Kernel/Arch/x86_64/Interrupts/PIC.cpp b/Kernel/Arch/x86_64/Interrupts/PIC.cpp index 77c567d97b..48c282c932 100644 --- a/Kernel/Arch/x86_64/Interrupts/PIC.cpp +++ b/Kernel/Arch/x86_64/Interrupts/PIC.cpp @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include namespace Kernel { diff --git a/Kernel/Arch/x86_64/PCI/MSI.cpp b/Kernel/Arch/x86_64/PCI/MSI.cpp index 874f9aae94..e6a991c620 100644 --- a/Kernel/Arch/x86_64/PCI/MSI.cpp +++ b/Kernel/Arch/x86_64/PCI/MSI.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace Kernel { u64 msi_address_register(u8 destination_id, bool redirection_hint, bool destination_mode) diff --git a/Kernel/Arch/x86_64/PageDirectory.cpp b/Kernel/Arch/x86_64/PageDirectory.cpp index 22b8381f25..ae3e7a7e26 100644 --- a/Kernel/Arch/x86_64/PageDirectory.cpp +++ b/Kernel/Arch/x86_64/PageDirectory.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/x86_64/Processor.cpp b/Kernel/Arch/x86_64/Processor.cpp index 34656f0273..06069eef6b 100644 --- a/Kernel/Arch/x86_64/Processor.cpp +++ b/Kernel/Arch/x86_64/Processor.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/x86_64/Time/HPETComparator.cpp b/Kernel/Arch/x86_64/Time/HPETComparator.cpp index 45e0c67590..213ad1071f 100644 --- a/Kernel/Arch/x86_64/Time/HPETComparator.cpp +++ b/Kernel/Arch/x86_64/Time/HPETComparator.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/Kernel/Arch/x86_64/Time/PIT.cpp b/Kernel/Arch/x86_64/Time/PIT.cpp index 4626de8596..5a2f2536c5 100644 --- a/Kernel/Arch/x86_64/Time/PIT.cpp +++ b/Kernel/Arch/x86_64/Time/PIT.cpp @@ -6,8 +6,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/Kernel/Arch/x86_64/Time/RTC.cpp b/Kernel/Arch/x86_64/Time/RTC.cpp index eb372beb05..85ba8a5ad7 100644 --- a/Kernel/Arch/x86_64/Time/RTC.cpp +++ b/Kernel/Arch/x86_64/Time/RTC.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include namespace Kernel { diff --git a/Kernel/Arch/x86_64/TrapFrame.cpp b/Kernel/Arch/x86_64/TrapFrame.cpp index ba363c306e..cab1a6e100 100644 --- a/Kernel/Arch/x86_64/TrapFrame.cpp +++ b/Kernel/Arch/x86_64/TrapFrame.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include namespace Kernel { diff --git a/Kernel/Devices/Audio/AC97.cpp b/Kernel/Devices/Audio/AC97.cpp index 75bc7e7125..3bffa78596 100644 --- a/Kernel/Devices/Audio/AC97.cpp +++ b/Kernel/Devices/Audio/AC97.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include namespace Kernel { diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp index 47d88ef485..9657382a6a 100644 --- a/Kernel/FileSystem/FileSystem.cpp +++ b/Kernel/FileSystem/FileSystem.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp index 34b563907d..27c17bd166 100644 --- a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp +++ b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp index 9d7c1d6aa4..81a3358580 100644 --- a/Kernel/Firmware/ACPI/Parser.cpp +++ b/Kernel/Firmware/ACPI/Parser.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #if ARCH(X86_64) # include #endif diff --git a/Kernel/InterruptDisabler.h b/Kernel/InterruptDisabler.h deleted file mode 100644 index d4e49bb9b4..0000000000 --- a/Kernel/InterruptDisabler.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022, Timon Kruiper - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace Kernel { - -class InterruptDisabler { -public: - InterruptDisabler() - : m_interrupts_were_enabled(Processor::are_interrupts_enabled()) - { - Processor::disable_interrupts(); - } - - ~InterruptDisabler() - { - if (m_interrupts_were_enabled) - Processor::enable_interrupts(); - } - -private: - bool m_interrupts_were_enabled; -}; - -} diff --git a/Kernel/Interrupts/IRQHandler.cpp b/Kernel/Interrupts/IRQHandler.cpp index 8dadec145e..8ea82011a8 100644 --- a/Kernel/Interrupts/IRQHandler.cpp +++ b/Kernel/Interrupts/IRQHandler.cpp @@ -6,8 +6,8 @@ #include #include -#include #include +#include namespace Kernel { diff --git a/Kernel/Interrupts/InterruptDisabler.h b/Kernel/Interrupts/InterruptDisabler.h new file mode 100644 index 0000000000..d4e49bb9b4 --- /dev/null +++ b/Kernel/Interrupts/InterruptDisabler.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022, Timon Kruiper + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Kernel { + +class InterruptDisabler { +public: + InterruptDisabler() + : m_interrupts_were_enabled(Processor::are_interrupts_enabled()) + { + Processor::disable_interrupts(); + } + + ~InterruptDisabler() + { + if (m_interrupts_were_enabled) + Processor::enable_interrupts(); + } + +private: + bool m_interrupts_were_enabled; +}; + +} diff --git a/Kernel/Library/DoubleBuffer.cpp b/Kernel/Library/DoubleBuffer.cpp index b0624acaff..f471c1f9c9 100644 --- a/Kernel/Library/DoubleBuffer.cpp +++ b/Kernel/Library/DoubleBuffer.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include namespace Kernel { diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 1c8c40e4d5..6c1469b84f 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Memory/Region.cpp b/Kernel/Memory/Region.cpp index 373914b0b0..c68a55b5f7 100644 --- a/Kernel/Memory/Region.cpp +++ b/Kernel/Memory/Region.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Memory/ScopedAddressSpaceSwitcher.cpp b/Kernel/Memory/ScopedAddressSpaceSwitcher.cpp index 5abd6b04b5..2bf7465ab5 100644 --- a/Kernel/Memory/ScopedAddressSpaceSwitcher.cpp +++ b/Kernel/Memory/ScopedAddressSpaceSwitcher.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index b8d078087c..452da1a091 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/Kernel/Syscalls/sigaction.cpp b/Kernel/Syscalls/sigaction.cpp index 47dc72f50a..a72d3a0472 100644 --- a/Kernel/Syscalls/sigaction.cpp +++ b/Kernel/Syscalls/sigaction.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include #include namespace Kernel { diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index 2fdba628a5..f4c8652a8b 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index b172a148d7..419a528a28 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/Kernel/Tasks/Process.cpp b/Kernel/Tasks/Process.cpp index fcc74c5b86..ffeb4a0055 100644 --- a/Kernel/Tasks/Process.cpp +++ b/Kernel/Tasks/Process.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #ifdef ENABLE_KERNEL_COVERAGE_COLLECTION diff --git a/Kernel/Tasks/Scheduler.cpp b/Kernel/Tasks/Scheduler.cpp index c5cd5539c0..9bb7821b5c 100644 --- a/Kernel/Tasks/Scheduler.cpp +++ b/Kernel/Tasks/Scheduler.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Tasks/Thread.cpp b/Kernel/Tasks/Thread.cpp index 3dd20af5db..f0a9b6bf6b 100644 --- a/Kernel/Tasks/Thread.cpp +++ b/Kernel/Tasks/Thread.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index 003bc3fca5..24c6869d7e 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3