qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jin Guojie" <jinguojie@loongson.cn>
To: "Richard Henderson" <rth@twiddle.net>,
	qemu-devel <qemu-devel@nongnu.org>
Cc: "Aurelien Jarno" <aurelien@aurel32.net>,
	"James Hogan" <james.hogan@imgtec.com>
Subject: Re: [Qemu-devel] [PATCH v3 10/11] tcg-mips: Adjust qemu_ld/st for mips64
Date: Mon, 28 Nov 2016 14:59:08 +0800	[thread overview]
Message-ID: <tencent_5CDD612D47CD7A280A6E6BD9@qq.com> (raw)

In Richard's v2 patch (shown as below), the compilation on mips64 host is disabled.

-#define LO_OFF    (MIPS_BE * 4)
-#define HI_OFF    (4 - LO_OFF)
+#if TCG_TARGET_REG_BITS == 32
+# define LO_OFF  (MIPS_BE * 4)
+# define HI_OFF  (4 - LO_OFF)
+#else
+extern int link_error(void);
+# define LO_OFF  link_error()
+# define HI_OFF  link_error()
+#endif

When I compiled this patch on Loongson as mips64el, a link error occured:

  LINK    i386-softmmu/qemu-system-i386
tcg/tcg.o: In function `tcg_out_tlb_load':
tcg-target.inc.c:1252: undefined reference to `link_error'

To pass the compilation, I removed the link_error() and redefined LO_OFF/HI_OFF. 
It works OK on little-endian mips o32/n64 host. I have no big-endian mips machine,
so the bug on big-endian is not discovered.

Frankly speaking, I didn't take n32 into consideration until you pointed out that.
I feel that n32 is rarely used in current and future market. I can not even find an n32 
debian distribution in Aurelien's qemu image collection.
How about leave n32 as a TODO feature?

Jin Guojie

------------------ Original ------------------
From:  "Richard Henderson";<rth@twiddle.net>;
Date:  Nov 25, 2016
To:  "Jin Guojie"<jinguojie@loongson.cn>; "qemu-devel"<qemu-devel@nongnu.org>; 
Cc:  "Aurelien Jarno"<aurelien@aurel32.net>; "James Hogan"<james.hogan@imgtec.com>; 
Subject:  Re: [PATCH v3 10/11] tcg-mips: Adjust qemu_ld/st for mips64



On 11/25/2016 04:31 AM, Jin Guojie wrote:
> -#define LO_OFF    (MIPS_BE * 4)
> -#define HI_OFF    (4 - LO_OFF)
> +# define LO_OFF  (MIPS_BE * sizeof(long))
> +# define HI_OFF  (sizeof(long) - LO_OFF)

For n32, sizeof(long) == 4, and for n64, sizeof(long) == 8.  So in the end this 
change must be wrong for big-endian.

Surely using link_error, as my patch did, to assert at compile-time that these 
values were never used for TCG_TARGET_REGS == 64 is better.


r~

             reply	other threads:[~2016-11-28  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28  6:59 Jin Guojie [this message]
2016-11-28 14:20 ` [Qemu-devel] [PATCH v3 10/11] tcg-mips: Adjust qemu_ld/st for mips64 Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2016-11-25  3:31 [Qemu-devel] [PATCH v3 00/11] tcg mips64 and mips r6 improvements Jin Guojie
2016-11-25  3:31 ` [Qemu-devel] [PATCH v3 10/11] tcg-mips: Adjust qemu_ld/st for mips64 Jin Guojie
2016-11-25 11:55   ` 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=tencent_5CDD612D47CD7A280A6E6BD9@qq.com \
    --to=jinguojie@loongson.cn \
    --cc=aurelien@aurel32.net \
    --cc=james.hogan@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).