&& (cenv->cpuid_features&(CPUID_MCE|CPUID_MCA)) == (CPUID_MCE|CPUID_MCA)) {
cenv->mcg_cap = MCE_CAP_DEF | MCE_BANKS_DEF;
cenv->mcg_ctl = ~(uint64_t)0;
- bank_num = cenv->mcg_cap & 0xff;
- cenv->mce_banks = qemu_mallocz(bank_num * sizeof(uint64_t) * 4);
+ bank_num = MCE_BANKS_DEF;
for (bank = 0; bank < bank_num; bank++)
cenv->mce_banks[bank*4] = ~(uint64_t)0;
}
if (env->mcg_cap) {
qemu_put_be64s(f, &env->mcg_status);
qemu_put_be64s(f, &env->mcg_ctl);
- for (i = 0; i < (env->mcg_cap & 0xff); i++) {
+ for (i = 0; i < MCE_BANKS_DEF; i++) {
qemu_put_be64s(f, &env->mce_banks[4*i]);
qemu_put_be64s(f, &env->mce_banks[4*i + 1]);
qemu_put_be64s(f, &env->mce_banks[4*i + 2]);
if (env->mcg_cap) {
qemu_get_be64s(f, &env->mcg_status);
qemu_get_be64s(f, &env->mcg_ctl);
- for (i = 0; i < (env->mcg_cap & 0xff); i++) {
+ for (i = 0; i < MCE_BANKS_DEF; i++) {
qemu_get_be64s(f, &env->mce_banks[4*i]);
qemu_get_be64s(f, &env->mce_banks[4*i + 1]);
qemu_get_be64s(f, &env->mce_banks[4*i + 2]);