From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: RE: [PATCH] support protected mode mmio with non-zero CS base Date: Wed, 22 Nov 2006 08:36:20 +0100 Message-ID: <45640C04.76E4.0078.0@novell.com> References: <45633D88.76E4.0078.0@novell.com> <907625E08839C4409CE5768403633E0B018E1746@sefsexmb1.amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <907625E08839C4409CE5768403633E0B018E1746@sefsexmb1.amd.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Mats Petersson Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >> realmode = hvm_realmode(v); >> if ( realmode ) >> - inst_addr = (regs->cs << 4) + regs->eip; >> + inst_addr = regs->cs << 4; >> else >> - inst_addr = regs->eip; >> + inst_addr = hvm_get_segment_base(current, seg_cs); > >Remove the "if ( realmode ) " and just use the segment base address. The >base-address in the register should be correct even in realmod, or the >processor is broken. [I don't think this code is being executed from >vmxassist - if it is, then that's a different special case!]. I intentionally didn't, as at least on VMX the read operation could be significantly slower than a shift (and due to the indirect call it will be slower even on SVM). >Theoretically, you should also check that (eip <= segment.limit), and >issue GP-fault if not true. Again intentionally no: If the original instruction managed to generate a page fault, than it must have been entirely within limits - otherwise hardware would have generated a GP fault. Jan