Commit 06c2f5066e298d456e4a6ca24def8a84cc9ed31a

Authored by bellard
1 parent bdfaf503

syscall insn fix


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1199 c046a42c-6fe2-441c-8c8c-71466251a162
target-i386/exec.h
@@ -199,7 +199,7 @@ void helper_cpuid(void); @@ -199,7 +199,7 @@ void helper_cpuid(void);
199 void helper_enter_level(int level, int data32); 199 void helper_enter_level(int level, int data32);
200 void helper_sysenter(void); 200 void helper_sysenter(void);
201 void helper_sysexit(void); 201 void helper_sysexit(void);
202 -void helper_syscall(void); 202 +void helper_syscall(int next_eip_addend);
203 void helper_sysret(int dflag); 203 void helper_sysret(int dflag);
204 void helper_rdtsc(void); 204 void helper_rdtsc(void);
205 void helper_rdmsr(void); 205 void helper_rdmsr(void);
target-i386/helper.c
@@ -934,7 +934,7 @@ static void do_interrupt64(int intno, int is_int, int error_code, @@ -934,7 +934,7 @@ static void do_interrupt64(int intno, int is_int, int error_code,
934 env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); 934 env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK);
935 } 935 }
936 936
937 -void helper_syscall(void) 937 +void helper_syscall(int next_eip_addend)
938 { 938 {
939 int selector; 939 int selector;
940 940
@@ -943,7 +943,7 @@ void helper_syscall(void) @@ -943,7 +943,7 @@ void helper_syscall(void)
943 } 943 }
944 selector = (env->star >> 32) & 0xffff; 944 selector = (env->star >> 32) & 0xffff;
945 if (env->hflags & HF_LMA_MASK) { 945 if (env->hflags & HF_LMA_MASK) {
946 - ECX = env->eip; 946 + ECX = env->eip + next_eip_addend;
947 env->regs[11] = compute_eflags(); 947 env->regs[11] = compute_eflags();
948 948
949 cpu_x86_set_cpl(env, 0); 949 cpu_x86_set_cpl(env, 0);
@@ -963,7 +963,7 @@ void helper_syscall(void) @@ -963,7 +963,7 @@ void helper_syscall(void)
963 else 963 else
964 env->eip = env->cstar; 964 env->eip = env->cstar;
965 } else { 965 } else {
966 - ECX = (uint32_t)env->eip; 966 + ECX = (uint32_t)(env->eip + next_eip_addend);
967 967
968 cpu_x86_set_cpl(env, 0); 968 cpu_x86_set_cpl(env, 0);
969 cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 969 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, @@ -1119,8 +1119,8 @@ void do_interrupt(int intno, int is_int, int error_code,
1119 fprintf(logfile, " EAX=" TARGET_FMT_lx, EAX); 1119 fprintf(logfile, " EAX=" TARGET_FMT_lx, EAX);
1120 } 1120 }
1121 fprintf(logfile, "\n"); 1121 fprintf(logfile, "\n");
1122 - cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);  
1123 #if 0 1122 #if 0
  1123 + cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
1124 { 1124 {
1125 int i; 1125 int i;
1126 uint8_t *ptr; 1126 uint8_t *ptr;
target-i386/op.c
@@ -938,7 +938,7 @@ void OPPROTO op_sysexit(void) @@ -938,7 +938,7 @@ void OPPROTO op_sysexit(void)
938 #ifdef TARGET_X86_64 938 #ifdef TARGET_X86_64
939 void OPPROTO op_syscall(void) 939 void OPPROTO op_syscall(void)
940 { 940 {
941 - helper_syscall(); 941 + helper_syscall(PARAM1);
942 } 942 }
943 943
944 void OPPROTO op_sysret(void) 944 void OPPROTO op_sysret(void)
target-i386/translate.c
@@ -4626,7 +4626,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) @@ -4626,7 +4626,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
4626 s->cc_op = CC_OP_DYNAMIC; 4626 s->cc_op = CC_OP_DYNAMIC;
4627 } 4627 }
4628 gen_jmp_im(pc_start - s->cs_base); 4628 gen_jmp_im(pc_start - s->cs_base);
4629 - gen_op_syscall(); 4629 + gen_op_syscall(s->pc - pc_start);
4630 gen_eob(s); 4630 gen_eob(s);
4631 break; 4631 break;
4632 case 0x107: /* sysret */ 4632 case 0x107: /* sysret */