From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1jVp-00036r-Ht for qemu-devel@nongnu.org; Sun, 07 Jun 2015 18:57:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1jVm-0003fq-CJ for qemu-devel@nongnu.org; Sun, 07 Jun 2015 18:57:53 -0400 Received: from mail-yk0-f175.google.com ([209.85.160.175]:34428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1jVm-0003fe-8i for qemu-devel@nongnu.org; Sun, 07 Jun 2015 18:57:50 -0400 Received: by ykfl8 with SMTP id l8so45325377ykf.1 for ; Sun, 07 Jun 2015 15:57:49 -0700 (PDT) MIME-Version: 1.0 Sender: peter.crosthwaite@petalogix.com In-Reply-To: <556CAC83.4080906@twiddle.net> References: <556CAC83.4080906@twiddle.net> Date: Sun, 7 Jun 2015 15:57:49 -0700 Message-ID: From: Peter Crosthwaite Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [RFC v2 02/34] cpu-exec: Purge all uses of CPU_GET_ENV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , Peter Crosthwaite , "qemu-devel@nongnu.org Developers" , Peter Crosthwaite , Paolo Bonzini , "Edgar E. Iglesias" , =?UTF-8?Q?Andreas_F=C3=A4rber?= On Mon, Jun 1, 2015 at 12:03 PM, Richard Henderson wrote: > On 05/30/2015 11:11 PM, Peter Crosthwaite wrote: >> Remove un-needed usages of CPU_GET_ENV by converting the APIs to use >> CPUState pointers and retrieving the env_ptr as minimally needed. >> >> FIXME: apply target-foo change pattern to all archs. > > Yes, please. > Fixed. >> #ifdef TARGET_I386 >> X86CPU *x86_cpu = X86_CPU(cpu); >> + CPUArchState *env = (CPUArchState *)cpu->env_ptr; >> #endif > > CPUArchState *env = &x86_cpu.env; > Fixed. >> #ifdef TARGET_I386 >> + env = cpu->env_ptr; >> x86_cpu = X86_CPU(cpu); >> #endif > > Likewise. > And fixed. > Or, indeed, it might be worth propagating away "env" entirely, so you don't > have to reload it here at the end of the setjmp. > I'm leaving this as follow-up for the moment as it is a bit of a change to target-i386 code. cpu_svm_check_intercept_param() needs to be de-envified but it has a fair few internal uses in target-x86. I'm thinking it should take a CPU * (not an X86CPU) due to its call from common code. This means we should be able to stubbify the function and remove the TARGET_I386 ifeffery entirely one day. The drawback is adding QOM casts in target-i386. Is this thing ever a fast path? Will other arches want to use this hook one day as well? Regards, Peter > Otherwise this starter patch looks good. > > > r~ > >