206 |
flags |= (1 << GEN_FLAG_VM_SHIFT); |
flags |= (1 << GEN_FLAG_VM_SHIFT); |
207 |
flags |= (3 << GEN_FLAG_CPL_SHIFT); |
flags |= (3 << GEN_FLAG_CPL_SHIFT); |
208 |
} |
} |
209 |
flags |= (env->eflags & IOPL_MASK) >> (12 - GEN_FLAG_IOPL_SHIFT); |
flags |= (env->eflags & (IOPL_MASK | TF_MASK)); |
|
flags |= (env->eflags & TF_MASK) << (GEN_FLAG_TF_SHIFT - 8); |
|
210 |
cs_base = env->seg_cache[R_CS].base; |
cs_base = env->seg_cache[R_CS].base; |
211 |
pc = cs_base + env->eip; |
pc = cs_base + env->eip; |
|
spin_lock(&tb_lock); |
|
212 |
tb = tb_find(&ptb, (unsigned long)pc, (unsigned long)cs_base, |
tb = tb_find(&ptb, (unsigned long)pc, (unsigned long)cs_base, |
213 |
flags); |
flags); |
214 |
if (!tb) { |
if (!tb) { |
215 |
|
spin_lock(&tb_lock); |
216 |
/* if no translated code available, then translate it now */ |
/* if no translated code available, then translate it now */ |
217 |
tb = tb_alloc((unsigned long)pc); |
tb = tb_alloc((unsigned long)pc); |
218 |
if (!tb) { |
if (!tb) { |
243 |
tb->hash_next = NULL; |
tb->hash_next = NULL; |
244 |
tb_link(tb); |
tb_link(tb); |
245 |
code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); |
code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); |
246 |
|
spin_unlock(&tb_lock); |
247 |
} |
} |
248 |
#ifdef DEBUG_EXEC |
#ifdef DEBUG_EXEC |
249 |
if (loglevel) { |
if (loglevel) { |
252 |
lookup_symbol((void *)tb->pc)); |
lookup_symbol((void *)tb->pc)); |
253 |
} |
} |
254 |
#endif |
#endif |
|
|
|
255 |
/* see if we can patch the calling TB */ |
/* see if we can patch the calling TB */ |
256 |
if (T0 != 0 && !(env->eflags & TF_MASK)) { |
if (T0 != 0 && !(env->eflags & TF_MASK)) { |
257 |
|
spin_lock(&tb_lock); |
258 |
tb_add_jump((TranslationBlock *)(T0 & ~3), T0 & 3, tb); |
tb_add_jump((TranslationBlock *)(T0 & ~3), T0 & 3, tb); |
259 |
|
spin_unlock(&tb_lock); |
260 |
} |
} |
261 |
|
|
262 |
tc_ptr = tb->tc_ptr; |
tc_ptr = tb->tc_ptr; |
|
spin_unlock(&tb_lock); |
|
263 |
|
|
264 |
/* execute the generated code */ |
/* execute the generated code */ |
265 |
gen_func = (void *)tc_ptr; |
gen_func = (void *)tc_ptr; |