From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbdFSP66 (ORCPT ); Mon, 19 Jun 2017 11:58:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:46139 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753274AbdFSPa3 (ORCPT ); Mon, 19 Jun 2017 11:30:29 -0400 Date: Mon, 19 Jun 2017 17:29:58 +0200 From: Borislav Petkov To: Ricardo Neri Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , Alexandre Julliard , Stas Sergeev , Fenghua Yu , "Ravi V. Shankar" , Shuah Khan , linux-kernel@vger.kernel.org, x86@kernel.org, linux-msdos@vger.kernel.org, wine-devel@winehq.org, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren , Arnaldo Carvalho de Melo , Adrian Hunter , Kees Cook , Thomas Garnier , Dmitry Vyukov Subject: Re: [PATCH v7 10/26] x86/insn-eval: Add utility functions to get segment selector Message-ID: <20170619152958.wgmnmnp75mza7llt@pd.tnic> References: <20170505181724.55000-1-ricardo.neri-calderon@linux.intel.com> <20170505181724.55000-11-ricardo.neri-calderon@linux.intel.com> <20170530103521.fb3wvp4crqapremh@pd.tnic> <1497551871.24288.169.camel@ranerica-desktop> <1497553461.24288.170.camel@ranerica-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1497553461.24288.170.camel@ranerica-desktop> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 15, 2017 at 12:04:21PM -0700, Ricardo Neri wrote: > On Thu, 2017-06-15 at 11:37 -0700, Ricardo Neri wrote: > > > Yuck, didn't we talk about this already? > > > > I am sorry Borislav. I thought you agreed that I could use the values > > of > > the segment override prefixes to identify the segment registers [1]. Yes, I agreed with that but... > This time with the reference: > [1]. https://lkml.org/lkml/2017/5/5/377 ... this says it already: "... but you should call them what they are: "enum seg_override_pfxs" or "enum seg_ovr_pfx" or..." IOW, those are segment *override* prefixes and should be called such and not "enum segment_register" as this way is misleading. IOW, here's what I think you should do: /* Segment override prefixes: */ #define SEG_CS_OVERRIDE 0x23 #define SEG_SS_OVERRIDE 0x36 #define SEG_DS_OVERRIDE 0x3e ... and so on... and use the defines directly. The enum is fine and dandy but then you need to return an error value too so you can just as well have the function return an int simply and make sure you check the retval. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --