From: Marius Groeger Date: Tue, 4 Feb 2003 15:18:41 +0100 (CET) Subject: [U-Boot-Users] 32 bit alignment In-Reply-To: <20030204135000.GJ25315@pengutronix.de> References: <20030204135000.GJ25315@pengutronix.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 4 Feb 2003, Robert Schwebel wrote: > 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. This is standard behaviour on ARMs, if the alignment exception is configured to be ignored. The EA is internally simply anded with ~3. There are 2 ways to handle this: 1) Implement an alignment exception handler (have fun) 2) Don't access unaligned data. Use byte accesses instead. Regards, Marius ----------------------------------------------------------------------------- Marius Groeger SYSGO Real-Time Solutions AG mgroeger at sysgo.de Software Engineering Embedded and Real-Time Software www.sysgo.de Voice: +49-6136-9948-0 Am Pfaffenstein 14 www.osek.de FAX: +49-6136-9948-10 55270 Klein-Winternheim, Germany www.elinos.com