qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment
Date: Thu, 12 Sep 2013 13:29:58 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8

On 09/12/2013 12:45 PM, Stefan Weil wrote:
> +cat > $TMPC << EOF
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <stdint.h>
> +#include <inttypes.h>
> +static bool call_align_args(uint32_t arg1, uint64_t arg2) {
> +  if (arg2 == 0x000000030000004ULL || arg2 == 0x0000000400000003ULL) {
> +    return true;
> +  } else if (arg2 == 2) {
> +    /* 64 bit host, 64 bit function arguments are not aligned. */
> +  } else if (arg2 == 0x0000000200000003 || arg2 == 0x0000000300000002ULL) {
> +    /* 64 bit function arguments are not aligned. */
> +  } else {
> +    fprintf(stderr, "unexpected 64 bit function argument 0x%016" PRIx64 
> "\n", arg2);
> +  }
> +  return false;
> +}

You will of course be printing that error when run on a 64-bit host.

If you're going to go this way, rather than changing to rely on libffi,
then you'll also need to detect TCG_TARGET_EXTEND_ARGS for 64-bit hosts.

Or perhaps skip that detection and define it always.  It's more likely
to be right than not doing it.  This will break if MIPS64 were added,
but then we'd have to extend tcg_gen_callN for that anyway.


r~



reply via email to

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