Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932546AbcL1Anv (ORCPT ); Tue, 27 Dec 2016 19:43:51 -0500 Received: from mga04.intel.com ([192.55.52.120]:62293 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752395AbcL1Anm (ORCPT ); Tue, 27 Dec 2016 19:43:42 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,419,1477983600"; d="scan'208";a="1105027064" Message-ID: <1482885636.106950.30.camel@ranerica-desktop> Subject: Re: [v2 5/7] x86: Add emulation code for UMIP instructions From: Ricardo Neri To: Masami Hiramatsu Cc: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , linux-kernel@vger.kernel.org, x86@kernel.org, linux-msdos@vger.kernel.org, wine-devel@winehq.org, Andrew Morton , "H . Peter Anvin" , Brian Gerst , Chen Yucong , Chris Metcalf , Dave Hansen , Fenghua Yu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S . Tsirkin" , Paul Gortmaker , "Ravi V . Shankar" , Shuah Khan , Vlastimil Babka , Tony Luck , Paolo Bonzini , "Liang Z . Li" , Alexandre Julliard , Stas Sergeev Date: Tue, 27 Dec 2016 16:40:36 -0800 In-Reply-To: <20161226004947.9503af5719927f7c042ca140@kernel.org> References: <20161224013745.108716-1-ricardo.neri-calderon@linux.intel.com> <20161224013745.108716-6-ricardo.neri-calderon@linux.intel.com> <20161226004947.9503af5719927f7c042ca140@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1106 Lines: 44 On Mon, 2016-12-26 at 00:49 +0900, Masami Hiramatsu wrote: > On Fri, 23 Dec 2016 17:37:43 -0800 > Ricardo Neri wrote: > > > +static int __identify_insn(struct insn *insn) > > +{ > > + /* by getting modrm we also get the opcode */ > > + insn_get_modrm(insn); > > + if (insn->opcode.bytes[0] != 0xf) > > + return -EINVAL; > > + > > + if (insn->opcode.bytes[1] == 0x1) { > > + switch (X86_MODRM_REG(insn->modrm.value)) { > > + case 0: > > + return UMIP_SGDT; > > + case 1: > > + return UMIP_SIDT; > > + case 4: > > + return UMIP_SMSW; > > + default: > > + return -EINVAL; > > + } > > + } else if (insn->opcode.bytes[1] == 0x0) { > > + if (X86_MODRM_REG(insn->modrm.value) == 0) > > + return UMIP_SLDT; > > + else if (X86_MODRM_REG(insn->modrm.value) == 1) > > + return UMIP_STR; > > + else > > + return -EINVAL; > > + } > > gcc detected an error here, you may need return "-EINVAL". I will make this change. I removed this EINVAL at the last minute as it didn't look right. It was indeed right. Thanks and BR, Ricardo > > Thanks, > > >