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";<r...@twiddle.net>; Date: Nov 25, 2016 To: "Jin Guojie"<jinguo...@loongson.cn>; "qemu-devel"<qemu-devel@nongnu.org>; Cc: "Aurelien Jarno"<aurel...@aurel32.net>; "James Hogan"<james.ho...@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~