[Top][All Lists]
[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: |
Wed, 30 Apr 2008 17:21:02 +0200 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
On Wed Apr 30, 2008 at 17:11:32 +0200, Adam Lackorzynski wrote:
> On Wed Apr 30, 2008 at 11:08:46 +0200, Alexander Graf wrote:
> > There was a comment from Fabrice on how to do prologues in TCG to save /
> > restore the clobbered values. Btw, ebx gets clobbered as well.
>
> tcg/README says that some registers are clobbered. So something like
> this should be safe:
>
> Index: cpu-exec.c
> ===================================================================
> --- cpu-exec.c (revision 4276)
> +++ cpu-exec.c (working copy)
> @@ -690,6 +691,15 @@
> fp.ip = tc_ptr;
> fp.gp = code_gen_buffer + 2 * (1 << 20);
> (*(void (*)(void)) &fp)();
> +#elif defined(__i386)
> + asm volatile ("push %%ebp\n"
> + "push %%ebx\n"
> + "call *%1\n"
> + "pop %%ebx\n"
> + "pop %%ebp\n"
> + : "=a" (T0)
> + : "r" (gen_func)
> + : "esi", "edi", "ecx", "edx");
> #else
> T0 = gen_func();
> #endif
I just realised that the push and pop of ebx is not needed as T0 is ebx
which gets overwritten in the output anyway.
Index: cpu-exec.c
===================================================================
--- cpu-exec.c (revision 4276)
+++ cpu-exec.c (working copy)
@@ -690,6 +691,13 @@
fp.ip = tc_ptr;
fp.gp = code_gen_buffer + 2 * (1 << 20);
(*(void (*)(void)) &fp)();
+#elif defined(__i386)
+ asm volatile ("push %%ebp\n"
+ "call *%1\n"
+ "pop %%ebp\n"
+ : "=a" (T0)
+ : "r" (gen_func)
+ : "esi", "edi", "ecx", "edx");
#else
T0 = gen_func();
#endif
Adam
--
Adam address@hidden
Lackorzynski http://os.inf.tu-dresden.de/~adam/
- [Qemu-devel] Crash due to invalid env->current_tb, Adam Lackorzynski, 2008/04/29
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Blue Swirl, 2008/04/29
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Adam Lackorzynski, 2008/04/29
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Alexander Graf, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Adam Lackorzynski, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb,
Adam Lackorzynski <=
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Blue Swirl, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Alexander Graf, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Blue Swirl, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Laurent Vivier, 2008/04/30
- Re: [Qemu-devel] Crash due to invalid env->current_tb, Adam Lackorzynski, 2008/04/30