Revision 023fe10d target-i386/helper.c

b/target-i386/helper.c
1746 1746
    helper_ret_protected(shift, 0, addend);
1747 1747
}
1748 1748

  
1749
void helper_sysenter(void)
1750
{
1751
    if (env->sysenter_cs == 0) {
1752
        raise_exception_err(EXCP0D_GPF, 0);
1753
    }
1754
    env->eflags &= ~(VM_MASK | IF_MASK | RF_MASK);
1755
    cpu_x86_set_cpl(env, 0);
1756
    cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 
1757
                           NULL, 0xffffffff, 
1758
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
1759
                           DESC_S_MASK |
1760
                           DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
1761
    cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc, 
1762
                           NULL, 0xffffffff,
1763
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
1764
                           DESC_S_MASK |
1765
                           DESC_W_MASK | DESC_A_MASK);
1766
    ESP = env->sysenter_esp;
1767
    EIP = env->sysenter_eip;
1768
}
1769

  
1770
void helper_sysexit(void)
1771
{
1772
    int cpl;
1773

  
1774
    cpl = env->hflags & HF_CPL_MASK;
1775
    if (env->sysenter_cs == 0 || cpl != 0) {
1776
        raise_exception_err(EXCP0D_GPF, 0);
1777
    }
1778
    cpu_x86_set_cpl(env, 3);
1779
    cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3, 
1780
                           NULL, 0xffffffff, 
1781
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
1782
                           DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
1783
                           DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
1784
    cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3, 
1785
                           NULL, 0xffffffff,
1786
                           DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
1787
                           DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
1788
                           DESC_W_MASK | DESC_A_MASK);
1789
    ESP = ECX;
1790
    EIP = EDX;
1791
}
1792

  
1749 1793
void helper_movl_crN_T0(int reg)
1750 1794
{
1751 1795
    switch(reg) {

Also available in: Unified diff