qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] linux-user exception handling


From: Vince Weaver
Subject: Re: [Qemu-devel] linux-user exception handling
Date: Wed, 27 Aug 2008 12:58:07 -0400 (EDT)

On Mon, 25 Aug 2008, Blue Swirl wrote:

No, register window handling and other exceptions are handled in
linux-user/main.c.

You are right. It can be frustrating tracing through the code trying to find out what is being called when.

In any case, I think I've found a bug with register-window handling.
When using sparc32plus, the "wim" value isn't being updated on a save_window() call. Thus when later a "ta 3" (flush register windows) call happens, the wrong windows get written out to memory.

I've attached some sample code that shows this problem.

The patch below fixes this for me, but it should be looked over carefully because the register window code in qemu is deep magic.

This fix allows the spec2k gcc.scilab and fma3d benchmarks to progress further.

Vince

--- linux-user/main.c.orig      2008-08-27 12:48:52.000000000 -0400
+++ linux-user/main.c   2008-08-27 12:49:41.000000000 -0400
@@ -793,14 +793,12 @@

 static void save_window(CPUSPARCState *env)
 {
-#ifndef TARGET_SPARC64
     unsigned int new_wim;
     new_wim = ((env->wim >> 1) | (env->wim << (env->nwindows - 1))) &
         ((1LL << env->nwindows) - 1);
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     env->wim = new_wim;
-#else
-    save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
+#if defined(TARGET_SPARC64)
     env->cansave++;
     env->canrestore--;
 #endif

Attachment: reg_window.s
Description: Text document

Attachment: reg_window
Description: Binary data


reply via email to

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