HELP

Nicolas Pitre nico at cam.org
Thu Jun 7 10:30:17 EDT 2001


On Thu, 7 Jun 2001, Abraham vd Merwe wrote:

> Hi David!
>
> > abraham at 2d3d.co.za said:
> > > mtd_debug: Unaligned memory access at pc=0xca005644, lr=0xc001dc08
> > > (bad address=0xc0135d82, cod) Internal error: alignment exception: 0
> >
> > Enable CONFIG_ALIGNMENT_TRAP.
> >
> > 2.4.4-rmk1 or later will force you to do this before you can enable
> > CONFIG_MTD.
>
> why is this necessary though? The kernel docs make it pretty clear that
> enabling that causes severe performance penalties which I wanted to avoid.

More precisely, _relying_ on it for unaligned access _only_ causes severe
performance penalties.  If you know in advance at compile time that you're
going to make unaligned access to memory then just wrap those with the
get_unaligned()/put_unaligned() macros.  The alignment trap will emulate
unaligned access at run time, with a performance penalty of course, but
still it will work for the rare and unpredictable cases where it might
happen.


Nicolas





More information about the linux-mtd mailing list