Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754849AbdD0Bb0 (ORCPT ); Wed, 26 Apr 2017 21:31:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:45425 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754828AbdD0BbT (ORCPT ); Wed, 26 Apr 2017 21:31:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,256,1488873600"; d="scan'208";a="1140653392" Message-ID: <1493256677.36058.84.camel@ranerica-desktop> Subject: Re: [v6 PATCH 11/21] insn/eval: Incorporate segment base in address computation From: Ricardo Neri To: Borislav Petkov 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 Date: Wed, 26 Apr 2017 18:31:17 -0700 In-Reply-To: <20170421145533.fg32dcf2af7mksxa@pd.tnic> References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <20170308003254.27833-12-ricardo.neri-calderon@linux.intel.com> <20170421145533.fg32dcf2af7mksxa@pd.tnic> 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: 1281 Lines: 30 On Fri, 2017-04-21 at 16:55 +0200, Borislav Petkov wrote: > On Tue, Mar 07, 2017 at 04:32:44PM -0800, Ricardo Neri wrote: > > insn_get_addr_ref returns the effective address as defined by the > > Please end function names with parentheses. Will do. > > > section 3.7.5.1 Vol 1 of the Intel 64 and IA-32 Architectures Software > > Developer's Manual. In order to compute the linear address, we must add > > to the effective address the segment base address as set in the segment > > descriptor. Furthermore, the segment descriptor to use depends on the > > register that is used as the base of the effective address. The effective > > base address varies depending on whether the operand is a register or a > > memory address and on whether a SiB byte is used. > > > > In most cases, the segment base address will be 0 if the USER_DS/USER32_DS > > segment is used or if segmentation is not used. However, the base address > > is not necessarily zero if a user programs defines its own segments. This > > is possible by using a local descriptor table. > > > > Since the effective address is a signed quantity, the unsigned segment > > base address saved in a separate variable and added to the final effective > > ".. is saved..." I will correct this. Thanks and BR, Ricardo