if ( pfinfo )
{
pfinfo->linear = addr;
- pfinfo->ec = pfec;
+ pfinfo->ec = pfec & ~PFEC_implicit;
}
return HVMCOPY_bad_gva_to_gfn;
}
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
struct p2m_domain *p2m = p2m_get_hostp2m(v->domain);
- if ( c->pending_valid &&
- ((c->pending_type == 1) || (c->pending_type > 6) ||
- (c->pending_reserved != 0)) )
+ if ( c->pending_valid )
{
- gdprintk(XENLOG_ERR, "Invalid pending event %#"PRIx32".\n",
- c->pending_event);
- return -EINVAL;
+ if ( (c->pending_type == 1) || (c->pending_type > 6) ||
+ (c->pending_reserved != 0) )
+ {
+ dprintk(XENLOG_ERR, "%pv: Invalid pending event %#"PRIx32"\n",
+ v, c->pending_event);
+ return -EINVAL;
+ }
+
+ if ( c->pending_error_valid &&
+ c->error_code != (uint16_t)c->error_code )
+ {
+ dprintk(XENLOG_ERR, "%pv: Invalid error code %#"PRIx32"\n",
+ v, c->error_code);
+ return -EINVAL;
+ }
}
if ( !paging_mode_hap(v->domain) )
vmcb->nextrip = (uint32_t)vmcb->nextrip;
}
+ ASSERT(!eventinj.fields.ev ||
+ eventinj.fields.errorcode == (uint16_t)eventinj.fields.errorcode);
vmcb->eventinj = eventinj;
if ( _event.vector == TRAP_page_fault )
{
int rc;
- if ( c->pending_valid &&
- ((c->pending_type == 1) || (c->pending_type > 6) ||
- (c->pending_reserved != 0)) )
+ if ( c->pending_valid )
{
- gdprintk(XENLOG_ERR, "Invalid pending event %#"PRIx32".\n",
- c->pending_event);
- return -EINVAL;
+ if ( (c->pending_type == 1) || (c->pending_type > 6) ||
+ (c->pending_reserved != 0) )
+ {
+ dprintk(XENLOG_ERR, "%pv: Invalid pending event %#"PRIx32"\n",
+ v, c->pending_event);
+ return -EINVAL;
+ }
+
+ if ( c->pending_error_valid &&
+ c->error_code != (uint16_t)c->error_code )
+ {
+ dprintk(XENLOG_ERR, "%pv: Invalid error code %#"PRIx32"\n",
+ v, c->error_code);
+ return -EINVAL;
+ }
}
rc = vmx_restore_cr0_cr3(v, c->cr0, c->cr3);
MASK_INSR(trap, INTR_INFO_VECTOR_MASK);
if ( error_code != X86_EVENT_NO_EC )
{
+ ASSERT(error_code == (uint16_t)error_code);
__vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
intr_fields |= INTR_INFO_DELIVER_CODE_MASK;
}