From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH v9 01/13] hvm: Move MAX_INST_LEN into x86_emulate.h Date: Tue, 17 Feb 2015 16:31:35 -0500 Message-ID: <54E3B337.90905@terremark.com> References: <1424127915-27004-1-git-send-email-dslutz@verizon.com> <1424127915-27004-2-git-send-email-dslutz@verizon.com> <54E30F7A.7050607@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54E30F7A.7050607@citrix.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: Andrew Cooper , Don Slutz , xen-devel@lists.xen.org Cc: Kevin Tian , Keir Fraser , Ian Campbell , Stefano Stabellini , Jun Nakajima , Eddie Dong , Ian Jackson , Tim Deegan , George Dunlap , Aravind Gopalakrishnan , Jan Beulich , Boris Ostrovsky , Suravee Suthikulpanit List-Id: xen-devel@lists.xenproject.org On 02/17/15 04:52, Andrew Cooper wrote: > On 16/02/15 23:05, Don Slutz wrote: >> Change some hard coded 15 into MAX_INST_LEN >> >> Signed-off-by: Don Slutz > > One formatting suggestion. > >> --- ... >> diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c >> index f13f07d..42e2588 100644 >> --- a/xen/arch/x86/x86_emulate/x86_emulate.c >> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c >> @@ -579,8 +579,8 @@ do{ asm volatile ( \ >> ({ unsigned long _x = 0, _eip = _regs.eip; \ >> if ( !mode_64bit() ) _eip = (uint32_t)_eip; /* ignore upper dword */ \ >> _regs.eip += (_size); /* real hardware doesn't truncate */ \ >> - generate_exception_if((uint8_t)(_regs.eip - ctxt->regs->eip) > 15, \ >> - EXC_GP, 0); \ >> + generate_exception_if((uint8_t)(_regs.eip - ctxt->regs->eip) > \ >> + MAX_INST_LEN, EXC_GP, 0); \ > > This would probably be better with the uint8_t cast on starting on the > next line, which would avoid the need to put a linebreak in the middle > of the comparison. > If I am parsing this correctly, you feel that: generate_exception_if( \ (uint8_t)(_regs.eip - ctxt->regs->eip) > MAX_INST_LEN, \ EXC_GP, 0); \ rc = ops->insn_fetch(x86_seg_cs, _eip, &_x, (_size), ctxt); \ is the way to go. I will plan to change it this way for v10 unless otherwise notified. -Don Slutz > Reviewed-by: Andrew Cooper >