Commit ee8b7021da823e11e3c6ea9063ebb2ab50406a3e

Authored by bellard
1 parent 625976da

temporary interrupt locking fix (need rework)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@598 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
@@ -142,6 +142,7 @@ int cpu_exec(CPUState *env1) @@ -142,6 +142,7 @@ int cpu_exec(CPUState *env1)
142 /* prepare setjmp context for exception handling */ 142 /* prepare setjmp context for exception handling */
143 for(;;) { 143 for(;;) {
144 if (setjmp(env->jmp_env) == 0) { 144 if (setjmp(env->jmp_env) == 0) {
  145 + env->current_tb = NULL;
145 /* if an exception is pending, we execute it here */ 146 /* if an exception is pending, we execute it here */
146 if (env->exception_index >= 0) { 147 if (env->exception_index >= 0) {
147 if (env->exception_index >= EXCP_INTERRUPT) { 148 if (env->exception_index >= EXCP_INTERRUPT) {
exec-all.h
@@ -85,7 +85,7 @@ int page_unprotect(unsigned long address); @@ -85,7 +85,7 @@ int page_unprotect(unsigned long address);
85 void tb_invalidate_page_range(target_ulong start, target_ulong end); 85 void tb_invalidate_page_range(target_ulong start, target_ulong end);
86 void tlb_flush_page(CPUState *env, uint32_t addr); 86 void tlb_flush_page(CPUState *env, uint32_t addr);
87 void tlb_flush_page_write(CPUState *env, uint32_t addr); 87 void tlb_flush_page_write(CPUState *env, uint32_t addr);
88 -void tlb_flush(CPUState *env); 88 +void tlb_flush(CPUState *env, int flush_global);
89 int tlb_set_page(CPUState *env, uint32_t vaddr, uint32_t paddr, int prot, 89 int tlb_set_page(CPUState *env, uint32_t vaddr, uint32_t paddr, int prot,
90 int is_user, int is_softmmu); 90 int is_user, int is_softmmu);
91 91
@@ -260,10 +260,6 @@ void tb_flush(CPUState *env) @@ -260,10 +260,6 @@ void tb_flush(CPUState *env)
260 nb_tbs, 260 nb_tbs,
261 nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0); 261 nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0);
262 #endif 262 #endif
263 - /* must reset current TB so that interrupts cannot modify the  
264 - links while we are modifying them */  
265 - env->current_tb = NULL;  
266 -  
267 nb_tbs = 0; 263 nb_tbs = 0;
268 for(i = 0;i < CODE_GEN_HASH_SIZE; i++) 264 for(i = 0;i < CODE_GEN_HASH_SIZE; i++)
269 tb_hash[i] = NULL; 265 tb_hash[i] = NULL;
@@ -970,13 +966,16 @@ void cpu_set_log_filename(const char *filename) @@ -970,13 +966,16 @@ void cpu_set_log_filename(const char *filename)
970 void cpu_interrupt(CPUState *env, int mask) 966 void cpu_interrupt(CPUState *env, int mask)
971 { 967 {
972 TranslationBlock *tb; 968 TranslationBlock *tb;
  969 + static int interrupt_lock;
973 970
974 env->interrupt_request |= mask; 971 env->interrupt_request |= mask;
975 /* if the cpu is currently executing code, we must unlink it and 972 /* if the cpu is currently executing code, we must unlink it and
976 all the potentially executing TB */ 973 all the potentially executing TB */
977 tb = env->current_tb; 974 tb = env->current_tb;
978 - if (tb) { 975 + if (tb && !testandset(&interrupt_lock)) {
  976 + env->current_tb = NULL;
979 tb_reset_jump_recursive(tb); 977 tb_reset_jump_recursive(tb);
  978 + interrupt_lock = 0;
980 } 979 }
981 } 980 }
982 981
@@ -998,7 +997,9 @@ void cpu_abort(CPUState *env, const char *fmt, ...) @@ -998,7 +997,9 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
998 997
999 #if !defined(CONFIG_USER_ONLY) 998 #if !defined(CONFIG_USER_ONLY)
1000 999
1001 -void tlb_flush(CPUState *env) 1000 +/* NOTE: if flush_global is true, also flush global entries (not
  1001 + implemented yet) */
  1002 +void tlb_flush(CPUState *env, int flush_global)
1002 { 1003 {
1003 int i; 1004 int i;
1004 1005
@@ -1293,7 +1294,7 @@ int page_unprotect(unsigned long addr) @@ -1293,7 +1294,7 @@ int page_unprotect(unsigned long addr)
1293 1294
1294 #else 1295 #else
1295 1296
1296 -void tlb_flush(CPUState *env) 1297 +void tlb_flush(CPUState *env, int flush_global)
1297 { 1298 {
1298 } 1299 }
1299 1300