]> git.proxmox.com Git - qemu.git/commitdiff
temporary interrupt locking fix (need rework)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 3 Feb 2004 23:35:10 +0000 (23:35 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 3 Feb 2004 23:35:10 +0000 (23:35 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@598 c046a42c-6fe2-441c-8c8c-71466251a162

cpu-exec.c
exec-all.h
exec.c

index bd0cbb35e79cef25c5c7fe0814fa57a302bdbbf6..4e2d77f3a8dbb92277cb63ded26afcdc16e4c049 100644 (file)
@@ -142,6 +142,7 @@ int cpu_exec(CPUState *env1)
     /* prepare setjmp context for exception handling */
     for(;;) {
         if (setjmp(env->jmp_env) == 0) {
+            env->current_tb = NULL;
             /* if an exception is pending, we execute it here */
             if (env->exception_index >= 0) {
                 if (env->exception_index >= EXCP_INTERRUPT) {
index 9c7e5ed83f390f2fcf36e887218c7ce9c6eefc0c..407e963281715bc45b6e52711a42b6944eb7f12f 100644 (file)
@@ -85,7 +85,7 @@ int page_unprotect(unsigned long address);
 void tb_invalidate_page_range(target_ulong start, target_ulong end);
 void tlb_flush_page(CPUState *env, uint32_t addr);
 void tlb_flush_page_write(CPUState *env, uint32_t addr);
-void tlb_flush(CPUState *env);
+void tlb_flush(CPUState *env, int flush_global);
 int tlb_set_page(CPUState *env, uint32_t vaddr, uint32_t paddr, int prot, 
                  int is_user, int is_softmmu);
 
diff --git a/exec.c b/exec.c
index 9104efbb1dca536c24911a0b9cf172e221cc72d4..4bf87e37e7d34f49e7ab362c87b870863973505b 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -260,10 +260,6 @@ void tb_flush(CPUState *env)
            nb_tbs, 
            nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0);
 #endif
-    /* must reset current TB so that interrupts cannot modify the
-       links while we are modifying them */
-    env->current_tb = NULL;
-
     nb_tbs = 0;
     for(i = 0;i < CODE_GEN_HASH_SIZE; i++)
         tb_hash[i] = NULL;
@@ -970,13 +966,16 @@ void cpu_set_log_filename(const char *filename)
 void cpu_interrupt(CPUState *env, int mask)
 {
     TranslationBlock *tb;
+    static int interrupt_lock;
     
     env->interrupt_request |= mask;
     /* if the cpu is currently executing code, we must unlink it and
        all the potentially executing TB */
     tb = env->current_tb;
-    if (tb) {
+    if (tb && !testandset(&interrupt_lock)) {
+        env->current_tb = NULL;
         tb_reset_jump_recursive(tb);
+        interrupt_lock = 0;
     }
 }
 
@@ -998,7 +997,9 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
 
 #if !defined(CONFIG_USER_ONLY)
 
-void tlb_flush(CPUState *env)
+/* NOTE: if flush_global is true, also flush global entries (not
+   implemented yet) */
+void tlb_flush(CPUState *env, int flush_global)
 {
     int i;
 
@@ -1293,7 +1294,7 @@ int page_unprotect(unsigned long addr)
 
 #else
 
-void tlb_flush(CPUState *env)
+void tlb_flush(CPUState *env, int flush_global)
 {
 }