unsigned long require,
unsigned long exclude)
{
- struct resx resx, tmp;
+ struct resx resx;
resx = compute_resx_bits(kvm, r->bit_feat_map, r->bit_feat_map_sz,
require, exclude);
resx.res1 |= r->feat_map.masks->res1;
}
- tmp = compute_resx_bits(kvm, &r->feat_map, 1, require, exclude);
-
- resx.res0 |= tmp.res0;
- resx.res0 |= ~reg_feat_map_bits(&r->feat_map);
- resx.res1 |= tmp.res1;
+ /*
+ * If the register itself was not valid, all the non-RESx bits are
+ * now considered RES0 (this matches the behaviour of registers such
+ * as SCTLR2 and TCR2). Weed out any potential (though unlikely)
+ * overlap with RES1 bits coming from the previous computation.
+ */
+ resx.res0 |= compute_resx_bits(kvm, &r->feat_map, 1, require, exclude).res0;
+ resx.res1 &= ~resx.res0;
return resx;
}