On Fri, May 29, 2009 at 2:02 AM, Marek Lindner lindner_marek@yahoo.de wrote:
On Thursday 28 May 2009 18:40:08 Sven Eckelmann wrote:
Architectures with a special alignment for load and store operations on datatypes bigger than bytes will return a prealigned memory region when calling malloc. When we add our data structure before and after this region we destroy this alignment. To fix this problem we add special regions with "magic" padding data. To be sure that it is big enough for every load/store operation we use the alignment for uintmax_t or a pointer even when the architecture only supports smaller load/store operations.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
@Nathan: Could you let me know if these patches work for you ? If so I'll commit them.
Regards, Marek
I set /proc/cpu/alignment to 4 (raise bus error) and I get a bus error:
Program received signal SIGBUS, Bus error. list_add_tail (new=0x29368, head=0x28819) at list-batman.c:68 68 __list_add( new, head->prev, (struct list_head *)head ); (gdb) l 63 * Insert a new entry before the specified head. 64 * This is useful for implementing queues. 65 */ 66 void list_add_tail( struct list_head *new, struct list_head_first *head ) { 67 68 __list_add( new, head->prev, (struct list_head *)head ); 69 70 head->prev = new; 71 72 }