[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/hvm: print valid CR4 bits in case of error
Some of the current users of hvm_cr4_guest_valid_bits() to check whether a CR4 value is correct don't print the valid mask, and thus the resulting error messages are not as helpful as they could be. Amend callers to always print the value of hvm_cr4_guest_valid_bits(), and take the opportunity of also adjusting all the users to use the same print formatter. No functional change intended. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- xen/arch/x86/hvm/domain.c | 4 ++-- xen/arch/x86/hvm/hvm.c | 8 ++++---- xen/arch/x86/hvm/svm/svmdebug.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/hvm/domain.c b/xen/arch/x86/hvm/domain.c index deec74fdb4f5..8951230a9f52 100644 --- a/xen/arch/x86/hvm/domain.c +++ b/xen/arch/x86/hvm/domain.c @@ -266,8 +266,8 @@ int arch_set_info_hvm_guest(struct vcpu *v, const vcpu_hvm_context_t *ctx) if ( v->arch.hvm.guest_cr[4] & ~hvm_cr4_guest_valid_bits(d) ) { - gprintk(XENLOG_ERR, "Bad CR4 value: %#016lx\n", - v->arch.hvm.guest_cr[4]); + gprintk(XENLOG_ERR, "Bad CR4 value: %#016lx (valid: %016lx)\n", + v->arch.hvm.guest_cr[4], hvm_cr4_guest_valid_bits(d)); return -EINVAL; } diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 2d6e4bb9c682..f27be2cefc0b 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1018,8 +1018,8 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) if ( ctxt.cr4 & ~hvm_cr4_guest_valid_bits(d) ) { - printk(XENLOG_G_ERR "HVM%d restore: bad CR4 %#" PRIx64 "\n", - d->domain_id, ctxt.cr4); + printk(XENLOG_G_ERR "HVM%d restore: bad CR4 %#016lx (valid: %016lx)\n", + d->domain_id, ctxt.cr4, hvm_cr4_guest_valid_bits(d)); return -EINVAL; } @@ -2461,8 +2461,8 @@ int hvm_set_cr4(unsigned long value, bool may_defer) if ( value & ~hvm_cr4_guest_valid_bits(v->domain) ) { HVM_DBG_LOG(DBG_LEVEL_1, - "Guest attempts to set reserved bit in CR4: %lx", - value); + "Guest attempts to set reserved bit in CR4: %#016lx (valid: %#016lx)", + value, hvm_cr4_guest_valid_bits(v->domain)); return X86EMUL_EXCEPTION; } diff --git a/xen/arch/x86/hvm/svm/svmdebug.c b/xen/arch/x86/hvm/svm/svmdebug.c index 7d6dc9ef47db..df5da29f8fb3 100644 --- a/xen/arch/x86/hvm/svm/svmdebug.c +++ b/xen/arch/x86/hvm/svm/svmdebug.c @@ -124,7 +124,7 @@ bool svm_vmcb_isvalid(const char *from, const struct vmcb_struct *vmcb, valid = hvm_cr4_guest_valid_bits(v->domain); if ( cr4 & ~valid ) - PRINTF("CR4: invalid bits are set (%#"PRIx64", valid: %#"PRIx64")\n", + PRINTF("CR4: invalid bits are set (%#016lx, valid: %#016lx)\n", cr4, valid); if ( vmcb_get_dr6(vmcb) >> 32 ) -- 2.40.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |