1

add macro for word alignment setting

This commit is contained in:
churl
2022-05-09 18:24:51 +02:00
parent d1fd879eb6
commit 15515269a1
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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: