On Thu, 6 Jan 2022 at 11:01, Laurent Vivier <laur...@vivier.eu> wrote:
>
> From: Richard Henderson <richard.hender...@linaro.org>
>
> The first word of page1 is data, so the whole thing
> can't be implemented with emulation of addresses.
> Use init_guest_commpage for the allocation.
>
> Hijack trap number 16 to implement cmpxchg.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> Reviewed-by: Laurent Vivier <laur...@vivier.eu>
> Message-Id: <20211221025012.1057923-5-richard.hender...@linaro.org>
> Signed-off-by: Laurent Vivier <laur...@vivier.eu>
> ---
>  linux-user/elfload.c        | 50 ++++++++++++++++++++++++++++++++++++-
>  linux-user/nios2/cpu_loop.c | 50 ++++++++++++++++++++-----------------
>  target/nios2/translate.c    |  9 -------
>  3 files changed, 76 insertions(+), 33 deletions(-)

Hi; on my local Linux box clang complains about this code:

> @@ -2374,6 +2420,8 @@ static void pgb_static(const char *image_name, 
> abi_ulong orig_loaddr,
>          } else {
>              offset = -(HI_COMMPAGE & -align);
>          }
> +    } else if (LO_COMMPAGE) {
> +        loaddr = MIN(loaddr, LO_COMMPAGE & -align);
>      }
>
>      addr = pgb_find_hole(loaddr, hiaddr - loaddr, align, offset);

../../linux-user/elfload.c:2423:16: error: converting the result of
'<<' to a boolean always evaluates to true
[-Werror,-Wtautological-constant-compare]
    } else if (LO_COMMPAGE) {
               ^
../../linux-user/elfload.c:1102:22: note: expanded from macro 'LO_COMMPAGE'
#define LO_COMMPAGE  TARGET_PAGE_SIZE
                     ^
/mnt/nvmedisk/linaro/qemu-for-merges/include/exec/cpu-all.h:231:31:
note: expanded from macro 'TARGET_PAGE_SIZE'
#define TARGET_PAGE_SIZE   (1 << TARGET_PAGE_BITS)
                              ^
1 error generated.

Using "if (LO_COMMPAGE != 0)" shuts the compiler up.

This is with clang version 10.0.0-4ubuntu1.

-- PMM

Reply via email to