[ipxe-devel] [PATCH 1/1] [arm] add -mno-unaligned-access compiler flag

Michael Brown mcb30 at ipxe.org
Wed Apr 18 23:33:10 UTC 2018


On 18/04/18 20:21, Heinrich Schuchardt wrote:
> the unaligned access problem with iPXE is still haunting me. Even with
> SCTLR.A = 0 not all forms of unaligned access are allowable. When trying
> to run iPXE on another board I experienced the following data abort:
> 
> static int tcp_rx ( struct io_buffer *iobuf,
>                      struct net_device *netdev __unused,
>                      struct sockaddr_tcpip *st_src,
>                      struct sockaddr_tcpip *st_dest __unused,
>                      uint16_t pshdr_csum ) {
> 
> ldr     r5, [r0, #12] /* Here a value from iobuf is copied */
> ...
> ldrd    r6, r3, [r5, #4] /* Here the data abort occurs */
> 
> r5 : 7ceba822 /* This value is only halfword aligned */
> 
> All forms of LDM and STM, LDRD, RFE, SRS, STRD, SWP must be word aligned
> even if bit SCTLR.A = 0.
> See ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition

The fact that gcc is generating these instructions suggests that gcc 
believes that the instructions should be legal despite the lack of 
alignment guarantees.  This suggests that there should be some CPU/MMU 
configuration in which the instructions would work.

Mark: any suggestions?

Thanks,

Michael



More information about the ipxe-devel mailing list