Subject: Enabling alignment faults
To: None <port-arm@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: port-arm
Date: 10/23/2003 23:05:42
Hi,

While mucking around with a wi(4) card on an xscale board, and falling 
foul of kern/23238, it occurred to me that perhaps we should provide a 
kernel config file option to enable alignment faults.

To that end, I rattled up "options ARM_ENABLE_ALIGNMENT_FAULTS" together 
with the necessary glue in fault.c, and cp15 frobbing (for xscale only 
right now) in cpufuncs.c.

Running a kernel with this enabled immediately showed up a bug in memcmp 
(mea culpa ;-) which I have since fixed. Other than that, both kernel 
and userland are running fine.

There is an old comment in an earlier version of fault.c which alludes 
to gcc taking advantage of misaligned accesses when dealing with short 
ints. I can see how this would be useful on ARM cpus which can't do 
16-bit loads/stores, but is it really relevant for more recent cpus? 
Does gcc still emit such code if the target cpu can do 16-bit ldr/str? 
If not, then perhaps I should enable it by default and change the 
option to ARM_DISABLE_ALIGNMENT_FAULTS...

Comments?

Cheers, Steve