[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/9] x86: Allow multiple cpu feature matches of look
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 2/9] x86: Allow multiple cpu feature matches of lookup_feature |
Date: |
Mon, 2 May 2011 15:32:38 -0300 |
From: Jan Kiszka <address@hidden>
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 <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
target-i386/cpuid.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 814d13e..0ac592f 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,
--
1.7.4.4
- [Qemu-devel] [PATCH 0/9] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 9/9] kvm: use qemu_free consistently, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 1/9] kvm: use kernel-provided para_features instead of statically coming up with new capabilities, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 3/9] kvm: add kvmclock to its second bit, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 7/9] kvm: Install specialized interrupt handler, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 8/9] fix crash in migration, 32-bit userspace on 64-bit host, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 2/9] x86: Allow multiple cpu feature matches of lookup_feature,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 6/9] Redirect cpu_interrupt to callback handler, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 4/9] kvm: create kvmclock when one of the flags are present, Marcelo Tosatti, 2011/05/02
- [Qemu-devel] [PATCH 5/9] Break up user and system cpu_interrupt implementations, Marcelo Tosatti, 2011/05/02
- Re: [Qemu-devel] [PATCH 0/9] [PULL] qemu-kvm.git uq/master queue, Anthony Liguori, 2011/05/02