Skip to content

Commit

Permalink
Check for 3DNow! CPUID at translation time
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4184 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
aurel32 committed Apr 9, 2008
1 parent 27985df commit e771eda
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions target-i386/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ typedef struct DisasContext {
int rip_offset; /* only used in x86_64, but left for simplicity */
int cpuid_features;
int cpuid_ext_features;
int cpuid_ext2_features;
} DisasContext;

static void gen_eob(DisasContext *s);
Expand Down Expand Up @@ -2649,8 +2650,15 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
}
if (is_xmm && !(s->flags & HF_OSFXSR_MASK))
goto illegal_op;
if (b == 0x77 || b == 0x0e) {
/* emms or femms */
if (b == 0x0e) {
if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW))
goto illegal_op;
/* femms */
gen_op_emms();
return;
}
if (b == 0x77) {
/* emms */
gen_op_emms();
return;
}
Expand Down Expand Up @@ -3183,6 +3191,8 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
}
switch(b) {
case 0x0f: /* 3DNow! data insns */
if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW))
goto illegal_op;
val = ldub_code(s->pc++);
sse_op2 = sse_op_table5[val];
if (!sse_op2)
Expand Down Expand Up @@ -6757,6 +6767,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
}
dc->cpuid_features = env->cpuid_features;
dc->cpuid_ext_features = env->cpuid_ext_features;
dc->cpuid_ext2_features = env->cpuid_ext2_features;
#ifdef TARGET_X86_64
dc->lma = (flags >> HF_LMA_SHIFT) & 1;
dc->code64 = (flags >> HF_CS64_SHIFT) & 1;
Expand Down

0 comments on commit e771eda

Please sign in to comment.