summaryrefslogtreecommitdiff
path: root/target-i386/cpuid.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-04-19 13:06:06 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2011-05-02 09:38:35 -0300
commite41e0fc61ae776b9235380fe9570af31ea7bbc86 (patch)
tree5f0b79d045b40305932220b44e4f60a7beac315f /target-i386/cpuid.c
parent0c31b744f606d1c19b698041480eb195b8801747 (diff)
downloadqemu-e41e0fc61ae776b9235380fe9570af31ea7bbc86.zip
x86: Allow multiple cpu feature matches of lookup_feature
kvmclock is represented by two feature bits. Therefore, lookup_feature needs to continue its search even after the first match. Enhance it accordingly and switch to a bool return type at this chance. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/cpuid.c')
-rw-r--r--target-i386/cpuid.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 814d13e767..0ac592f0c1 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -182,20 +182,22 @@ static int altcmp(const char *s, const char *e, const char *altstr)
}
/* search featureset for flag *[s..e), if found set corresponding bit in
- * *pval and return success, otherwise return zero
+ * *pval and return true, otherwise return false
*/
-static int lookup_feature(uint32_t *pval, const char *s, const char *e,
- const char **featureset)
+static bool lookup_feature(uint32_t *pval, const char *s, const char *e,
+ const char **featureset)
{
uint32_t mask;
const char **ppc;
+ bool found = false;
- for (mask = 1, ppc = featureset; mask; mask <<= 1, ++ppc)
+ for (mask = 1, ppc = featureset; mask; mask <<= 1, ++ppc) {
if (*ppc && !altcmp(s, e, *ppc)) {
*pval |= mask;
- break;
+ found = true;
}
- return (mask ? 1 : 0);
+ }
+ return found;
}
static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features,