From patchwork Thu Feb 7 11:53:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157716 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp554142jaa; Thu, 7 Feb 2019 03:59:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IZhAIrpk27K+mt/gCCcHh4ksaZxf6JNJKP6VXuXK3Cb+ovM+hhyz4J5nTt3ppHVfPSmGOvZ X-Received: by 2002:a1c:4c14:: with SMTP id z20mr1950094wmf.122.1549540763233; Thu, 07 Feb 2019 03:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549540763; cv=none; d=google.com; s=arc-20160816; b=o+mLyVFF38IV2T7ANp6Mx6vGRZpg6Q/1JbRWbyexZLV/ZjQllo2kXSWyvOijz54OR1 IkPaUKnTPCNXMGnm5o+1Rb4kIAdiyIN9QuCRkEIeTYKU4eUw3AE8C7YfxjBzRN0fLIQX LN63vD5lWhOg2AxIan9lFH/KQ1sHaY2PBV8xn9eF/ZbWYILujZlQxXNOQcoAbYkufJTP ZqsgikA98iQhjbkNW/aYTU3Y1qywTNaRwJH/BegvMUgtb7vxCT/gV2Yd14raquRzW9c4 /CmZr0iUETIjSNoIQc1Ajd2zbBVoFKJP71kwoqgyCEL06sZXiI1BeW4ClUYR6PIk4HkB JDAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Wex9tkOudTlKEMJKUmmswWyKmSvTRcgb3wqfx0OKj5M=; b=Kfryp6gSVLWKPP0iDzRzRtAQMrDYX4IIkTtFNJ1LTf9CYTXXHzFPkKXL50W9XYvC8h GuOYKNu5pmxncfuDJm78ZdYNr05NIGglGqhftF3WT+5Vtw/PrNHCl1MCcoC859S3WmYh jGFttLxJmWmP3yjRc5fd2T4mmhpy5o3PzsSbI2PqSF5RJWXmKmPNpUzyhAs0wS7MBT4t LMC011vU0jKttRw7AwbxB78DalNbbpqNJSMYtYUh/YiGkpdjfA0i0cjvp3aqxBD4J11m VorhSD5pQvVGUAihXMSkZdoe7TLyd4YDTiAaxc1VcdhqyQePOzKxQaJxNdCAMie1wz3E AvgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uqIfJ2mT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f3si9297959wmh.6.2019.02.07.03.59.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Feb 2019 03:59:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uqIfJ2mT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:38462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1griKw-0002Oi-50 for patch@linaro.org; Thu, 07 Feb 2019 06:59:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1griFt-0007AD-Bg for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1griFs-0001Nk-6Q for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:09 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1griFr-0001Mm-VK for qemu-devel@nongnu.org; Thu, 07 Feb 2019 06:54:08 -0500 Received: by mail-wm1-x342.google.com with SMTP id g67so6357047wmd.2 for ; Thu, 07 Feb 2019 03:54:07 -0800 (PST) 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; bh=Wex9tkOudTlKEMJKUmmswWyKmSvTRcgb3wqfx0OKj5M=; b=uqIfJ2mTE+yiBJMQsryZJRumyYfgdLAokXWOX9wa3kseTCCdKFo1E+M9zYtRvoGobj gr4QjiYzk/lwbZ60D5um1dQ5w3XgHrBBrzVrhExqjoBa6Y+ByCb40TmOLohmLzbpNzXZ zSp/2qisZbPZ+SIEQoYakuo3niy/5Z8sebwGzW8u+U6zYeJ3oX8cPMboMQltBrLwmMXf 0fQMalqaCVYQDCQ/eYF+MTFSxeXzx87+By3LPtO+MT2249+NcuJmNaqfvRNIOTokpWHb KpHX6YjB6vFjsdJoyYUg0+RXxSoZfYXlxDk8+VKruvsElWbjG5FU/XApq75rhjBC5fAY SO5g== 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; bh=Wex9tkOudTlKEMJKUmmswWyKmSvTRcgb3wqfx0OKj5M=; b=JYYlqFZNpnyjHEnB8D+nmzXvcdqsx3dcxqzbUP7V9PkJCAzdF8ZGDy5/xH0O7VgEYQ OPcICcLBNHyfkb1dPv5xkJ7ZjcAFEoCoCHAHnghAb7vhvA8MKRs5QyLVIywPHfoCK+Bf kH4NlUP+Jkxp563BrnXMcopEdibwXqPvm+raErog56TofGctzjTE9suGZ3zltsUDLUkV uT7Q1fLhCKcBVmVwv76TMPImfiUcCXnl7hJdZTXSUrAz3AQ7skSUmCerLv0zwxSMVQem e40KDQD+z4nGeMUTA/CwW04O2lFhfT6YjuE++T/FVm1yYosc4ZPkJu1ICVm+fqGb7DnR zI7A== X-Gm-Message-State: AHQUAuZxywSVBqanbKDjbBMBJ70qgUUaYETsWLGqQBzxIQPQXu2ajjZ/ vrR+qzD/1utXYrGWgnHnZy9UirBr+nPPNQ== X-Received: by 2002:a1c:5656:: with SMTP id k83mr7231484wmb.125.1549540445852; Thu, 07 Feb 2019 03:54:05 -0800 (PST) Received: from cloudburst.twiddle.net ([37.205.61.206]) by smtp.gmail.com with ESMTPSA id w16sm34030016wrp.1.2019.02.07.03.54.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 03:54:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Feb 2019 11:53:43 +0000 Message-Id: <20190207115400.647-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190207115400.647-1-richard.henderson@linaro.org> References: <20190207115400.647-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 02/19] target/hppa: Begin using scripts/decodetree.py 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: deller@gmx.de, svens@stackframe.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the BREAK instruction to start. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 24 +++++++++++++++++++----- target/hppa/Makefile.objs | 8 ++++++++ target/hppa/insns.decode | 24 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 target/hppa/insns.decode -- 2.17.2 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index a4f253a022..f50ec7b9c2 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -278,6 +278,9 @@ typedef struct DisasContext { bool psw_n_nonzero; } DisasContext; +/* Include the auto-generated decoder. */ +#include "decode.inc.c" + /* We are not using a goto_tb (for whatever reason), but have updated the iaq (for whatever reason), so don't do it again on exit. */ #define DISAS_IAQ_N_UPDATED DISAS_TARGET_0 @@ -661,7 +664,8 @@ static void nullify_set(DisasContext *ctx, bool x) } /* Mark the end of an instruction that may have been nullified. - This is the pair to nullify_over. */ + This is the pair to nullify_over. Always returns true so that + it may be tail-called from a translate function. */ static bool nullify_end(DisasContext *ctx) { TCGLabel *null_lab = ctx->null_lab; @@ -745,12 +749,17 @@ static bool gen_illegal(DisasContext *ctx) return gen_excp_iir(ctx, EXCP_ILL); } -#define CHECK_MOST_PRIVILEGED(EXCP) \ +#ifdef CONFIG_USER_ONLY +#define CHECK_MOST_PRIVILEGED(EXCP) \ + return gen_excp_iir(ctx, EXCP) +#else +#define CHECK_MOST_PRIVILEGED(EXCP) \ do { \ if (ctx->privilege != 0) { \ return gen_excp_iir(ctx, EXCP); \ } \ } while (0) +#endif static bool use_goto_tb(DisasContext *ctx, target_ureg dest) { @@ -1982,7 +1991,7 @@ static bool trans_nop(DisasContext *ctx, uint32_t insn, const DisasInsn *di) return true; } -static bool trans_break(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static bool trans_break(DisasContext *ctx, arg_break *a) { return gen_excp_iir(ctx, EXCP_BREAK); } @@ -2308,7 +2317,6 @@ static bool gen_hlt(DisasContext *ctx, int reset) #endif /* !CONFIG_USER_ONLY */ static const DisasInsn table_system[] = { - { 0x00000000u, 0xfc001fe0u, trans_break }, { 0x00001820u, 0xffe01fffu, trans_mtsp }, { 0x00001840u, 0xfc00ffffu, trans_mtctl }, { 0x016018c0u, 0xffe0ffffu, trans_mtsarcm }, @@ -4534,8 +4542,14 @@ static void translate_table_int(DisasContext *ctx, uint32_t insn, static void translate_one(DisasContext *ctx, uint32_t insn) { - uint32_t opc = extract32(insn, 26, 6); + uint32_t opc; + /* Transition to the auto-generated decoder. */ + if (decode(ctx, insn)) { + return; + } + + opc = extract32(insn, 26, 6); switch (opc) { case 0x00: /* system op */ translate_table(ctx, insn, table_system); diff --git a/target/hppa/Makefile.objs b/target/hppa/Makefile.objs index 3359da5341..174f50a96c 100644 --- a/target/hppa/Makefile.objs +++ b/target/hppa/Makefile.objs @@ -1,3 +1,11 @@ obj-y += translate.o helper.o cpu.o op_helper.o gdbstub.o mem_helper.o obj-y += int_helper.o obj-$(CONFIG_SOFTMMU) += machine.o + +DECODETREE = $(SRC_PATH)/scripts/decodetree.py + +target/hppa/decode.inc.c: $(SRC_PATH)/target/hppa/insns.decode $(DECODETREE) + $(call quiet-command,\ + $(PYTHON) $(DECODETREE) -o $@ $<, "GEN", $(TARGET_DIR)$@) + +target/hppa/translate.o: target/hppa/decode.inc.c diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode new file mode 100644 index 0000000000..2822fbc58b --- /dev/null +++ b/target/hppa/insns.decode @@ -0,0 +1,24 @@ +# +# HPPA instruction decode definitions. +# +# Copyright (c) 2018 Richard Henderson +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . +# + +#### +# System +#### + +break 000000 ----- ----- --- 00000000 -----