Index: jtag.c
===================================================================
--- jtag.c	(revision 1201)
+++ jtag.c	(working copy)
@@ -482,6 +482,20 @@
 	offset = (*p_page)->used;
 	(*p_page)->used += size;
 
+	/* This function acts as a memory allocator and must
+	 * follow a few guidelines to ensure that the resulting
+	 * pointer can easily be used for a variety of purposes.
+	 * The most important aspect is to ensure the returned
+	 * pointer is aligned such that it can be cast to any
+	 * host machine type.  malloc() does this already, so
+	 * the first allocation in a page will automatically
+	 * be aligned properly.  To ensure a subsequent
+	 * allocation is also aligned, we add padding to force
+	 * the next allocation to use a word-aligned pointer.
+	 */
+	(*p_page)->used = ((*p_page)->used + sizeof(void *) - 1) &
+		(~(sizeof(void *) - 1));
+
 	t=(u8 *)((*p_page)->address);
 	return t + offset;
 }
