From 46c49135a0995f2e3a6bbfa4426204f9ef2a9f4c Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 17 Nov 2021 13:58:43 -0500 Subject: [PATCH] kernel: Add aligned_alloc implementation. Needed by default with GCC 11. --- src/system/kernel/slab/allocator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/system/kernel/slab/allocator.cpp b/src/system/kernel/slab/allocator.cpp index 97460b3ce1..3a3d2bfb95 100644 --- a/src/system/kernel/slab/allocator.cpp +++ b/src/system/kernel/slab/allocator.cpp @@ -229,6 +229,16 @@ posix_memalign(void** _pointer, size_t alignment, size_t size) } +void * +aligned_alloc(size_t alignment, size_t size) +{ + if ((size % alignment) != 0) + return NULL; + + return memalign(alignment, size); +} + + void free_etc(void *address, uint32 flags) {