File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 11/**
22 * DreamShell ISO Loader
33 * Memory allocation
4- * (c)2022-2023 SWAT <http://www.dc-swat.ru>
4+ * (c)2022-2025 SWAT <http://www.dc-swat.ru>
55 */
66
77#ifndef __MALLOC_H
@@ -19,6 +19,7 @@ uint32 malloc_heap_pos();
1919void * malloc (uint32 size );
2020void free (void * data );
2121void * realloc (void * data , uint32 size );
22+ void * aligned_alloc (size_t alignment , size_t size );
2223
2324__END_DECLS
2425
Original file line number Diff line number Diff line change 11/**
22 * DreamShell ISO Loader
33 * Memory allocation
4- * (c)2022-2024 SWAT <http://www.dc-swat.ru>
4+ * (c)2022-2025 SWAT <http://www.dc-swat.ru>
55 */
66
77#include <main.h>
@@ -386,3 +386,13 @@ void *realloc(void *data, uint32 size) {
386386 return internal_realloc (data , size );
387387 }
388388}
389+
390+ // FIXME: This is a hack to get aligned memory.
391+ void * aligned_alloc (size_t alignment , size_t size ) {
392+ void * ptr = malloc (size + alignment );
393+ if (ptr ) {
394+ void * aligned_ptr = (void * )(((uintptr_t )ptr + alignment - 1 ) & ~(alignment - 1 ));
395+ return aligned_ptr ;
396+ }
397+ return NULL ;
398+ }
You can’t perform that action at this time.
0 commit comments