diff --git a/c_os/kernel/allocator/LinkedListAllocator.cc b/c_os/kernel/allocator/LinkedListAllocator.cc index de3c005..cc1d875 100755 --- a/c_os/kernel/allocator/LinkedListAllocator.cc +++ b/c_os/kernel/allocator/LinkedListAllocator.cc @@ -89,7 +89,7 @@ void* LinkedListAllocator::alloc(unsigned int req_size) { } // Round to word borders - unsigned int req_size_diff = (4 - req_size % 4) % 4; + unsigned int req_size_diff = (BASIC_ALIGN - req_size % BASIC_ALIGN) % BASIC_ALIGN; unsigned int rreq_size = req_size + req_size_diff; if (req_size_diff > 0) { kout << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl; diff --git a/c_os/kernel/allocator/LinkedListAllocator.h b/c_os/kernel/allocator/LinkedListAllocator.h index 3d3c4e7..71cd080 100755 --- a/c_os/kernel/allocator/LinkedListAllocator.h +++ b/c_os/kernel/allocator/LinkedListAllocator.h @@ -14,6 +14,9 @@ #include "kernel/Allocator.h" +// TODO: Is it 8 or 4? +#define BASIC_ALIGN 8 + // Format eines freien Blocks, 4 + 4 + 4 Byte typedef struct free_block { bool allocated; // NOTE: I added this to allow easier merging of free blocks: