sparc exception fix (we go up to the shell prompt)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 20 Mar 2005 12:43:29 +0000 (12:43 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 20 Mar 2005 12:43:29 +0000 (12:43 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1343 c046a42c-6fe2-441c-8c8c-71466251a162

exec-all.h
target-sparc/helper.c
target-sparc/translate.c
translate-all.c

index 3065858f3a16162e71d003a2dd3b30faeed41958..1ecb41c55e7b65041b643bef12b513098a9a93d1 100644 (file)
@@ -61,6 +61,7 @@ extern target_ulong gen_opc_pc[OPC_BUF_SIZE];
 extern target_ulong gen_opc_npc[OPC_BUF_SIZE];
 extern uint8_t gen_opc_cc_op[OPC_BUF_SIZE];
 extern uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
+extern target_ulong gen_opc_jump_pc[2];
 
 typedef void (GenOpFunc)(void);
 typedef void (GenOpFunc1)(long);
index e6891ccbb16e86da782f5a1e679c9f9d820213b3..82a3a4ec9059a1bcc491ae6a223f5003dea61256 100644 (file)
@@ -94,7 +94,7 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
             if (tb) {
                 /* the PC is inside the translated code. It means that we have
                    a virtual CPU fault */
-                cpu_restore_state(tb, env, pc, NULL);
+                cpu_restore_state(tb, env, pc, (void *)T2);
             }
         }
         cpu_loop_exit();
index 9f5c2f5c3d1079c53216c50031043ace5da2f5cb..543ed927b6214a253a26b2b9f7d182f151d5e8db 100644 (file)
@@ -1582,6 +1582,8 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb,
             page_dump(logfile);
         }
 #endif
+        gen_opc_jump_pc[0] = dc->jump_pc[0];
+        gen_opc_jump_pc[1] = dc->jump_pc[1];
     } else {
         tb->size = last_pc + 4 - pc_start;
     }
index fd7cc668cfa3ee95359933d37b6753fc5fd2a913..e4f7c9c19eddfa2a84bc1c7022421b1fb1c1e6de 100644 (file)
@@ -52,6 +52,7 @@ uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
 uint8_t gen_opc_cc_op[OPC_BUF_SIZE];
 #elif defined(TARGET_SPARC)
 target_ulong gen_opc_npc[OPC_BUF_SIZE];
+target_ulong gen_opc_jump_pc[2];
 #endif
 
 int code_copy_enabled = 1;
@@ -244,9 +245,23 @@ int cpu_restore_state(TranslationBlock *tb,
 #elif defined(TARGET_ARM)
     env->regs[15] = gen_opc_pc[j];
 #elif defined(TARGET_SPARC)
-    /* XXX: restore npc too */
-    env->pc = gen_opc_pc[j];
-    env->npc = gen_opc_npc[j];
+    {
+        target_ulong npc;
+        env->pc = gen_opc_pc[j];
+        npc = gen_opc_npc[j];
+        if (npc == 1) {
+            /* dynamic NPC: already stored */
+        } else if (npc == 2) {
+            target_ulong t2 = (target_ulong)puc;
+            /* jump PC: use T2 and the jump targets of the translation */
+            if (t2) 
+                env->npc = gen_opc_jump_pc[0];
+            else
+                env->npc = gen_opc_jump_pc[1];
+        } else {
+            env->npc = npc;
+        }
+    }
 #elif defined(TARGET_PPC)
     {
         int type;