qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Crash due to invalid env->current_tb


From: Adam Lackorzynski
Subject: Re: [Qemu-devel] Crash due to invalid env->current_tb
Date: Thu, 1 May 2008 14:02:41 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Wed Apr 30, 2008 at 21:21:40 +0300, Blue Swirl wrote:
> The attached version survives quick tests for both Sparc32 and Sparc64.

Ok, I did not check for 64bit targets. So what about the following,
works for me for arm, x86-32 and x86-64.

Index: cpu-exec.c
===================================================================
--- cpu-exec.c  (revision 4276)
+++ cpu-exec.c  (working copy)
@@ -690,7 +691,22 @@
                fp.ip = tc_ptr;
                fp.gp = code_gen_buffer + 2 * (1 << 20);
                (*(void (*)(void)) &fp)();
+#elif defined(__i386)
+#if (TARGET_LONG_BITS == 32)
+#define CLOBBER ,"edx"
 #else
+#define CLOBBER ,"ebx"
+#endif
+               asm volatile ("push %%ebp\n"
+                             "call *%1\n"
+                             "pop %%ebp\n"
+                             : "=A" (T0)
+                             : "a" (gen_func)
+                             : "ecx", "esi", "edi", "cc" CLOBBER
+                             );
+               T0 &= 0xffffffff;
+#undef CLOBBER
+#else
                 T0 = gen_func();
 #endif
                 env->current_tb = NULL;


For 64bit target T0 is 64bits so "=a" does not work and "=A" is needed.
The strange thing is that I need to throw away the upper 32bits because
otherwise it won't work. gen_func is defined to return just long but T0
is unsigned long long, this seems inconsistent. The 'and' does not
appear in 32bit targets so it does not harm there.



Adam
-- 
Adam                 address@hidden
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




reply via email to

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