Revision 2436b61a target-i386/op_helper.c

b/target-i386/op_helper.c
2919 2919
    }
2920 2920
    env->eflags &= ~(VM_MASK | IF_MASK | RF_MASK);
2921 2921
    cpu_x86_set_cpl(env, 0);
2922
    cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc,
2923
                           0, 0xffffffff,
2924
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2925
                           DESC_S_MASK |
2926
                           DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
2922

  
2923
#ifdef TARGET_X86_64
2924
    if (env->hflags & HF_LMA_MASK) {
2925
        cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc,
2926
                               0, 0xffffffff,
2927
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2928
                               DESC_S_MASK |
2929
                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);
2930
    } else
2931
#endif
2932
    {
2933
        cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc,
2934
                               0, 0xffffffff,
2935
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2936
                               DESC_S_MASK |
2937
                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
2938
    }
2927 2939
    cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc,
2928 2940
                           0, 0xffffffff,
2929 2941
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
......
2933 2945
    EIP = env->sysenter_eip;
2934 2946
}
2935 2947

  
2936
void helper_sysexit(void)
2948
void helper_sysexit(int dflag)
2937 2949
{
2938 2950
    int cpl;
2939 2951

  
......
2942 2954
        raise_exception_err(EXCP0D_GPF, 0);
2943 2955
    }
2944 2956
    cpu_x86_set_cpl(env, 3);
2945
    cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3,
2946
                           0, 0xffffffff,
2947
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2948
                           DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2949
                           DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
2950
    cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3,
2951
                           0, 0xffffffff,
2952
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2953
                           DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2954
                           DESC_W_MASK | DESC_A_MASK);
2957
#ifdef TARGET_X86_64
2958
    if (dflag == 2) {
2959
        cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 32) & 0xfffc) | 3,
2960
                               0, 0xffffffff,
2961
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2962
                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2963
                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);
2964
        cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 40) & 0xfffc) | 3,
2965
                               0, 0xffffffff,
2966
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2967
                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2968
                               DESC_W_MASK | DESC_A_MASK);
2969
    } else
2970
#endif
2971
    {
2972
        cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3,
2973
                               0, 0xffffffff,
2974
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2975
                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2976
                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
2977
        cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3,
2978
                               0, 0xffffffff,
2979
                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
2980
                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
2981
                               DESC_W_MASK | DESC_A_MASK);
2982
    }
2955 2983
    ESP = ECX;
2956 2984
    EIP = EDX;
2957 2985
#ifdef USE_KQEMU

Also available in: Unified diff