mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
Kernel: Extract DeferredCallEntry from Arch/Processor.h
This commit is contained in:
parent
235a2b35d6
commit
556b516182
3 changed files with 34 additions and 20 deletions
32
Kernel/Arch/DeferredCallEntry.h
Normal file
32
Kernel/Arch/DeferredCallEntry.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Tom <tomut@yahoo.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/BitCast.h>
|
||||||
|
#include <AK/Function.h>
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
|
||||||
|
struct DeferredCallEntry {
|
||||||
|
using HandlerFunction = Function<void()>;
|
||||||
|
|
||||||
|
DeferredCallEntry* next;
|
||||||
|
alignas(HandlerFunction) u8 handler_storage[sizeof(HandlerFunction)];
|
||||||
|
bool was_allocated;
|
||||||
|
|
||||||
|
HandlerFunction& handler_value()
|
||||||
|
{
|
||||||
|
return *bit_cast<HandlerFunction*>(&handler_storage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void invoke_handler()
|
||||||
|
{
|
||||||
|
handler_value()();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
|
#include <Kernel/Arch/DeferredCallEntry.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -16,8 +17,6 @@ class PageDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProcessorMessageEntry;
|
struct ProcessorMessageEntry;
|
||||||
struct DeferredCallEntry;
|
|
||||||
|
|
||||||
enum class ProcessorSpecificDataID {
|
enum class ProcessorSpecificDataID {
|
||||||
MemoryManager,
|
MemoryManager,
|
||||||
__Count,
|
__Count,
|
||||||
|
@ -62,24 +61,6 @@ struct ProcessorMessageEntry {
|
||||||
ProcessorMessage* msg;
|
ProcessorMessage* msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DeferredCallEntry {
|
|
||||||
using HandlerFunction = Function<void()>;
|
|
||||||
|
|
||||||
DeferredCallEntry* next;
|
|
||||||
alignas(HandlerFunction) u8 handler_storage[sizeof(HandlerFunction)];
|
|
||||||
bool was_allocated;
|
|
||||||
|
|
||||||
HandlerFunction& handler_value()
|
|
||||||
{
|
|
||||||
return *bit_cast<HandlerFunction*>(&handler_storage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void invoke_handler()
|
|
||||||
{
|
|
||||||
handler_value()();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ARCH(X86_64) || ARCH(I386)
|
#if ARCH(X86_64) || ARCH(I386)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
|
||||||
|
#include <Kernel/Arch/DeferredCallEntry.h>
|
||||||
#include <Kernel/Arch/x86/ASM_wrapper.h>
|
#include <Kernel/Arch/x86/ASM_wrapper.h>
|
||||||
#include <Kernel/Arch/x86/CPUID.h>
|
#include <Kernel/Arch/x86/CPUID.h>
|
||||||
#include <Kernel/Arch/x86/DescriptorTable.h>
|
#include <Kernel/Arch/x86/DescriptorTable.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue