diff --git a/target-i386/exec.h b/target-i386/exec.h index 00eee80f9946dc1467865faab15581b89d408223..5529c355241b625ce671072c34ae86c0afb1055e 100644 --- a/target-i386/exec.h +++ b/target-i386/exec.h @@ -199,7 +199,7 @@ void helper_cpuid(void); void helper_enter_level(int level, int data32); void helper_sysenter(void); void helper_sysexit(void); -void helper_syscall(void); +void helper_syscall(int next_eip_addend); void helper_sysret(int dflag); void helper_rdtsc(void); void helper_rdmsr(void); diff --git a/target-i386/helper.c b/target-i386/helper.c index 3ae5b9113eff26182c19713ce843acf8cbb5bc58..64d6f9e7ade4d233a72c1ef83a34566396f8f596 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -934,7 +934,7 @@ static void do_interrupt64(int intno, int is_int, int error_code, env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); } -void helper_syscall(void) +void helper_syscall(int next_eip_addend) { int selector; @@ -943,7 +943,7 @@ void helper_syscall(void) } selector = (env->star >> 32) & 0xffff; if (env->hflags & HF_LMA_MASK) { - ECX = env->eip; + ECX = env->eip + next_eip_addend; env->regs[11] = compute_eflags(); cpu_x86_set_cpl(env, 0); @@ -963,7 +963,7 @@ void helper_syscall(void) else env->eip = env->cstar; } else { - ECX = (uint32_t)env->eip; + ECX = (uint32_t)(env->eip + next_eip_addend); cpu_x86_set_cpl(env, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, @@ -1119,8 +1119,8 @@ void do_interrupt(int intno, int is_int, int error_code, fprintf(logfile, " EAX=" TARGET_FMT_lx, EAX); } fprintf(logfile, "\n"); - cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP); #if 0 + cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP); { int i; uint8_t *ptr; diff --git a/target-i386/op.c b/target-i386/op.c index 1daa551c250d6fd9418c39d768cb0f12fb6260a2..f81d59b16172b3dd6b8bcb4fe59f6c0c49c4753a 100644 --- a/target-i386/op.c +++ b/target-i386/op.c @@ -938,7 +938,7 @@ void OPPROTO op_sysexit(void) #ifdef TARGET_X86_64 void OPPROTO op_syscall(void) { - helper_syscall(); + helper_syscall(PARAM1); } void OPPROTO op_sysret(void) diff --git a/target-i386/translate.c b/target-i386/translate.c index a00ce0426f72c0c4fba038f53b44c4420ac683df..743aff7653083616ac3d296ff73be93fb23d22f2 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -4626,7 +4626,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) s->cc_op = CC_OP_DYNAMIC; } gen_jmp_im(pc_start - s->cs_base); - gen_op_syscall(); + gen_op_syscall(s->pc - pc_start); gen_eob(s); break; case 0x107: /* sysret */