summaryrefslogtreecommitdiff
path: root/Kernel/Arch
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-02-26 02:04:05 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-19 15:48:00 +0100
commit9a303cc5a5232d9326465e62220dc7b184a86c0e (patch)
tree75ff19f08c0a49a337a9daae9266f9d96c7d6288 /Kernel/Arch
parent07679e347cbe58aa90ea039013c0f884cf9ee7b2 (diff)
downloadserenity-9a303cc5a5232d9326465e62220dc7b184a86c0e.zip
Kernel: Add the NonMaskableInterruptDisabler class
This class will be used later to disable NMIs when we initialize the RTC timer.
Diffstat (limited to 'Kernel/Arch')
-rw-r--r--Kernel/Arch/i386/CPU.cpp11
-rw-r--r--Kernel/Arch/i386/CPU.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp
index cf4d2259ab..69e4b1db53 100644
--- a/Kernel/Arch/i386/CPU.cpp
+++ b/Kernel/Arch/i386/CPU.cpp
@@ -39,6 +39,7 @@
#include <Kernel/KSyms.h>
#include <Kernel/Process.h>
#include <Kernel/VM/MemoryManager.h>
+#include <LibBareMetal/IO.h>
#include <LibC/mallocdefs.h>
//#define PAGE_FAULT_DEBUG
@@ -833,3 +834,13 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const
;
}
#endif
+
+NonMaskableInterruptDisabler::NonMaskableInterruptDisabler()
+{
+ IO::out8(0x70, IO::in8(0x70) | 0x80);
+}
+
+NonMaskableInterruptDisabler::~NonMaskableInterruptDisabler()
+{
+ IO::out8(0x70, IO::in8(0x70) & 0x7F);
+}
diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h
index 80a08ebd79..87aebc3887 100644
--- a/Kernel/Arch/i386/CPU.h
+++ b/Kernel/Arch/i386/CPU.h
@@ -369,6 +369,12 @@ private:
u32 m_flags;
};
+class NonMaskableInterruptDisabler {
+public:
+ NonMaskableInterruptDisabler();
+ ~NonMaskableInterruptDisabler();
+};
+
/* Map IRQ0-15 @ ISR 0x50-0x5F */
#define IRQ_VECTOR_BASE 0x50