diff options
author | James Mintram <me@jamesrm.com> | 2021-10-14 00:07:37 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-14 01:23:08 +0100 |
commit | 545ce5b5957df8f21de574e15453a711770262f0 (patch) | |
tree | 2c59bbef8056d9678b46202ec7c085f069bc7e29 /Kernel/Arch/x86 | |
parent | 23676bee1f95ab3d441a44b4601670ab7fcabf0d (diff) | |
download | serenity-545ce5b5957df8f21de574e15453a711770262f0.zip |
Kernel: Add per platform Processor.h headers
The platform independent Processor.h file includes the shared processor
code and includes the specific platform header file.
All references to the Arch/x86/Processor.h file have been replaced with
a reference to Arch/Processor.h.
Diffstat (limited to 'Kernel/Arch/x86')
-rw-r--r-- | Kernel/Arch/x86/Processor.h | 77 | ||||
-rw-r--r-- | Kernel/Arch/x86/ScopedCritical.h | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/ASM_wrapper.cpp | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/Interrupts.cpp | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/Processor.cpp | 6 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/ProcessorInfo.cpp | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/SafeMem.cpp | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/TrapFrame.cpp | 4 | ||||
-rw-r--r-- | Kernel/Arch/x86/i386/Processor.cpp | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/x86_64/Processor.cpp | 2 |
10 files changed, 13 insertions, 88 deletions
diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index a1b6bf97e2..719aa4ebcb 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -21,13 +21,9 @@ namespace Kernel { class ProcessorInfo; +struct ProcessorMessage; struct ProcessorMessageEntry; -enum class ProcessorSpecificDataID { - MemoryManager, - __Count, -}; - #if ARCH(X86_64) # define MSR_FS_BASE 0xc0000100 # define MSR_GS_BASE 0xc0000101 @@ -44,64 +40,6 @@ struct [[gnu::aligned(16)]] FPUState u8 buffer[512]; }; -struct ProcessorMessage { - using CallbackFunction = Function<void()>; - - enum Type { - FlushTlb, - Callback, - }; - Type type; - Atomic<u32> refs; - union { - ProcessorMessage* next; // only valid while in the pool - alignas(CallbackFunction) u8 callback_storage[sizeof(CallbackFunction)]; - struct { - Memory::PageDirectory const* page_directory; - u8* ptr; - size_t page_count; - } flush_tlb; - }; - - volatile bool async; - - ProcessorMessageEntry* per_proc_entries; - - CallbackFunction& callback_value() - { - return *bit_cast<CallbackFunction*>(&callback_storage); - } - - void invoke_callback() - { - VERIFY(type == Type::Callback); - callback_value()(); - } -}; - -struct ProcessorMessageEntry { - ProcessorMessageEntry* next; - 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()(); - } -}; - class Processor; // Note: We only support 64 processors at most at the moment, // so allocate 64 slots of inline capacity in the container. @@ -441,17 +379,4 @@ public: static StringView platform_string(); }; -template<typename T> -class ProcessorSpecific { -public: - static void initialize() - { - Processor::current().set_specific(T::processor_specific_data_id(), new T); - } - static T& get() - { - return *Processor::current().get_specific<T>(); - } -}; - } diff --git a/Kernel/Arch/x86/ScopedCritical.h b/Kernel/Arch/x86/ScopedCritical.h index 3c75490144..5abf896b3f 100644 --- a/Kernel/Arch/x86/ScopedCritical.h +++ b/Kernel/Arch/x86/ScopedCritical.h @@ -8,7 +8,7 @@ #include <AK/Types.h> -#include <Kernel/Arch/x86/Processor.h> +#include <Kernel/Arch/Processor.h> namespace Kernel { diff --git a/Kernel/Arch/x86/common/ASM_wrapper.cpp b/Kernel/Arch/x86/common/ASM_wrapper.cpp index 49f33dd3e8..e19f9dc5d3 100644 --- a/Kernel/Arch/x86/common/ASM_wrapper.cpp +++ b/Kernel/Arch/x86/common/ASM_wrapper.cpp @@ -6,8 +6,8 @@ #include <AK/Types.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/ASM_wrapper.h> -#include <Kernel/Arch/x86/Processor.h> #include <Kernel/Sections.h> namespace Kernel { diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp index 5a4ae7c71f..2dc3d6f200 100644 --- a/Kernel/Arch/x86/common/Interrupts.cpp +++ b/Kernel/Arch/x86/common/Interrupts.cpp @@ -21,8 +21,8 @@ #include <LibC/mallocdefs.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/ISRStubs.h> -#include <Kernel/Arch/x86/Processor.h> #include <Kernel/Arch/x86/RegisterState.h> #include <Kernel/Arch/x86/TrapFrame.h> #include <Kernel/KSyms.h> diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index 4d819a6f80..34d36f3f5a 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -15,18 +15,18 @@ #include <Kernel/StdLib.h> #include <Kernel/Thread.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/CPUID.h> +#include <Kernel/Arch/x86/InterruptDisabler.h> #include <Kernel/Arch/x86/Interrupts.h> #include <Kernel/Arch/x86/MSR.h> -#include <Kernel/Arch/x86/Processor.h> #include <Kernel/Arch/x86/ProcessorInfo.h> #include <Kernel/Arch/x86/SafeMem.h> #include <Kernel/Arch/x86/ScopedCritical.h> #include <Kernel/Arch/x86/TrapFrame.h> -#include <Kernel/Arch/x86/InterruptDisabler.h> -#include <Kernel/Memory/ScopedAddressSpaceSwitcher.h> #include <Kernel/Memory/PageDirectory.h> +#include <Kernel/Memory/ScopedAddressSpaceSwitcher.h> namespace Kernel { diff --git a/Kernel/Arch/x86/common/ProcessorInfo.cpp b/Kernel/Arch/x86/common/ProcessorInfo.cpp index 3cb24ba64e..9fbea93ad7 100644 --- a/Kernel/Arch/x86/common/ProcessorInfo.cpp +++ b/Kernel/Arch/x86/common/ProcessorInfo.cpp @@ -6,8 +6,8 @@ #include <AK/StringBuilder.h> #include <AK/Types.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/CPUID.h> -#include <Kernel/Arch/x86/Processor.h> #include <Kernel/Arch/x86/ProcessorInfo.h> namespace Kernel { diff --git a/Kernel/Arch/x86/common/SafeMem.cpp b/Kernel/Arch/x86/common/SafeMem.cpp index d7100c31d7..01e405a01d 100644 --- a/Kernel/Arch/x86/common/SafeMem.cpp +++ b/Kernel/Arch/x86/common/SafeMem.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <Kernel/Arch/x86/Processor.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/RegisterState.h> #include <Kernel/Arch/x86/SafeMem.h> diff --git a/Kernel/Arch/x86/common/TrapFrame.cpp b/Kernel/Arch/x86/common/TrapFrame.cpp index b591c2513f..9e3054c678 100644 --- a/Kernel/Arch/x86/common/TrapFrame.cpp +++ b/Kernel/Arch/x86/common/TrapFrame.cpp @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <Kernel/Arch/x86/TrapFrame.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/InterruptDisabler.h> -#include <Kernel/Arch/x86/Processor.h> +#include <Kernel/Arch/x86/TrapFrame.h> namespace Kernel { diff --git a/Kernel/Arch/x86/i386/Processor.cpp b/Kernel/Arch/x86/i386/Processor.cpp index 7fcb0aa3ea..71186f360b 100644 --- a/Kernel/Arch/x86/i386/Processor.cpp +++ b/Kernel/Arch/x86/i386/Processor.cpp @@ -5,7 +5,7 @@ */ #include <AK/StdLibExtras.h> -#include <Kernel/Arch/x86/Processor.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/TrapFrame.h> #include <Kernel/Process.h> #include <Kernel/Random.h> diff --git a/Kernel/Arch/x86/x86_64/Processor.cpp b/Kernel/Arch/x86/x86_64/Processor.cpp index 3c77a0e796..38b998581a 100644 --- a/Kernel/Arch/x86/x86_64/Processor.cpp +++ b/Kernel/Arch/x86/x86_64/Processor.cpp @@ -5,7 +5,7 @@ */ #include <AK/StdLibExtras.h> -#include <Kernel/Arch/x86/Processor.h> +#include <Kernel/Arch/Processor.h> #include <Kernel/Arch/x86/TrapFrame.h> #include <Kernel/Panic.h> #include <Kernel/Process.h> |