[U-Boot-Users] 32 bit alignment

Robert Schwebel robert at schwebel.de
Tue Feb 4 14:50:00 CET 2003


Hi, 

I have a strange problem with the U-Boot network code. This is how some
piece of memory (network buffer) looks like: 

0005 5ddd 81aa 0005 5df6 026c 0800 4510 
014c 0000 0000 1011 de4a d5fc 8fa5 d5fc 
8fa8 0043 0044 0138 76b9 0201 0600 5de8 
                         ^^^^
283b 0000 0000 0000 0000 d5fc 8fa8 d5fc 
8fa5 0000 0000 0005 5ddd 81aa 0000 0000 
0000 0000 0000 0000 0000 0000 0000 0000 

The DHCP payload starts at the marked address, which is not 32 bit
aligned. Now I want to access the 32 bit value at the marked address and
the following one by using a pointer (u32*)bp which points to the marked
address. The result is that I get the value from the address _before_
the marked address (which belongs to the same 32 bit aligned dword).
This makes the whole network code break which assumes that it can lay
arbitrary data structures over the piece of memory. 

Any idea what I'm missing here? 

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4




More information about the U-Boot mailing list