Kernel: Move kmalloc() into a Kernel/Heap/ directory

This commit is contained in:
Andreas Kling 2019-09-16 09:01:44 +02:00
parent 6557a31049
commit 1c692e87a6
11 changed files with 14 additions and 16 deletions

View file

@ -11,7 +11,7 @@
#endif #endif
#ifdef KERNEL #ifdef KERNEL
# include <Kernel/kmalloc.h> # include <Kernel/Heap/kmalloc.h>
#else #else
# include <stdlib.h> # include <stdlib.h>

View file

@ -22,7 +22,7 @@
#include <Kernel/Net/UDPSocket.h> #include <Kernel/Net/UDPSocket.h>
#include <Kernel/PCI.h> #include <Kernel/PCI.h>
#include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/MemoryManager.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
#include <LibC/errno_numbers.h> #include <LibC/errno_numbers.h>
enum ProcParentDirectory { enum ProcParentDirectory {

View file

@ -10,7 +10,7 @@
#include <Kernel/Process.h> #include <Kernel/Process.h>
#include <Kernel/Scheduler.h> #include <Kernel/Scheduler.h>
#include <Kernel/StdLib.h> #include <Kernel/StdLib.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
#define SANITIZE_KMALLOC #define SANITIZE_KMALLOC
@ -20,7 +20,7 @@ struct [[gnu::packed]] allocation_t
size_t nchunk; size_t nchunk;
}; };
#define CHUNK_SIZE 32 #define CHUNK_SIZE 8
#define POOL_SIZE (1024 * 1024) #define POOL_SIZE (1024 * 1024)
#define ETERNAL_BASE_PHYSICAL (1 * MB) #define ETERNAL_BASE_PHYSICAL (1 * MB)

View file

@ -2,7 +2,7 @@ include ../Makefile.common
KERNEL_OBJS = \ KERNEL_OBJS = \
init.o \ init.o \
kmalloc.o \ Heap/kmalloc.o \
StdLib.o \ StdLib.o \
Lock.o \ Lock.o \
Arch/i386/CPU.o \ Arch/i386/CPU.o \

View file

@ -5,7 +5,7 @@
#include <Kernel/Net/EthernetFrameHeader.h> #include <Kernel/Net/EthernetFrameHeader.h>
#include <Kernel/Net/NetworkAdapter.h> #include <Kernel/Net/NetworkAdapter.h>
#include <Kernel/StdLib.h> #include <Kernel/StdLib.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
static Lockable<HashTable<NetworkAdapter*>>& all_adapters() static Lockable<HashTable<NetworkAdapter*>>& all_adapters()
{ {

View file

@ -32,7 +32,7 @@
#include <Kernel/Syscall.h> #include <Kernel/Syscall.h>
#include <Kernel/TTY/MasterPTY.h> #include <Kernel/TTY/MasterPTY.h>
#include <Kernel/VM/InodeVMObject.h> #include <Kernel/VM/InodeVMObject.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
#include <LibC/errno_numbers.h> #include <LibC/errno_numbers.h>
#include <LibC/signal_numbers.h> #include <LibC/signal_numbers.h>

View file

@ -1,6 +1,6 @@
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
extern "C" { extern "C" {

View file

@ -1,7 +1,7 @@
#include "VirtualConsole.h" #include "VirtualConsole.h"
#include "IO.h" #include "IO.h"
#include "StdLib.h" #include "StdLib.h"
#include "kmalloc.h" #include <Kernel/Heap/kmalloc.h>
#include <AK/String.h> #include <AK/String.h>
#include <Kernel/Arch/i386/CPU.h> #include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Devices/KeyboardDevice.h> #include <Kernel/Devices/KeyboardDevice.h>

View file

@ -1,6 +1,6 @@
#include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/PhysicalPage.h> #include <Kernel/VM/PhysicalPage.h>
#include <Kernel/kmalloc.h> #include <Kernel/Heap/kmalloc.h>
NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist) NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist)
{ {

View file

@ -3,7 +3,6 @@
#include "Process.h" #include "Process.h"
#include "RTC.h" #include "RTC.h"
#include "Scheduler.h" #include "Scheduler.h"
#include "kmalloc.h"
#include "kstdio.h" #include "kstdio.h"
#include <AK/Types.h> #include <AK/Types.h>
#include <Kernel/Arch/i386/CPU.h> #include <Kernel/Arch/i386/CPU.h>
@ -30,6 +29,7 @@
#include <Kernel/FileSystem/ProcFS.h> #include <Kernel/FileSystem/ProcFS.h>
#include <Kernel/FileSystem/TmpFS.h> #include <Kernel/FileSystem/TmpFS.h>
#include <Kernel/FileSystem/VirtualFileSystem.h> #include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Heap/kmalloc.h>
#include <Kernel/KParams.h> #include <Kernel/KParams.h>
#include <Kernel/Multiboot.h> #include <Kernel/Multiboot.h>
#include <Kernel/Net/E1000NetworkAdapter.h> #include <Kernel/Net/E1000NetworkAdapter.h>
@ -168,7 +168,7 @@ extern "C" [[noreturn]] void init()
// this is only used one time, directly below here. we can't use this part // this is only used one time, directly below here. we can't use this part
// of libc at this point in the boot process, or we'd just pull strstr in // of libc at this point in the boot process, or we'd just pull strstr in
// from <string.h>. // from <string.h>.
auto bad_prefix_check = [](const char *str, const char *search) -> bool { auto bad_prefix_check = [](const char* str, const char* search) -> bool {
while (*search) while (*search)
if (*search++ != *str++) if (*search++ != *str++)
return false; return false;
@ -230,8 +230,7 @@ extern "C" [[noreturn]] void init()
address.slot(), address.slot(),
address.function(), address.function(),
id.vendor_id, id.vendor_id,
id.device_id id.device_id);
);
}); });
if (multiboot_info_ptr->framebuffer_type == 1) { if (multiboot_info_ptr->framebuffer_type == 1) {
@ -239,8 +238,7 @@ extern "C" [[noreturn]] void init()
PhysicalAddress((u32)(multiboot_info_ptr->framebuffer_addr)), PhysicalAddress((u32)(multiboot_info_ptr->framebuffer_addr)),
multiboot_info_ptr->framebuffer_pitch, multiboot_info_ptr->framebuffer_pitch,
multiboot_info_ptr->framebuffer_width, multiboot_info_ptr->framebuffer_width,
multiboot_info_ptr->framebuffer_height multiboot_info_ptr->framebuffer_height);
);
} else { } else {
new BXVGADevice; new BXVGADevice;
} }