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: 1040365 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SYpvI69I"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43z9RB0h8Hz9s4Z for ; Tue, 12 Feb 2019 15:58:43 +1100 (AEDT) Received: from localhost ([127.0.0.1]:33088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtQ9Z-0002YX-Ez for incoming@patchwork.ozlabs.org; Mon, 11 Feb 2019 23:58:41 -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-Google-Smtp-Source: AHgI3IbINKJGaXKJCcCZGEZt9u8VvS7Y3+MB7U4RpH7CUQT8f6Ao9YxYkW0OXTjKy/flT5REmyyhxg== 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+incoming=patchwork.ozlabs.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 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 -----