Skip to content

Commit

Permalink
Kernel: Add the NonMaskableInterruptDisabler class
Browse files Browse the repository at this point in the history
This class will be used later to disable NMIs when we
initialize the RTC timer.
  • Loading branch information
supercomputer7 authored and awesomekling committed Mar 19, 2020
1 parent 07679e3 commit 9a303cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Kernel/Arch/i386/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
6 changes: 6 additions & 0 deletions Kernel/Arch/i386/CPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ class InterruptDisabler {
u32 m_flags;
};

class NonMaskableInterruptDisabler {
public:
NonMaskableInterruptDisabler();
~NonMaskableInterruptDisabler();
};

/* Map IRQ0-15 @ ISR 0x50-0x5F */
#define IRQ_VECTOR_BASE 0x50

Expand Down

0 comments on commit 9a303cc

Please sign in to comment.