qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] tcg/mips: Bugfix for crash when running prog


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2] tcg/mips: Bugfix for crash when running program with qemu-i386.
Date: Sun, 9 Jul 2017 19:46:57 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/09/2017 07:49 PM, Jiang Biao wrote:
When running a helloworld program with qemu-i386 in linux-user
mode on Loongson 3A3000, it will crash. The reasion is wrong
assigning from base to addr_regl directly. This patch fix the
bug.

Signed-off-by: Jiang Biao <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
  tcg/mips/tcg-target.inc.c | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c
index 8cff9a6..cebca8e 100644
--- a/tcg/mips/tcg-target.inc.c
+++ b/tcg/mips/tcg-target.inc.c
@@ -1539,16 +1539,18 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg 
*args, bool is_64)
                          s->code_ptr, label_ptr);
  #else
      if (TCG_TARGET_REG_BITS > TARGET_LONG_BITS) {
-        tcg_out_ext32u(s, base, addr_regl);
-        addr_regl = base;
+        tcg_out_ext32u(s, TCG_TMP0, addr_regl);
+    } else {
+        tcg_out_mov(s, TCG_TYPE_PTR, TCG_TMP0, addr_regl);
      }

No, this is exactly why the assignment to the addr_regl variable exists, so that you do not need to emit an extra instruction for a 64-bit guest.


r~



reply via email to

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