Skip to content

Commit 1837be5

Browse files
author
marek
committed
[batman] Align pointers in hna list elements
Architectures like SuperARM or Xscale needs aligned data for multi-byte operations. GCC can create instructions sequences for packed data, but must know that something will not be aligned. Since list_add will operate on untyped data over void-pointers it cannot know that hna_global_entry is packed and will create only a fast and unsafe version for load and store operations. It is only important for the first 5 bytes of hna_global_entry to be packed we can force these elements to be aligned without changing the relative addresses of the first bytes. Signed-off-by: Sven Eckelmann <[email protected]> git-svn-id: http://downloads.open-mesh.org/svn/batman/trunk/batman@1282 45894c77-fb22-0410-b583-ff6e7d5dbf6c
1 parent 88b2731 commit 1837be5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

batman.h

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153

154154
#define BATMANUNUSED(x) (x)__attribute__((unused))
155155
#define ALIGN_WORD __attribute__ ((aligned(sizeof(TYPE_OF_WORD))))
156+
#define ALIGN_POINTER __attribute__ ((aligned(sizeof(void*))))
156157

157158

158159

hna.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ struct hna_global_entry
5858
{
5959
uint32_t addr;
6060
uint8_t netmask;
61-
struct orig_node *curr_orig_node;
62-
struct list_head_first orig_list;
61+
struct orig_node *curr_orig_node ALIGN_POINTER;
62+
struct list_head_first orig_list ALIGN_POINTER;
6363
} __attribute__((packed));
6464

6565
struct hna_orig_ptr

0 commit comments

Comments
 (0)