Commit d80c7d1c478ae75fd18cf48b5e319cda1f567553

Authored by bellard
1 parent 0499e4a0

64 bit syscall fixes - more logical mwait/monitor ECX test


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2374 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 4 deletions
target-i386/helper.c
... ... @@ -977,7 +977,7 @@ void helper_syscall(int next_eip_addend)
977 977 cpu_x86_set_cpl(env, 0);
978 978 cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
979 979 0, 0xffffffff,
980   - DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
  980 + DESC_G_MASK | DESC_P_MASK |
981 981 DESC_S_MASK |
982 982 DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);
983 983 cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
... ... @@ -1028,7 +1028,7 @@ void helper_sysret(int dflag)
1028 1028 if (dflag == 2) {
1029 1029 cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3,
1030 1030 0, 0xffffffff,
1031   - DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
  1031 + DESC_G_MASK | DESC_P_MASK |
1032 1032 DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
1033 1033 DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
1034 1034 DESC_L_MASK);
... ... @@ -2422,12 +2422,14 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
2422 2422 if ((new_ss & 0xfffc) == 0) {
2423 2423 #ifdef TARGET_X86_64
2424 2424 /* NULL ss is allowed in long mode if cpl != 3*/
  2425 + /* XXX: test CS64 ? */
2425 2426 if ((env->hflags & HF_LMA_MASK) && rpl != 3) {
2426 2427 cpu_x86_load_seg_cache(env, R_SS, new_ss,
2427 2428 0, 0xffffffff,
2428 2429 DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2429 2430 DESC_S_MASK | (rpl << DESC_DPL_SHIFT) |
2430 2431 DESC_W_MASK | DESC_A_MASK);
  2432 + ss_e2 = DESC_B_MASK; /* XXX: should not be needed ? */
2431 2433 } else
2432 2434 #endif
2433 2435 {
... ... @@ -3716,14 +3718,14 @@ void helper_hlt(void)
3716 3718  
3717 3719 void helper_monitor(void)
3718 3720 {
3719   - if (ECX != 0)
  3721 + if ((uint32_t)ECX != 0)
3720 3722 raise_exception(EXCP0D_GPF);
3721 3723 /* XXX: store address ? */
3722 3724 }
3723 3725  
3724 3726 void helper_mwait(void)
3725 3727 {
3726   - if (ECX != 0)
  3728 + if ((uint32_t)ECX != 0)
3727 3729 raise_exception(EXCP0D_GPF);
3728 3730 /* XXX: not complete but not completely erroneous */
3729 3731 if (env->cpu_index != 0 || env->next_cpu != NULL) {
... ...