From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH RFC V2 5/6] xen, libxc: Request page fault injection via libxc Date: Thu, 17 Jul 2014 13:38:53 +0100 Message-ID: <53C7C3DD.7000105@citrix.com> References: <1405093418-23481-1-git-send-email-rcojocaru@bitdefender.com> <1405093418-23481-5-git-send-email-rcojocaru@bitdefender.com> <53C027BF.1090902@citrix.com> <53C7BFEA.8040002@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53C7BFEA.8040002@bitdefender.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Razvan Cojocaru , xen-devel@lists.xen.org Cc: mdontu@bitdefender.com, tim@xen.org, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 17/07/14 13:22, Razvan Cojocaru wrote: > On 07/11/2014 09:06 PM, Andrew Cooper wrote: >> On 11/07/14 16:43, Razvan Cojocaru wrote: >>> + && !ctxt.pending_event >>> + && ctxt.cr3 == d->fault_info.address_space ) >>> + { >>> + /* Cache */ >>> + uint64_t virtual_address = d->fault_info.virtual_address; >>> + uint32_t write_access = d->fault_info.write_access; >>> + >>> + /* Reset */ >>> + d->fault_info.address_space = 0; >>> + d->fault_info.virtual_address = 0; >>> + d->fault_info.write_access = 0; >>> + >>> + hvm_inject_page_fault((write_access << 1) | PFEC_user_mode, >> It is sensible in the slightest to have write_access shifted by 1 with >> respect to a real pagefault error code? > I'm not sure I follow this comment. Could you please elaborate a bit more? > > > Thanks, > Razvan Cojocaru You have a user supplied integer, which you shift left by 1 bit and use as a pagefault error code. If it is supposed to be a boolean for read/write only, then it should be treated as such. If it is expected to be a full error code, then it probably shouldn't be shifted. ~Andrew