mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
6432f3eee8
This commit adds the concept of an InterruptsState to the kernel. This will be used to make the Spinlock code architecture independent. A new Processor.cpp file is added such that we don't have to duplicate the code.
25 lines
674 B
C++
25 lines
674 B
C++
/*
|
|
* Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/Arch/Processor.h>
|
|
|
|
namespace Kernel {
|
|
|
|
// FIXME: Move the InterruptsState related functions inside the Processor class, when we have a generic Processor base class.
|
|
InterruptsState processor_interrupts_state()
|
|
{
|
|
return Processor::are_interrupts_enabled() ? InterruptsState::Enabled : InterruptsState::Disabled;
|
|
}
|
|
|
|
void restore_processor_interrupts_state(InterruptsState interrupts_state)
|
|
{
|
|
if (interrupts_state == InterruptsState::Enabled)
|
|
Processor::enable_interrupts();
|
|
else
|
|
Processor::disable_interrupts();
|
|
}
|
|
|
|
}
|