From 556b5161829c7acdc6c1fc7b4dd1893fcfb1ca0b Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Tue, 7 Dec 2021 00:52:54 +0100 Subject: [PATCH] Kernel: Extract DeferredCallEntry from Arch/Processor.h --- Kernel/Arch/DeferredCallEntry.h | 32 ++++++++++++++++++++++++++++++++ Kernel/Arch/Processor.h | 21 +-------------------- Kernel/Arch/x86/Processor.h | 1 + 3 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 Kernel/Arch/DeferredCallEntry.h diff --git a/Kernel/Arch/DeferredCallEntry.h b/Kernel/Arch/DeferredCallEntry.h new file mode 100644 index 00000000000..7c14bf655e1 --- /dev/null +++ b/Kernel/Arch/DeferredCallEntry.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020, Tom + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Kernel { + +struct DeferredCallEntry { + using HandlerFunction = Function; + + DeferredCallEntry* next; + alignas(HandlerFunction) u8 handler_storage[sizeof(HandlerFunction)]; + bool was_allocated; + + HandlerFunction& handler_value() + { + return *bit_cast(&handler_storage); + } + + void invoke_handler() + { + handler_value()(); + } +}; + +} diff --git a/Kernel/Arch/Processor.h b/Kernel/Arch/Processor.h index c7925db4b2a..09ba0440d54 100644 --- a/Kernel/Arch/Processor.h +++ b/Kernel/Arch/Processor.h @@ -8,6 +8,7 @@ #pragma once #include +#include namespace Kernel { @@ -16,8 +17,6 @@ class PageDirectory; } struct ProcessorMessageEntry; -struct DeferredCallEntry; - enum class ProcessorSpecificDataID { MemoryManager, __Count, @@ -62,24 +61,6 @@ struct ProcessorMessageEntry { ProcessorMessage* msg; }; -struct DeferredCallEntry { - using HandlerFunction = Function; - - DeferredCallEntry* next; - alignas(HandlerFunction) u8 handler_storage[sizeof(HandlerFunction)]; - bool was_allocated; - - HandlerFunction& handler_value() - { - return *bit_cast(&handler_storage); - } - - void invoke_handler() - { - handler_value()(); - } -}; - } #if ARCH(X86_64) || ARCH(I386) diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index 9f3c974b6a1..0bfcc03937b 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include