qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Stefan Weil <sw@weilnetz.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] tci: Detect function argument alignment
Date: Thu, 12 Sep 2013 13:29:58 -0700	[thread overview]
Message-ID: <52322446.9000401@twiddle.net> (raw)
In-Reply-To: <1379015124-21055-1-git-send-email-sw@weilnetz.de>

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	other threads:[~2013-09-12 20:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 19:45 [Qemu-devel] [PATCH] tci: Detect function argument alignment Stefan Weil
2013-09-12 20:29 ` Richard Henderson [this message]
2013-09-12 20:40   ` Stefan Weil
2013-09-12 21:04     ` Richard Henderson
2013-09-12 20:35 ` Peter Maydell
2013-09-14  7:18   ` Stefan Weil
2013-09-14  9:51     ` Peter Maydell
2013-09-14 20:34       ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52322446.9000401@twiddle.net \
    --to=rth@twiddle.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).