mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
Kernel: Move InterruptDisabler out of Arch directory
The code in this file is not architecture specific, so it can be moved to the base Kernel directory.
This commit is contained in:
parent
8b5b42f667
commit
9827c11d8b
30 changed files with 29 additions and 29 deletions
32
Kernel/InterruptDisabler.h
Normal file
32
Kernel/InterruptDisabler.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Arch/Processor.h>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue