mm: refactor page allocator
This is hopefully the last time in a while that something in the mm subsystem needs a refactor this large. There are two main changes: - The page frame allocator returns a vm_page_t rather than a virtual address. - Data for the slab allocator is now stored in struct vm_page, which means there is no overhead in the slab itself so the space is used in a more efficient manner.
This commit is contained in:
parent
f8a85a1541
commit
b4ed811920
16 changed files with 369 additions and 344 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <arch/string.h>
|
||||
|
||||
#include <gay/cdefs.h>
|
||||
#include <gay/types.h>
|
||||
|
||||
|
|
@ -71,6 +73,7 @@ void *memcpy(void *__restrict dest, const void *__restrict src, usize n);
|
|||
*/
|
||||
__pure int memcmp(const void *s1, const void *s2, usize n);
|
||||
|
||||
#ifndef __HAVE_ARCH_MEMSET
|
||||
/**
|
||||
* @brief Starting from `ptr`, fill `n` bytes with the constant byte `c`.
|
||||
*
|
||||
|
|
@ -80,6 +83,28 @@ __pure int memcmp(const void *s1, const void *s2, usize n);
|
|||
* @returns A pointer to `ptr`
|
||||
*/
|
||||
void *memset(void *ptr, int c, usize n);
|
||||
#endif
|
||||
|
||||
#if _GAY_SOURCE >= 202109L
|
||||
#ifndef __HAVE_ARCH_MEMSET16
|
||||
void *memset16(u16 *dest, u16 c, usize nbyte);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_MEMSET32
|
||||
void *memset32(u32 *dest, u32 c, usize nbyte);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_MEMSET64
|
||||
void *memset64(u64 *dest, u64 c, usize nbyte);
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#if LONG_BIT == 32
|
||||
#define memsetl memset32
|
||||
#elif LONG_BIT == 64
|
||||
#define memsetl memset64
|
||||
#else
|
||||
#error "Unsupported sizeof(long)"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Copy a memory area.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue