views:

220

answers:

1

ARMv6 introduce a great feature - unaligned memory access, which make some things in code much more simplier and faster. But microsoft gives API for it only in winCE6. And most PDAs now based on WinMobile6 (which is on CE 5.x). And unaligned access is disabled by default :(

I've try to set unaligned flag in CP15 register, but this doesn't work - I have a crash on read unaligned data.

Is it possible to enable unaligned access on WinMobile6?


Edit: I've found the tool, which can enable unaligned access, but I want to on/off it from my code. It's nueAdvancedProcessor.

+1  A: 

There is an unaligned access flag (the U bit in CP15 control register) and also an alignment fault checker (the A bit). Make sure you have the right combination for what you want to do. In particular, if the A bit is set, all of your unaligned accesses will cause a data abort exception, even if you have the U bit on. Check out the ARM docs on that - all available at http://www.arm.com.

In particular, you want Section A2.8.2 "Unaligned data access in ARMv6 systems" in the ARM Architecture Reference Manual. Document number ARM DDI 0100I. It's titled "ARMv5 Architecture Reference Manual", but contains the initial ARMv6 information. I hope this link works: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0100i/index.html

Carl Norum
Thanks for answer! Yes, I'read this dosc, but looks like there is some restrictions on Windows Mobile. Maybe I must run the code from driver or something like it.
zxcat
Absolutely. CP15 registers can be accessed only from priviliged modes. I'm not really familiar with Windows Mobile, but you could try setting these bits in your boot loader or some other early assembly code, and then hope the OS doesn't whack them back for you later on.
Carl Norum