From patchwork Wed Sep 6 16:05:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9941059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1536460350 for ; Wed, 6 Sep 2017 16:13:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05BC628BDD for ; Wed, 6 Sep 2017 16:13:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEBE728BED; Wed, 6 Sep 2017 16:13:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E96F828BDD for ; Wed, 6 Sep 2017 16:13:12 +0000 (UTC) Received: from localhost ([::1]:36977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcwy-0004kk-4L for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Sep 2017 12:13:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcqX-0008SX-Ie for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpcqW-00021w-Ar for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:33 -0400 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:34479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpcqW-00020a-3s for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:32 -0400 Received: by mail-pg0-x22d.google.com with SMTP id q68so157402pgq.1 for ; Wed, 06 Sep 2017 09:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/hs5DJ5ZOYzeGcPj2CaJWFBYCthdShVyhxl4UMKX3/s=; b=VTv20rXAv/yU273uHMQMIJ4c6Xibi4EyV9LUmMU9j+GYhUqW/5NA+3P0tLtqQYz/KQ TAEIqk/0mPEZKtRKixH5YjRavHPs/NnSMDNaSBHTif1MeoROL38naH6AgJr5X0llg8wF E+1gmcGdO6d4fZWMGSbSFVbVOyaG5s9NChW7c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/hs5DJ5ZOYzeGcPj2CaJWFBYCthdShVyhxl4UMKX3/s=; b=DKtm7Xhy2OD/z0WVLHHZI50+0gk6k4etgJ4/nmPbVbiovGiLK3l+ogPK6uj+5aMp8o d9gm37vbIU+HfS0xRgflmgWNQ3y27FMPNNrGPw8z0itut8l/tGGi3bEeyUA7hofeuVyz x/nyN3v1NcHtmbOzHU1n3Eq7mJNFDBjMGgfG0yATYuKEl/fTio5wMvZB7+lQOaUyssy+ R3pU69L0NFKZkVXMy6F1kC1pHoxNSjzhRCPhuvf/gzp8uNSnjJMdpm52jHtgNUyT4TX6 JNtlq+Pgr/E4SERsHJDZk3cHMNPBhJp3OX8h8Qt/MIHJrPbqNIXHR7A4z9mMgSUNSA81 TeTw== X-Gm-Message-State: AHPjjUg9YIX6CuTnZ70C5T9Ksx7Wqs2p50QQ4UuiAFHC10C/nqjQXmfe hG3Ev9kuWI+JOLkP7tqdmw== X-Google-Smtp-Source: ADKCNb6ZELyvx9oCnZxMuzVBk/TSbDtonY5gWURJtBwxCGqXNu2EIXgz3hvSbkByVOnzRgJWZzifwQ== X-Received: by 10.99.121.194 with SMTP id u185mr8433851pgc.314.1504713990798; Wed, 06 Sep 2017 09:06:30 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id t65sm262863pfk.59.2017.09.06.09.06.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Sep 2017 09:06:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 09:05:52 -0700 Message-Id: <20170906160612.22769-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170906160612.22769-1-richard.henderson@linaro.org> References: <20170906160612.22769-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22d Subject: [Qemu-devel] [PULL 12/32] target/i386: [tcg] Port to tb_stop X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Lluís Vilanova Incrementally paves the way towards using the generic instruction translation loop. Signed-off-by: Lluís Vilanova Reviewed-by: Emilio G. Cota Reviewed-by: Richard Henderson Message-Id: <150002219289.22386.17959138704858928730.stgit@frigg.lan> Signed-off-by: Richard Henderson --- target/i386/translate.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 0f38896f17..9872f84a03 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -8488,8 +8488,6 @@ static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) /* if irq were inhibited with HF_INHIBIT_IRQ_MASK, we clear the flag and abort the translation to give the irqs a chance to happen */ - gen_jmp_im(pc_next - dc->cs_base); - gen_eob(dc); dc->base.is_jmp = DISAS_TOO_MANY; } else if ((dc->base.tb->cflags & CF_USE_ICOUNT) && ((dc->base.pc_next & TARGET_PAGE_MASK) @@ -8502,18 +8500,24 @@ static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) If current instruction already crossed the bound - it's ok, because an exception hasn't stopped this code. */ - gen_jmp_im(pc_next - dc->cs_base); - gen_eob(dc); dc->base.is_jmp = DISAS_TOO_MANY; } else if ((pc_next - dc->base.pc_first) >= (TARGET_PAGE_SIZE - 32)) { - gen_jmp_im(pc_next - dc->cs_base); - gen_eob(dc); dc->base.is_jmp = DISAS_TOO_MANY; } dc->base.pc_next = pc_next; } +static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) +{ + DisasContext *dc = container_of(dcbase, DisasContext, base); + + if (dc->base.is_jmp == DISAS_TOO_MANY) { + gen_jmp_im(dc->base.pc_next - dc->cs_base); + gen_eob(dc); + } +} + /* generate intermediate code for basic block 'tb'. */ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) { @@ -8570,23 +8574,21 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) /* if single step mode, we generate only one instruction and generate an exception */ if (dc->base.singlestep_enabled) { - gen_jmp_im(dc->base.pc_next - dc->cs_base); - gen_eob(dc); + dc->base.is_jmp = DISAS_TOO_MANY; break; } /* if too long translation, stop generation too */ if (tcg_op_buf_full() || num_insns >= max_insns) { - gen_jmp_im(dc->base.pc_next - dc->cs_base); - gen_eob(dc); + dc->base.is_jmp = DISAS_TOO_MANY; break; } if (singlestep) { - gen_jmp_im(dc->base.pc_next - dc->cs_base); - gen_eob(dc); + dc->base.is_jmp = DISAS_TOO_MANY; break; } } + i386_tr_tb_stop(&dc->base, cs); if (tb->cflags & CF_LAST_IO) gen_io_end(); gen_tb_end(tb, num_insns);