From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRMPl-0006IW-FZ for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:19:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRMPh-0000i7-Dw for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:19:25 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:38254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRMPf-0000fu-FM for qemu-devel@nongnu.org; Mon, 26 Nov 2018 14:19:21 -0500 Received: by mail-pg1-x535.google.com with SMTP id g189so6617892pgc.5 for ; Mon, 26 Nov 2018 11:19:15 -0800 (PST) References: <20181025172057.20414-1-cota@braap.org> <20181025172057.20414-24-cota@braap.org> <87lg5f51sz.fsf@linaro.org> From: Richard Henderson Message-ID: Date: Mon, 26 Nov 2018 11:19:11 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC 23/48] translator: add plugin_insn argument to translate_insn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: "Emilio G. Cota" , Stefan Hajnoczi , Peter Maydell , qemu-devel@nongnu.org, Pavel Dovgalyuk , =?UTF-8?Q?Llu=c3=ads_Vilanova?= On 11/26/18 10:56 AM, Alex Bennée wrote: > > > On Mon, 26 Nov 2018, 18:27 Richard Henderson wrote: > > On 11/26/18 6:52 AM, Alex Bennée wrote: > > I'm not convinced this is the best way to go about it. We end up having > > to sprinkle the plugin calls into each decoder rather than keeping all > > the infrastructure in the common main loop. However the common loop will > > need to know the total number of bytes decoded so we could change the > > declaration to: > > > >   int (*translate_insn)(DisasContextBase *db, CPUState *cpu); > > > > and return the number of bytes decoded. > > Returning the number of bytes is more difficult than simply just > >     old_pc = db->pc_next; >     opc->translate_insn(db, cpu); >     bytes = db->pc_next - old_pc; > > requiring no target changes at all. > > > If that's always true then great, but what happens with direct branches? pc_next is still updated by the size of the branch, not it's destination; db->is_jmp will be != DISAS_NEXT, ending the TB. r~