Commit e41e0fc6 authored by Jan Kiszka's avatar Jan Kiszka Committed by Marcelo Tosatti
Browse files

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: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 0c31b744
...@@ -182,20 +182,22 @@ static int altcmp(const char *s, const char *e, const char *altstr) ...@@ -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 /* 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, static bool lookup_feature(uint32_t *pval, const char *s, const char *e,
const char **featureset) const char **featureset)
{ {
uint32_t mask; uint32_t mask;
const char **ppc; 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)) { if (*ppc && !altcmp(s, e, *ppc)) {
*pval |= mask; *pval |= mask;
break; found = true;
} }
return (mask ? 1 : 0); }
return found;
} }
static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features, static void add_flagname_to_bitmaps(const char *flagname, uint32_t *features,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment