Commit 02b049df49b3f2709130d4e01838314697a4cdfc
Committed by
Anthony Liguori
1 parent
c6fa82c4
Fix x86 feature modifications for features that set multiple bits
QEMU allows adding or removing cpu features by using the syntax '-cpu +feature' or '-cpu -feature'. Some cpuid features cause more than one bit to be set or cleared; but QEMU stops after just one bit has been modified, causing the feature bits to be inconsistent. Fix by allowing all feature bits corresponding to a given name to be set. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
8 additions
and
5 deletions
target-i386/helper.c
... | ... | @@ -66,28 +66,31 @@ static void add_flagname_to_bitmaps(char *flagname, uint32_t *features, |
66 | 66 | uint32_t *ext3_features) |
67 | 67 | { |
68 | 68 | int i; |
69 | + int found = 0; | |
69 | 70 | |
70 | 71 | for ( i = 0 ; i < 32 ; i++ ) |
71 | 72 | if (feature_name[i] && !strcmp (flagname, feature_name[i])) { |
72 | 73 | *features |= 1 << i; |
73 | - return; | |
74 | + found = 1; | |
74 | 75 | } |
75 | 76 | for ( i = 0 ; i < 32 ; i++ ) |
76 | 77 | if (ext_feature_name[i] && !strcmp (flagname, ext_feature_name[i])) { |
77 | 78 | *ext_features |= 1 << i; |
78 | - return; | |
79 | + found = 1; | |
79 | 80 | } |
80 | 81 | for ( i = 0 ; i < 32 ; i++ ) |
81 | 82 | if (ext2_feature_name[i] && !strcmp (flagname, ext2_feature_name[i])) { |
82 | 83 | *ext2_features |= 1 << i; |
83 | - return; | |
84 | + found = 1; | |
84 | 85 | } |
85 | 86 | for ( i = 0 ; i < 32 ; i++ ) |
86 | 87 | if (ext3_feature_name[i] && !strcmp (flagname, ext3_feature_name[i])) { |
87 | 88 | *ext3_features |= 1 << i; |
88 | - return; | |
89 | + found = 1; | |
89 | 90 | } |
90 | - fprintf(stderr, "CPU feature %s not found\n", flagname); | |
91 | + if (!found) { | |
92 | + fprintf(stderr, "CPU feature %s not found\n", flagname); | |
93 | + } | |
91 | 94 | } |
92 | 95 | |
93 | 96 | typedef struct x86_def_t { | ... | ... |