From 6249cc9e17105ea79ce92d4f6cce50e2e198fd4f Mon Sep 17 00:00:00 2001 From: "Justin M. LaPre" Date: Wed, 21 Jan 2015 16:08:28 -0500 Subject: [PATCH] Adding padding to BLT for alignment. --- ross/buddy.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ross/buddy.h b/ross/buddy.h index 4e7f15a51..894722c47 100644 --- a/ross/buddy.h +++ b/ross/buddy.h @@ -10,16 +10,21 @@ typedef enum purpose { FREE, USED } purpose_t; +#define BUDDY_ALIGN_PREF (32 - 2 * sizeof(void*) - sizeof(uint32_t) - sizeof(purpose_t)) + /** * Metadata about this particular block * (and stored at the beginning of this block). - * One per allocated block of memory + * One per allocated block of memory. + * Should be 32 bytes to not screw up alignment. */ typedef struct buddy_list { - purpose_t use; - unsigned int size; + // Should be two pointers LIST_ENTRY(buddy_list) next_freelist; + uint32_t size; + purpose_t use; + char padding[BUDDY_ALIGN_PREF]; } buddy_list_t; typedef enum valid { VALID, INVALID } valid_t;