ladybird/Kernel/kmalloc.h
Andreas Kling 1da0a7c949 Give each task its own page directory.
This isn't finished but I'll commit as I go. We need to get to where context
switching only needs to change CR3 and everything's ready to go.

My basic idea is:
- The first 4 kB is off-limits. This catches null dereferences.
- Up to the 4 MB mark is identity-mapped and kernel-only.
- The rest is available to everyone!

While the first 4 MB is only available to the kernel, it's still mapped in
every process, for convenience when entering the kernel.
2018-11-01 09:01:51 +01:00

18 lines
530 B
C

#pragma once
void kmalloc_init();
void *kmalloc(DWORD size) __attribute__ ((malloc));
void* kmalloc_eternal(size_t) __attribute__ ((malloc));
void* kmalloc_page_aligned(size_t) __attribute__ ((malloc));
void kfree(void*);
bool is_kmalloc_address(void*);
extern volatile DWORD sum_alloc;
extern volatile DWORD sum_free;
extern volatile dword kmalloc_sum_eternal;
extern volatile dword kmalloc_sum_page_aligned;
inline void* operator new(size_t, void* p) { return p; }
inline void* operator new[](size_t, void* p) { return p; }