42 uintptr_t alignment_mask;
44 area = &information->
areas[ 0 ];
45 end = &information->
areas[ information->
count ];
46 alignment_mask = alignment - 1;
48 while ( area != end ) {
49 uintptr_t alloc_begin;
52 alloc_begin = (uintptr_t) area->
free;
53 alloc_begin += alignment_mask;
54 alloc_begin &= ~alignment_mask;
55 alloc_end = alloc_begin + size;
57 if ( alloc_begin <= alloc_end && alloc_end <= (uintptr_t) area->
end ) {
58 area->
free = (
void *) alloc_end;
60 return (
void *) alloc_begin;
void * free
A pointer to the begin of the free area of the memory area.
The memory area description.
const void * end
A pointer to the end of the memory area.
void * _Memory_Allocate(const Memory_Information *information, uintptr_t size, uintptr_t alignment)
Allocate a memory area from the memory information.