qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] tcg: Add MO_ALIGN, MO_UNALN


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 3/3] tcg: Add MO_ALIGN, MO_UNALN
Date: Wed, 13 May 2015 22:04:41 +0100

On 13 May 2015 at 20:10, Richard Henderson <address@hidden> 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 <address@hidden>

> 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 <address@hidden>

Are unaligned accesses always slow-path, by the way? Presumably
they must be, or this code wouldn't work...

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]