Re: [U-Boot] Unaligned memory accesses exception

Hi Fernando,
On Wed, Aug 22, 2018 at 5:16 PM, Fernando AE fernando.ae2017@gmail.com wrote:
Hi Bin,
The problem lies in these 2 lines, in the ping_send function:
eth_hdr_size = net_set_ether(net_tx_packet, net_null_ethaddr, PROT_IP); pkt = (uchar *)net_tx_packet + eth_hdr_size;
While net_tx_packet is aligned to 32 bits, eth_hdr_size is 14. As a result 'pkt' is not aligned to 32 bits.
Thanks for the information. I see the alignment issue here.
Further in the code structs like ip_hdr and icmp_hdr (correctly defined with words aligned to 32 bits) will point to 'pkt', generating the exceptions.
Just to highlight, that I'm rather OK with U-Boot having the alignment exception disabled. I'm just wondering if the kernel expects such traps enabled or not, and the performance impact of userspace programs (further developed without alignment in mind).
Like I mentioned in the previous email, did you check how other ARMv7 targets behave? Do they turn off this check? My understanding is that newer ARM targets support unaligned access by default. Added Tom to this loop as he has more ARM experience than me.
Regards, Bin
participants (1)
-
Bin Meng