File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com>
3
+ *
4
+ * SPDX-License-Identifier: BSD-2-Clause
5
+ */
6
+
7
+ #include < Kernel/Arch/Processor.h>
8
+
9
+ namespace Kernel {
10
+
11
+ // FIXME: Move the InterruptsState related functions inside the Processor class, when we have a generic Processor base class.
12
+ InterruptsState processor_interrupts_state ()
13
+ {
14
+ return Processor::are_interrupts_enabled () ? InterruptsState::Enabled : InterruptsState::Disabled;
15
+ }
16
+
17
+ void restore_processor_interrupts_state (InterruptsState interrupts_state)
18
+ {
19
+ if (interrupts_state == InterruptsState::Enabled)
20
+ Processor::enable_interrupts ();
21
+ else
22
+ Processor::disable_interrupts ();
23
+ }
24
+
25
+ }
Original file line number Diff line number Diff line change 10
10
#include < AK/Function.h>
11
11
#include < Kernel/Arch/DeferredCallEntry.h>
12
12
13
+ namespace Kernel {
14
+
15
+ // FIXME: Move the InterruptsState enum and related functions inside the Processor class.
16
+ enum class InterruptsState {
17
+ Enabled,
18
+ Disabled
19
+ };
20
+
21
+ InterruptsState processor_interrupts_state ();
22
+ void restore_processor_interrupts_state (InterruptsState);
23
+
24
+ }
25
+
13
26
#if ARCH(X86_64) || ARCH(I386)
14
27
# include < Kernel/Arch/x86/Processor.h>
15
28
#elif ARCH(AARCH64)
Original file line number Diff line number Diff line change @@ -329,6 +329,8 @@ set(KERNEL_SOURCES
329
329
if ("${SERENITY_ARCH} " STREQUAL "i686" OR "${SERENITY_ARCH} " STREQUAL "x86_64" )
330
330
set (KERNEL_SOURCES
331
331
${KERNEL_SOURCES}
332
+ Arch/Processor.cpp
333
+
332
334
Arch/x86/common/ScopedCritical.cpp
333
335
Arch/x86/common/SmapDisabler.cpp
334
336
Arch/x86/common/Spinlock.cpp
@@ -443,6 +445,8 @@ else()
443
445
${AK_SOURCES}
444
446
${RPI_SOURCES}
445
447
448
+ Arch/Processor.cpp
449
+
446
450
Arch/aarch64/boot.S
447
451
Arch/aarch64/BootPPMParser.cpp
448
452
Arch/aarch64/CrashHandler.cpp
You can’t perform that action at this time.
0 commit comments