On 05/22/2011 05:10 AM, Max Filippov wrote: > There are three alignment possibilities for xtensa: no unaligned > exception, unaligned exception and hardware alignment. In the first > case unaligned access silently goes to aligned address. It looks like > it cannot be done via do_unaligned_access, can it? In the third case > most unaligned accesses are handled transparently by the hardware. > But e.g. unaligned access by multiprocessor synchronization > instructions still cause alignment exception. Do I need to implement > a different alignment checking mechanism for those unhandled cases?
Case (1), silently going to an aligned address, should be handled inside the translator by masking the address before the load. See the ARM and Alpha targets for examples. Case (2) and (3) are both handled by using ALIGNED_ONLY. All you need to do to handle (3) is *not* throw an exception from the do_unaligned_access function. See how the code is structured inside softmmu_template.h. As for sync insns... You may need to handle it all out-of-line and check for alignment there. r~