Commit e771edab0d9aaa7925dc26aec3e0c6eac27f19c3
1 parent
27985df9
Check for 3DNow! CPUID at translation time
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4184 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
13 additions
and
2 deletions
target-i386/translate.c
... | ... | @@ -100,6 +100,7 @@ typedef struct DisasContext { |
100 | 100 | int rip_offset; /* only used in x86_64, but left for simplicity */ |
101 | 101 | int cpuid_features; |
102 | 102 | int cpuid_ext_features; |
103 | + int cpuid_ext2_features; | |
103 | 104 | } DisasContext; |
104 | 105 | |
105 | 106 | static void gen_eob(DisasContext *s); |
... | ... | @@ -2649,8 +2650,15 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r) |
2649 | 2650 | } |
2650 | 2651 | if (is_xmm && !(s->flags & HF_OSFXSR_MASK)) |
2651 | 2652 | goto illegal_op; |
2652 | - if (b == 0x77 || b == 0x0e) { | |
2653 | - /* emms or femms */ | |
2653 | + if (b == 0x0e) { | |
2654 | + if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) | |
2655 | + goto illegal_op; | |
2656 | + /* femms */ | |
2657 | + gen_op_emms(); | |
2658 | + return; | |
2659 | + } | |
2660 | + if (b == 0x77) { | |
2661 | + /* emms */ | |
2654 | 2662 | gen_op_emms(); |
2655 | 2663 | return; |
2656 | 2664 | } |
... | ... | @@ -3183,6 +3191,8 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r) |
3183 | 3191 | } |
3184 | 3192 | switch(b) { |
3185 | 3193 | case 0x0f: /* 3DNow! data insns */ |
3194 | + if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) | |
3195 | + goto illegal_op; | |
3186 | 3196 | val = ldub_code(s->pc++); |
3187 | 3197 | sse_op2 = sse_op_table5[val]; |
3188 | 3198 | if (!sse_op2) |
... | ... | @@ -6757,6 +6767,7 @@ static inline int gen_intermediate_code_internal(CPUState *env, |
6757 | 6767 | } |
6758 | 6768 | dc->cpuid_features = env->cpuid_features; |
6759 | 6769 | dc->cpuid_ext_features = env->cpuid_ext_features; |
6770 | + dc->cpuid_ext2_features = env->cpuid_ext2_features; | |
6760 | 6771 | #ifdef TARGET_X86_64 |
6761 | 6772 | dc->lma = (flags >> HF_LMA_SHIFT) & 1; |
6762 | 6773 | dc->code64 = (flags >> HF_CS64_SHIFT) & 1; | ... | ... |