From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTV1l-0003Vy-0W for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:18:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTV1h-0003eo-1M for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:18:40 -0400 Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]:36329) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTV1g-0003ef-Sd for qemu-devel@nongnu.org; Fri, 07 Jul 2017 11:18:36 -0400 Received: by mail-qt0-x232.google.com with SMTP id i2so29584968qta.3 for ; Fri, 07 Jul 2017 08:18:36 -0700 (PDT) Sender: Richard Henderson References: <149865219962.17063.10630533069463266646.stgit@frigg.lan> <149865462073.17063.17488435214703164893.stgit@frigg.lan> <20170630004134.GJ13979@flamenco> <87h8yofvka.fsf@frigg.lan> From: Richard Henderson Message-ID: <9104ecbc-fe41-e318-d35f-d59d618acbf4@twiddle.net> Date: Fri, 7 Jul 2017 05:18:30 -1000 MIME-Version: 1.0 In-Reply-To: <87h8yofvka.fsf@frigg.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v11 10/29] target/i386: [tcg] Refactor translate_insn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , Eduardo Habkost , Peter Crosthwaite , qemu-devel@nongnu.org, Paolo Bonzini , =?UTF-8?Q?Alex_Benn=c3=a9e?= On 07/06/2017 11:25 PM, LluĂ­s Vilanova wrote: >>> /* convert one instruction. s->base.is_jmp is set if the translation must >>> be stopped. Return the next pc value */ >>> -static target_ulong disas_insn(CPUX86State *env, DisasContext *s, >>> - target_ulong pc_start) >>> +static target_ulong disas_insn(DisasContextBase *dcbase, CPUState *cpu) >>> { >>> + DisasContext *s = container_of(dcbase, DisasContext, base); >>> + CPUX86State *env = cpu->env_ptr; > >> Minor nit: you can pass dc (*s) here directly, no need for container_of > [...] > > I prefer not to so that the code will work in the future (i.e., not assuming the > location of base inside disascontext). There's clearly a misunderstanding here. Emilio is saying that disas_insn is not a hook and private to the front-end. Therefore the argument to the function should be "DisasContet *s" and not "DisasContextBase *dcbase". And I agree. Passing DisasContext should be preferred where possible. r~