if (!(status & MCi_STATUS_MISCV))
return NULL;
- mc_ext = x86_mcinfo_reserve(mi, sizeof(struct mcinfo_extended));
+ mc_ext = x86_mcinfo_reserve(mi, sizeof(*mc_ext));
if (!mc_ext)
{
mi->flags |= MCINFO_FLAGS_UNCOMPLETE;
return NULL;
}
- memset(mc_ext, 0, sizeof(*mc_ext));
mc_ext->common.type = MC_TYPE_EXTENDED;
mc_ext->common.size = sizeof(*mc_ext);
mc_ext->mc_msrs = 3;
if (!mi)
return NULL;
- rec = x86_mcinfo_reserve(mi, sizeof(struct mcinfo_recovery));
+ rec = x86_mcinfo_reserve(mi, sizeof(*rec));
if (!rec) {
mi->flags |= MCINFO_FLAGS_UNCOMPLETE;
return NULL;
}
- memset(rec, 0, sizeof(struct mcinfo_recovery));
-
rec->common.type = MC_TYPE_RECOVERY;
rec->common.size = sizeof(*rec);
rec->mc_bank = bank;
if (!mi)
return;
- mib = x86_mcinfo_reserve(mi, sizeof(struct mcinfo_bank));
+ mib = x86_mcinfo_reserve(mi, sizeof(*mib));
if (!mib)
{
mi->flags |= MCINFO_FLAGS_UNCOMPLETE;
return;
}
- memset(mib, 0, sizeof (struct mcinfo_bank));
mib->mc_status = mca_rdmsr(MSR_IA32_MCx_STATUS(bank));
mib->common.type = MC_TYPE_BANK;
struct domain *d;
/* Set global information */
- memset(mig, 0, sizeof (struct mcinfo_global));
mig->common.type = MC_TYPE_GLOBAL;
mig->common.size = sizeof (struct mcinfo_global);
status = mca_rdmsr(MSR_IA32_MCG_STATUS);
if ( (mctc = mctelem_reserve(which)) != NULL ) {
mci = mctelem_dataptr(mctc);
mcinfo_clear(mci);
- mig = x86_mcinfo_reserve(mci, sizeof(struct mcinfo_global));
+ mig = x86_mcinfo_reserve(mci, sizeof(*mig));
/* mc_info should at least hold up the global information */
ASSERT(mig);
mca_init_global(mc_flags, mig);
/* there's enough space. add entry. */
x86_mcinfo_nentries(mi)++;
- return mic_index;
+ return memset(mic_index, 0, size);
}
void *x86_mcinfo_add(struct mc_info *mi, void *mcinfo)
!(mig->mc_gstatus & MCG_STATUS_EIPV))
return NULL;
- mc_ext = x86_mcinfo_reserve(mi, sizeof(struct mcinfo_extended));
+ mc_ext = x86_mcinfo_reserve(mi, sizeof(*mc_ext));
if (!mc_ext)
{
mi->flags |= MCINFO_FLAGS_UNCOMPLETE;
}
/* this function will called when CAP(9).MCG_EXT_P = 1 */
- memset(mc_ext, 0, sizeof(*mc_ext));
mc_ext->common.type = MC_TYPE_EXTENDED;
mc_ext->common.size = sizeof(struct mcinfo_extended);