[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "Unaligned access" on Alpha



Kelledin <kelledin+DAXP@skarpsey.dyndns.org> writes:

> Lately I've been looking closely at the compile logs on my EV56 
> box, and I've noticed a particular gcc warning occurring 
> frequently:
> 
>     cast increases required alignment of target type.
> 
> This worries me almost as much as casts between integers and 
> pointers of different size, but...even with all the warnings, I 
> don't get too many crashes.

Well, not surprising, since this will only lead to a problem if a) the
pointer is actually dereferenced and b) the alignment is actually
wrong. Often this cannot occur and the warning is bogus.

> Still, I'm compelled to wonder about the effect of unaligned
> accesses, i.e. how severe is an unaligned access in user-space?  How
> about in kernel-space?  How does the system handle them?

A trap to PALcode occurs and the firmware hands over to the operating
system. The OS emulates the access and resumes the program. Takes
probably about 100-200 cycles.

> I have a pretty clear idea what it would take to fix that warning
> condition, but it occurs so frequently that I'm not sure it would be
> worth the time. :/

I don't think so, unless you actually see unaligned accesses in the
syslog.

-- 
	Falk



Reply to: