From patchwork Tue Feb 12 04:56:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 158068 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3412393jaa; Mon, 11 Feb 2019 21:00:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IYX9DJcQ+5w1SlcI98O5ex3MF84uQjaHncqMVKaQKTJKQg7a9Sot9PRzd2RfaTNcaSTn2QA X-Received: by 2002:a5b:34e:: with SMTP id q14mr1347571ybp.401.1549947641366; Mon, 11 Feb 2019 21:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549947641; cv=none; d=google.com; s=arc-20160816; b=LtB7LirrsL2g0dv4dps9awqKxT/zBCw2iaVqdhKoUuBbxuEdN6sVEl/OTK3TXRxP6m XK4+rVtfs5cniXWLtx3+kfef8gyC98iFhsbJKZaesdZMqhbssw5SbJk/o9N202c9DQwp mDjHXucUMdzawh+POEgv2JgWZpSKgcDYY4/zZxnks/Xp/I/AEruieOn5FgFWSaym5gGR dgfnm2KTjeVEdR9qC9vyTEr7jC7iBEMntoqBA/p0GvEC7Lug2YlG1m5Zu6hQrS9BpukC PTd81m4FMku1l9xxDe9tJfTc+hrE4GVw8kFOAI8PZ1EaX0eETcp6yow3A1yGqzAyPvI7 xdyw== 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=tVLdjm3ivoAVXVjkXTjemTbuu92WrCH/hivIEcJVWH0=; b=WKtsf+d0KwKsuiKZzDjCq4iQ3BKSptLjr0z5O4qHQUIYqxGcDHrdEOlKXKgbMPZfSX uHpomxnw8pErUk2SaUzbIG7drKeuszLMCLFsRnExIt54RDE5B84NfGM6AevhuDHk1Ukj Qr8b5nGPB2gVrNgdg3uHvCSSMxjNJwo1dSrGhPaxOUIhgmW3UjXWrZYO8pu+x3/4KsQ2 ONvJT7/GekJCZDW8WTPX1ZIxkmEwLCExoA9QyjYckvgdZG7NzYtsd5DgtxsHVpTpaBng 7kIAWYWKTye/g/vCF57Dy77bIeG9+AAV9dIDFXtHtiTFGNggnE2eQ+w8cezWyvfMHYgB eHFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SYpvI69I; 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 q189si6839334ywg.464.2019.02.11.21.00.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Feb 2019 21:00:41 -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=SYpvI69I; 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]:33098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtQBU-0003kI-Ph for patch@linaro.org; Tue, 12 Feb 2019 00:00:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtQ8k-0002Xi-SJ for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtQ8Y-0001e0-NE for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:41 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtQ8S-0001TJ-SQ for qemu-devel@nongnu.org; Mon, 11 Feb 2019 23:57:33 -0500 Received: by mail-pf1-x443.google.com with SMTP id n22so700214pfa.3 for ; Mon, 11 Feb 2019 20:57:27 -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=tVLdjm3ivoAVXVjkXTjemTbuu92WrCH/hivIEcJVWH0=; b=SYpvI69IF8td61tQb5UVR0FMptBk28kK494o/2QDXu07YnBIenDv2jyU/qd/bU+UYP jzou51Nl+nLnteWtJjjqVzY//SKa3TBusTTlGYNXpoZQ8oAwSeK442WfN8PKzfTcEVdc qWA/m2kEmp/bygCNzBJnGCevmpEfloGPGyD+B47YEVAABW6JyvSi9sBYuc3CplelpkME 2huHDa6/6WZASAChqM/bz4+qNLQnx5NePXCFSMxMjaf9JJR+IcyZ0qVozeUP9WVJj70Y HH6vtjZDcLW7wxtXdxh46MnO/k//O4cPc1mtK+wfX19Pa8/TQHxAsXKW587d9HFIFQdd HRrg== 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=tVLdjm3ivoAVXVjkXTjemTbuu92WrCH/hivIEcJVWH0=; b=KIV4DS1uGDjFDB5Q7LQ06P9snHdRJIPngy2CzjefmI/M2ydcdBrkTy1IVWtHnCJZy2 0tRYBtzYvdS9Utk3A0ZezgccHxCQqVJTehLEq3oeNjQpIFBKM1pVOlUlnyUTvjtWnpnB j3KUssssVcX0Kgama0CCAln7Loyv4qV97njJ25fX/Kapm1H4TzmnQuwqT8WnlgmXPfnF hDo/+m1ix+mAOr1YJo6/JVcWHnUSdO3vNv26C/3GZ5wZsfne6I020b6Tf1ys4gLU3mp1 AlSB+TYWDTaDyuYnwpZ7x5T5mmBhoj1PmOAJ13sr5qyPaCVbLlivDuUt7dM3q36Noajx bgzg== X-Gm-Message-State: AHQUAuZwq9CMIc39hRBHFzLy68LOE+xLPd4ftq05L7ES3AZnO3JNPBky xpMvGOcx98d0Xf6Sf6CWQNNZZ7RcF4w= X-Received: by 2002:a65:500c:: with SMTP id f12mr1879945pgo.226.1549947446026; Mon, 11 Feb 2019 20:57:26 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id a90sm22088923pfj.109.2019.02.11.20.57.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 20:57:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 20:56:59 -0800 Message-Id: <20190212045721.28041-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190212045721.28041-1-richard.henderson@linaro.org> References: <20190212045721.28041-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PULL 02/24] 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Convert the BREAK instruction to start. Tested-by: Helge Deller Tested-by: Sven Schnelle 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 -----