From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: RFC: cache_regs in kvm_emulate_pio Date: Sun, 22 Jun 2008 08:16:19 +0300 Message-ID: <485DE023.4060006@qumranet.com> References: <20080621194639.GA15032@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Marcelo Tosatti Return-path: Received: from il.qumranet.com ([212.179.150.194]:24693 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750900AbYFVFQH (ORCPT ); Sun, 22 Jun 2008 01:16:07 -0400 In-Reply-To: <20080621194639.GA15032@dmt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > On Sat, Jun 21, 2008 at 10:04:18AM +0300, Avi Kivity wrote: > >>> /* >>> * Sync the rsp and rip registers into the vcpu structure. This allows >>> * registers to be accessed by indexing vcpu->arch.regs. >>> */ >>> >>> But I think it just refers to the interface in general, so that nobody >>> would try to access RSP or RIP (and RAX in AMD's case) before calling >>> ->cache_regs(). >>> >>> >> It refers to the fact that sometimes you don't know which registers you >> refer to, e.g. in the emulator. >> > > How's this? > > Looks good, but we can aim higher. The cache_regs() API was always confusing (I usually swap the two parts). If we replace all ->regs access with accessors, we can make it completely transparent. It will be tricky in the emulator, but worthwhile, no? -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.