Kernel: Add kmalloc.cpp to aarch64

This commit is contained in:
James Mintram 2022-04-03 00:06:34 +01:00 committed by Andreas Kling
parent b0f701d053
commit 2b442ae44f
Notes: sideshowbarker 2024-07-17 14:30:17 +09:00
3 changed files with 7 additions and 29 deletions

View file

@ -120,34 +120,9 @@ READONLY_AFTER_INIT u8 multiboot_framebuffer_bpp;
READONLY_AFTER_INIT u8 multiboot_framebuffer_type;
}
// kmalloc.h
size_t kmalloc_good_size(size_t);
size_t kmalloc_good_size(size_t) { return 0; }
void* kcalloc(unsigned long, unsigned long) { return nullptr; }
void kfree_sized(void*, size_t);
void kfree_sized(void*, size_t) { }
void* kmalloc(size_t);
void* kmalloc(size_t) { return nullptr; }
void* operator new(size_t size) { return kmalloc(size); }
void* operator new(size_t size, std::align_val_t) { return kmalloc(size); }
void* operator new(size_t, std::nothrow_t const&) noexcept { return nullptr; }
void* operator new(size_t, std::align_val_t, std::nothrow_t const&) noexcept { return nullptr; }
void* operator new[](size_t) { return (void*)0xdeadbeef; }
void* operator new[](size_t, std::nothrow_t const&) noexcept { return nullptr; }
void operator delete(void*) noexcept { }
void operator delete(void*, size_t) noexcept { }
void operator delete(void*, size_t, std::align_val_t) noexcept { }
void operator delete[](void*) noexcept { }
void operator delete[](void*, size_t) noexcept { }
namespace std {
const nothrow_t nothrow;
// KSyms.cpp
namespace Kernel {
bool g_kernel_symbols_available = false;
}
namespace Kernel {

View file

@ -422,6 +422,8 @@ else()
MiniStdLib.cpp
Prekernel/UBSanitizer.cpp
Heap/kmalloc.cpp
Memory/AddressSpace.cpp
Memory/AnonymousVMObject.cpp
Memory/InodeVMObject.cpp

View file

@ -6,6 +6,7 @@
#include <AK/Assertions.h>
#include <AK/Types.h>
#include <Kernel/Arch/PageDirectory.h>
#include <Kernel/Debug.h>
#include <Kernel/Heap/Heap.h>
#include <Kernel/Heap/kmalloc.h>
@ -327,7 +328,7 @@ struct KmallocGlobalData {
expansion_data->next_virtual_address = expansion_data->next_virtual_address.offset(new_subheap_size);
auto cpu_supports_nx = Processor::current().has_feature(CPUFeature::NX);
auto cpu_supports_nx = Processor::current().has_nx();
SpinlockLocker mm_locker(Memory::s_mm_lock);
SpinlockLocker pd_locker(MM.kernel_page_directory().get_lock());