Commit 83479e770d31e171232a82f4eee7dab06d3b219c

Authored by bellard
1 parent e2f22898

suppressed ring 0 hacks


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@275 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 15 deletions
cpu-exec.c
@@ -29,8 +29,6 @@ @@ -29,8 +29,6 @@
29 29
30 //#define DEBUG_EXEC 30 //#define DEBUG_EXEC
31 //#define DEBUG_SIGNAL 31 //#define DEBUG_SIGNAL
32 -/* enable it to have a fully working x86 emulator for ring 0 */  
33 -//#define RING0_HACKS  
34 32
35 #if defined(TARGET_ARM) 33 #if defined(TARGET_ARM)
36 /* XXX: unify with i386 target */ 34 /* XXX: unify with i386 target */
@@ -157,13 +155,16 @@ int cpu_exec(CPUState *env1) @@ -157,13 +155,16 @@ int cpu_exec(CPUState *env1)
157 /* if user mode only, we simulate a fake exception 155 /* if user mode only, we simulate a fake exception
158 which will be hanlded outside the cpu execution 156 which will be hanlded outside the cpu execution
159 loop */ 157 loop */
  158 +#if defined(TARGET_I386)
160 do_interrupt_user(env->exception_index, 159 do_interrupt_user(env->exception_index,
161 env->exception_is_int, 160 env->exception_is_int,
162 env->error_code, 161 env->error_code,
163 env->exception_next_eip); 162 env->exception_next_eip);
  163 +#endif
164 ret = env->exception_index; 164 ret = env->exception_index;
165 break; 165 break;
166 } else { 166 } else {
  167 +#if defined(TARGET_I386)
167 /* simulate a real cpu exception. On i386, it can 168 /* simulate a real cpu exception. On i386, it can
168 trigger new exceptions, but we do not handle 169 trigger new exceptions, but we do not handle
169 double or triple faults yet. */ 170 double or triple faults yet. */
@@ -171,6 +172,7 @@ int cpu_exec(CPUState *env1) @@ -171,6 +172,7 @@ int cpu_exec(CPUState *env1)
171 env->exception_is_int, 172 env->exception_is_int,
172 env->error_code, 173 env->error_code,
173 env->exception_next_eip); 174 env->exception_next_eip);
  175 +#endif
174 } 176 }
175 env->exception_index = -1; 177 env->exception_index = -1;
176 } 178 }
@@ -294,8 +296,6 @@ int cpu_exec(CPUState *env1) @@ -294,8 +296,6 @@ int cpu_exec(CPUState *env1)
294 T0 = tmp_T0; 296 T0 = tmp_T0;
295 #endif 297 #endif
296 /* see if we can patch the calling TB. XXX: remove TF test */ 298 /* see if we can patch the calling TB. XXX: remove TF test */
297 -#ifndef RING0_HACKS  
298 -  
299 if (T0 != 0 299 if (T0 != 0
300 #if defined(TARGET_I386) 300 #if defined(TARGET_I386)
301 && !(env->eflags & TF_MASK) 301 && !(env->eflags & TF_MASK)
@@ -305,9 +305,8 @@ int cpu_exec(CPUState *env1) @@ -305,9 +305,8 @@ int cpu_exec(CPUState *env1)
305 tb_add_jump((TranslationBlock *)(T0 & ~3), T0 & 3, tb); 305 tb_add_jump((TranslationBlock *)(T0 & ~3), T0 & 3, tb);
306 spin_unlock(&tb_lock); 306 spin_unlock(&tb_lock);
307 } 307 }
308 -#endif  
309 tc_ptr = tb->tc_ptr; 308 tc_ptr = tb->tc_ptr;
310 - 309 + env->current_tb = tb;
311 /* execute the generated code */ 310 /* execute the generated code */
312 gen_func = (void *)tc_ptr; 311 gen_func = (void *)tc_ptr;
313 #if defined(__sparc__) 312 #if defined(__sparc__)
@@ -326,6 +325,7 @@ int cpu_exec(CPUState *env1) @@ -326,6 +325,7 @@ int cpu_exec(CPUState *env1)
326 #else 325 #else
327 gen_func(); 326 gen_func();
328 #endif 327 #endif
  328 + env->current_tb = NULL;
329 } 329 }
330 } else { 330 } else {
331 } 331 }
@@ -381,12 +381,6 @@ int cpu_exec(CPUState *env1) @@ -381,12 +381,6 @@ int cpu_exec(CPUState *env1)
381 return ret; 381 return ret;
382 } 382 }
383 383
384 -void cpu_interrupt(CPUState *s)  
385 -{  
386 - s->interrupt_request = 1;  
387 -}  
388 -  
389 -  
390 #if defined(TARGET_I386) 384 #if defined(TARGET_I386)
391 385
392 void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector) 386 void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector)
@@ -461,9 +455,8 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, @@ -461,9 +455,8 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
461 TranslationBlock *tb; 455 TranslationBlock *tb;
462 int ret; 456 int ret;
463 457
464 -#ifdef RING0_HACKS  
465 - env = global_env; /* XXX: find a better solution */  
466 -#endif 458 + if (cpu_single_env)
  459 + env = cpu_single_env; /* XXX: find a correct solution for multithread */
467 #if defined(DEBUG_SIGNAL) 460 #if defined(DEBUG_SIGNAL)
468 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 461 printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
469 pc, address, is_write, *(unsigned long *)old_set); 462 pc, address, is_write, *(unsigned long *)old_set);