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