Commit 0fd14b72ac91516a0415f626d632ffa86f1e1a05
1 parent
7fb843f8
fxsave/fxrstor fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1738 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
2 deletions
target-i386/translate.c
@@ -5803,14 +5803,24 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) | @@ -5803,14 +5803,24 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) | ||
5803 | op = (modrm >> 3) & 7; | 5803 | op = (modrm >> 3) & 7; |
5804 | switch(op) { | 5804 | switch(op) { |
5805 | case 0: /* fxsave */ | 5805 | case 0: /* fxsave */ |
5806 | - if (mod == 3 || !(s->cpuid_features & CPUID_FXSR)) | 5806 | + if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || |
5807 | + (s->flags & HF_EM_MASK)) | ||
5807 | goto illegal_op; | 5808 | goto illegal_op; |
5809 | + if (s->flags & HF_TS_MASK) { | ||
5810 | + gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); | ||
5811 | + break; | ||
5812 | + } | ||
5808 | gen_lea_modrm(s, modrm, ®_addr, &offset_addr); | 5813 | gen_lea_modrm(s, modrm, ®_addr, &offset_addr); |
5809 | gen_op_fxsave_A0((s->dflag == 2)); | 5814 | gen_op_fxsave_A0((s->dflag == 2)); |
5810 | break; | 5815 | break; |
5811 | case 1: /* fxrstor */ | 5816 | case 1: /* fxrstor */ |
5812 | - if (mod == 3 || !(s->cpuid_features & CPUID_FXSR)) | 5817 | + if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || |
5818 | + (s->flags & HF_EM_MASK)) | ||
5813 | goto illegal_op; | 5819 | goto illegal_op; |
5820 | + if (s->flags & HF_TS_MASK) { | ||
5821 | + gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); | ||
5822 | + break; | ||
5823 | + } | ||
5814 | gen_lea_modrm(s, modrm, ®_addr, &offset_addr); | 5824 | gen_lea_modrm(s, modrm, ®_addr, &offset_addr); |
5815 | gen_op_fxrstor_A0((s->dflag == 2)); | 5825 | gen_op_fxrstor_A0((s->dflag == 2)); |
5816 | break; | 5826 | break; |