mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
Kernel: Make MemoryManager compile on aarch64
This commit is contained in:
parent
6299a69253
commit
d79c772c87
10 changed files with 119 additions and 22 deletions
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Forward.h>
|
||||
|
||||
#include <Kernel/Arch/CPU.h>
|
||||
#include <Kernel/Arch/RegisterState.h>
|
||||
|
||||
|
|
33
Kernel/Arch/aarch64/PageDirectory.cpp
Normal file
33
Kernel/Arch/aarch64/PageDirectory.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2022, James Mintram <me@jamesrm.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Memory/PageDirectory.h>
|
||||
|
||||
namespace Kernel::Memory {
|
||||
|
||||
void PageDirectory::register_page_directory(PageDirectory*)
|
||||
{
|
||||
}
|
||||
|
||||
void PageDirectory::deregister_page_directory(PageDirectory*)
|
||||
{
|
||||
}
|
||||
|
||||
RefPtr<PageDirectory> PageDirectory::find_current()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void activate_kernel_page_directory(PageDirectory const&)
|
||||
{
|
||||
}
|
||||
|
||||
void activate_page_directory(PageDirectory const&, Thread*)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -13,8 +13,14 @@
|
|||
|
||||
#include <Kernel/Arch/ProcessorSpecificDataID.h>
|
||||
|
||||
class VirtualAddress;
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
namespace Memory {
|
||||
class PageDirectory;
|
||||
};
|
||||
|
||||
class Thread;
|
||||
|
||||
// FIXME This needs to go behind some sort of platform abstraction
|
||||
|
@ -41,6 +47,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void flush_tlb_local(VirtualAddress&, size_t&)
|
||||
{
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void flush_tlb(Memory::PageDirectory const*, VirtualAddress const&, size_t)
|
||||
{
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static u32 current_id()
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
namespace Kernel {
|
||||
|
||||
struct RegisterState {
|
||||
FlatPtr userspace_sp() const { return 0; }
|
||||
FlatPtr ip() const { return 0; }
|
||||
};
|
||||
|
||||
struct DebugRegisterState {
|
||||
|
|
50
Kernel/Arch/x86/common/PageDirectory.cpp
Normal file
50
Kernel/Arch/x86/common/PageDirectory.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2022, James Mintram <me@jamesrm.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Singleton.h>
|
||||
|
||||
#include <Kernel/Memory/PageDirectory.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
||||
namespace Kernel::Memory {
|
||||
|
||||
static Singleton<IntrusiveRedBlackTree<&PageDirectory::m_tree_node>> s_cr3_map;
|
||||
|
||||
static IntrusiveRedBlackTree<&PageDirectory::m_tree_node>& cr3_map()
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
return *s_cr3_map;
|
||||
}
|
||||
|
||||
void PageDirectory::register_page_directory(PageDirectory* directory)
|
||||
{
|
||||
cr3_map().insert(directory->cr3(), *directory);
|
||||
}
|
||||
|
||||
void PageDirectory::deregister_page_directory(PageDirectory* directory)
|
||||
{
|
||||
cr3_map().remove(directory->cr3());
|
||||
}
|
||||
|
||||
RefPtr<PageDirectory> PageDirectory::find_current()
|
||||
{
|
||||
SpinlockLocker lock(s_mm_lock);
|
||||
return cr3_map().find(read_cr3());
|
||||
}
|
||||
|
||||
void activate_kernel_page_directory(PageDirectory const& pgd)
|
||||
{
|
||||
write_cr3(pgd.cr3());
|
||||
}
|
||||
|
||||
void activate_page_directory(PageDirectory const& pgd, Thread* current_thread)
|
||||
{
|
||||
current_thread->regs().cr3 = pgd.cr3();
|
||||
write_cr3(pgd.cr3());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue