mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:17:45 +00:00
Kernel: Pull apart CPU.h
This does not add any functional changes
This commit is contained in:
parent
37253ebcae
commit
7ca3d413f7
86 changed files with 3866 additions and 3493 deletions
48
Kernel/Arch/x86/InterruptDisabler.h
Normal file
48
Kernel/Arch/x86/InterruptDisabler.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
#include <Kernel/Arch/x86/ASM_wrapper.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class InterruptDisabler {
|
||||
public:
|
||||
InterruptDisabler()
|
||||
{
|
||||
m_flags = cpu_flags();
|
||||
cli();
|
||||
}
|
||||
|
||||
~InterruptDisabler()
|
||||
{
|
||||
if (m_flags & 0x200)
|
||||
sti();
|
||||
}
|
||||
|
||||
private:
|
||||
u32 m_flags;
|
||||
};
|
||||
|
||||
class NonMaskableInterruptDisabler {
|
||||
public:
|
||||
NonMaskableInterruptDisabler()
|
||||
{
|
||||
IO::out8(0x70, IO::in8(0x70) | 0x80);
|
||||
}
|
||||
|
||||
~NonMaskableInterruptDisabler()
|
||||
{
|
||||
IO::out8(0x70, IO::in8(0x70) & 0x7F);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue