On 13 May 2015 at 20:10, Richard Henderson <[email protected]> wrote:
> These modifiers control, on a per-memory-op basis, whether
> unaligned memory accesses are allowed. The default setting
> reflects the target's definition of ALIGNED_ONLY.
>
> Signed-off-by: Richard Henderson <[email protected]>
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index f9fb380..ff5bd8a 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -241,6 +241,15 @@ typedef enum TCGMemOp {
> MO_TE = MO_LE,
> #endif
>
> + MO_AMASK = 16, /* Target reverse "align-ness". */
> +#ifdef ALIGNED_ONLY
> + MO_ALIGN = 0,
> + MO_UNALN = MO_AMASK,
> +#else
> + MO_ALIGN = MO_AMASK,
> + MO_UNALN = 0,
> +#endif
I feel like the semantics could use a little clarification here.
Something like:
MO_ALIGN = ... /* Accesses must be aligned (or CPU
do_unaligned_access hook is called) */
MO_UNALN = ... /* Unaligned accesses are permitted */
or put something similar in a block comment before the ifdef:
/* MO_UNALN accesses are never checked for alignment; MO_ALIGN
* accesses will result in a call to the CPU's do_unaligned_access
* hook if the guest address is not aligned. The default depends
* on whether the target CPU defines ALIGNED_ONLY.
*/
Otherwise
Reviewed-by: Peter Maydell <[email protected]>
Are unaligned accesses always slow-path, by the way? Presumably
they must be, or this code wouldn't work...
thanks
-- PMM