From patchwork Sat Feb 17 20:31:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128742 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1897828ljc; Sat, 17 Feb 2018 12:32:20 -0800 (PST) X-Google-Smtp-Source: AH8x227u+++b5Oh7ds1xSAUuXVcNtP3+LYBQujsmsv2i31B8QnAoeR5coT4EnB1dOo07YvJtpw8f X-Received: by 10.37.55.69 with SMTP id e66mr7406917yba.110.1518899540404; Sat, 17 Feb 2018 12:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518899540; cv=none; d=google.com; s=arc-20160816; b=cvvhCP5nWfmZ2HThPgw1F06DAKwDjCMvGKBDVKB/eAIXYQdSJHcXRB/WgAlkEwKsUi 4Sqqbt8+cHxKEajSVdV0KNu9ssvt/RB3w25qinIGAwISeCRgOZ8p49Q+OoS5mp8EIWGz 6TPmVLjmMl6PY1ilNAorb22SiKsuyjKWA7Tx0wzpzj/SW4UmQc/iInwB3q/oQMW//CEg umAHxuKsByyWwPi/3DtWykoNHDUd0KHw4OIN0jb8+g1V77RLRmAAnXlYNDoLmWCUSTXU rBnwYonLmqueWzj4igKafRtrVdZMdvvwpp0Er4Ihu7/2rGGeDdgNa9iqxjOLbAkJp8KI D8Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=HBH2CujxMyeoLJXbJq9JxnwlsktdlggoSOrkuQCfVPY=; b=NbuU9FrNQsOVzNr3Ahz/itF2eEBI7f3qidN6pxh+W1+xgePdfCjGkswOw3KgO6hBOi T1E7PRsE6sekYiUckPx7R/zkaDbBLJ03j8d39YmKEzyq+t4NDTjgwuH3ieJ1WWJXw9e0 JiVlo91kR56l0W/qrWa7m6rHsZZR3fr9CNTRfLEhiPr9OoEZMldKyS+KaPJE4epUZl/F +xeu/ic4H+WuMKRmsqOQRbe25PPZ02dbcvhvp2IY5HDok4N/6ohx2AZdbNPxYBvnOL+U pbTifJiOl0RMZVhD4+0YQNNmj024TTFAH0217rG/zzo/kUs/OWWe5wPEooQDSIHREkp4 7tPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ch53fMwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l18si3640148ywm.397.2018.02.17.12.32.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 12:32:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ch53fMwu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:60372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en99f-0008TD-OG for patch@linaro.org; Sat, 17 Feb 2018 15:32:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en996-0008QM-HW for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en995-0000kH-53 for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:44 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:43013) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en994-0000jz-Tk for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:43 -0500 Received: by mail-pg0-x242.google.com with SMTP id f6so4407645pgs.10 for ; Sat, 17 Feb 2018 12:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=HBH2CujxMyeoLJXbJq9JxnwlsktdlggoSOrkuQCfVPY=; b=Ch53fMwuPhP89i1+GEVqlmxwtJO2StPwmABkVnFGFoI78GblVpniyGb7lYR3t6fOs7 Oks3zvccjDUOuK+BbhmmdtdmB7n7oLbhEbRgwNVmhsxPRT03B/YPo6qMufp99aTIyTX1 ODk9pKftM0bOxMQWb+PSKT8N1VqtCs5JBq53g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=HBH2CujxMyeoLJXbJq9JxnwlsktdlggoSOrkuQCfVPY=; b=T/e37qT/LxjK6WTxI+rAtrnRbMnIFmFs1/k9As0g2EfRDpNeXwDTFimYm4VnPh86Yk e43WT9Gy4bDr+HFzBmDyr7xxOYRTgQRyTuTixAf+CMVgemIpuNOhysgWWvHwEuVtKQpP +0bpnKGy2Dho5yvIf/308IfwRL+4Pu67IYkSnDnXGqMso846PlKFCHSTQNaix5DITC5v FTGe/aUlLmeOImbyDoRmX0zgHisOgiKjmAAuAO4GP53xIa1hL3LhulFKoKnPPmelI87u ZMAJDvFZKgSpB4HHX5TTTlnYAW4JinGo7Zugv3QXLOpjPGRJHpYpioEywf6YK5bLY6Dq s1mg== X-Gm-Message-State: APf1xPDZSp8Ayt05LKckM6kjGZnB/9OTFHZD6FSAmCzKNGQn8k/nJkxF NB6wRdfBdQuply6DplP7g1j8OgaJyYU= X-Received: by 10.99.120.197 with SMTP id t188mr7462948pgc.358.1518899501481; Sat, 17 Feb 2018 12:31:41 -0800 (PST) Received: from cloudburst.twiddle.net ([50.0.192.64]) by smtp.gmail.com with ESMTPSA id y7sm48203797pfe.26.2018.02.17.12.31.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 12:31:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 12:31:16 -0800 Message-Id: <20180217203132.31780-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180217203132.31780-1-richard.henderson@linaro.org> References: <20180217203132.31780-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH 03/19] target/hppa: Convert move to/from system registers 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/hppa/translate.c | 57 +++++++++++++++++++++--------------------------- target/hppa/insns.decode | 15 +++++++++++++ 2 files changed, 40 insertions(+), 32 deletions(-) -- 2.14.3 Reviewed-by: Bastian Koppelmann diff --git a/target/hppa/translate.c b/target/hppa/translate.c index a503ae38d4..9b2de2fa2a 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -844,7 +844,7 @@ static unsigned assemble_rc64(uint32_t insn) return r2 * 32 + r1 * 4 + r0; } -static unsigned assemble_sr3(uint32_t insn) +static inline unsigned assemble_sr3(uint32_t insn) { unsigned s2 = extract32(insn, 13, 1); unsigned s0 = extract32(insn, 14, 2); @@ -2015,9 +2015,9 @@ static void trans_sync(DisasContext *ctx, uint32_t insn, const DisasInsn *di) cond_free(&ctx->null_cond); } -static void trans_mfia(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mfia(DisasContext *ctx, arg_mfia *a, uint32_t insn) { - unsigned rt = extract32(insn, 0, 5); + unsigned rt = a->t; TCGv_reg tmp = dest_gpr(ctx, rt); tcg_gen_movi_reg(tmp, ctx->iaoq_f); save_gpr(ctx, rt, tmp); @@ -2025,10 +2025,10 @@ static void trans_mfia(DisasContext *ctx, uint32_t insn, const DisasInsn *di) cond_free(&ctx->null_cond); } -static void trans_mfsp(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mfsp(DisasContext *ctx, arg_mfsp *a, uint32_t insn) { - unsigned rt = extract32(insn, 0, 5); - unsigned rs = assemble_sr3(insn); + unsigned rt = a->t; + unsigned rs = a->sp; TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_reg t1 = tcg_temp_new(); @@ -2043,16 +2043,16 @@ static void trans_mfsp(DisasContext *ctx, uint32_t insn, const DisasInsn *di) cond_free(&ctx->null_cond); } -static void trans_mfctl(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mfctl(DisasContext *ctx, arg_mfctl *a, uint32_t insn) { - unsigned rt = extract32(insn, 0, 5); - unsigned ctl = extract32(insn, 21, 5); + unsigned rt = a->t; + unsigned ctl = a->r; TCGv_reg tmp; switch (ctl) { case CR_SAR: #ifdef TARGET_HPPA64 - if (extract32(insn, 14, 1) == 0) { + if (a->e == 0) { /* MFSAR without ,W masks low 5 bits. */ tmp = dest_gpr(ctx, rt); tcg_gen_andi_reg(tmp, cpu_sar, 31); @@ -2094,10 +2094,10 @@ static void trans_mfctl(DisasContext *ctx, uint32_t insn, const DisasInsn *di) cond_free(&ctx->null_cond); } -static void trans_mtsp(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mtsp(DisasContext *ctx, arg_mtsp *a, uint32_t insn) { - unsigned rr = extract32(insn, 16, 5); - unsigned rs = assemble_sr3(insn); + unsigned rr = a->r; + unsigned rs = a->sp; TCGv_i64 t64; if (rs >= 5) { @@ -2120,11 +2120,10 @@ static void trans_mtsp(DisasContext *ctx, uint32_t insn, const DisasInsn *di) nullify_end(ctx); } -static void trans_mtctl(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mtctl(DisasContext *ctx, arg_mtctl *a, uint32_t insn) { - unsigned rin = extract32(insn, 16, 5); - unsigned ctl = extract32(insn, 21, 5); - TCGv_reg reg = load_gpr(ctx, rin); + unsigned ctl = a->t; + TCGv_reg reg = load_gpr(ctx, a->r); TCGv_reg tmp; if (ctl == CR_SAR) { @@ -2176,12 +2175,11 @@ static void trans_mtctl(DisasContext *ctx, uint32_t insn, const DisasInsn *di) #endif } -static void trans_mtsarcm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mtsarcm(DisasContext *ctx, arg_mtsarcm *a, uint32_t insn) { - unsigned rin = extract32(insn, 16, 5); TCGv_reg tmp = tcg_temp_new(); - tcg_gen_not_reg(tmp, load_gpr(ctx, rin)); + tcg_gen_not_reg(tmp, load_gpr(ctx, a->r)); tcg_gen_andi_reg(tmp, tmp, TARGET_REGISTER_BITS - 1); save_or_nullify(ctx, cpu_sar, tmp); tcg_temp_free(tmp); @@ -2267,24 +2265,26 @@ static void trans_ssm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; nullify_end(ctx); } +#endif /* !CONFIG_USER_ONLY */ -static void trans_mtsm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_mtsm(DisasContext *ctx, arg_mtsm *a, uint32_t insn) { - unsigned rr = extract32(insn, 16, 5); - TCGv_reg tmp, reg; - CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); +#ifndef CONFIG_USER_ONLY + TCGv_reg tmp, reg; nullify_over(ctx); - reg = load_gpr(ctx, rr); + reg = load_gpr(ctx, a->r); tmp = get_temp(ctx); gen_helper_swap_system_mask(tmp, cpu_env, reg); /* Exit the TB to recognize new interrupts. */ ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; nullify_end(ctx); +#endif } +#ifndef CONFIG_USER_ONLY static void trans_rfi(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { unsigned comp = extract32(insn, 5, 4); @@ -2323,19 +2323,12 @@ static void gen_hlt(DisasContext *ctx, int reset) #endif /* !CONFIG_USER_ONLY */ static const DisasInsn table_system[] = { - { 0x00001820u, 0xffe01fffu, trans_mtsp }, - { 0x00001840u, 0xfc00ffffu, trans_mtctl }, - { 0x016018c0u, 0xffe0ffffu, trans_mtsarcm }, - { 0x000014a0u, 0xffffffe0u, trans_mfia }, - { 0x000004a0u, 0xffff1fe0u, trans_mfsp }, - { 0x000008a0u, 0xfc1fbfe0u, trans_mfctl }, { 0x00000400u, 0xffffffffu, trans_sync }, /* sync */ { 0x00100400u, 0xffffffffu, trans_sync }, /* syncdma */ { 0x000010a0u, 0xfc1f3fe0u, trans_ldsid }, #ifndef CONFIG_USER_ONLY { 0x00000e60u, 0xfc00ffe0u, trans_rsm }, { 0x00000d60u, 0xfc00ffe0u, trans_ssm }, - { 0x00001860u, 0xffe0ffffu, trans_mtsm }, { 0x00000c00u, 0xfffffe1fu, trans_rfi }, #endif }; diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 6c2d3a3a52..01b8a52ca5 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -17,8 +17,23 @@ # License along with this library; if not, see . # +#### +# Field definitions +#### + +%assemble_sr3 13:1 14:2 + #### # System #### break 000000 ----- ----- --- 00000000 ----- + +mtsp 000000 ----- r:5 ... 11000001 00000 sp=%assemble_sr3 +mtctl 000000 t:5 r:5 --- 11000010 00000 +mtsarcm 000000 01011 r:5 --- 11000110 00000 +mtsm 000000 00000 r:5 000 11000011 00000 + +mfia 000000 ----- 00000 --- 10100101 t:5 +mfsp 000000 ----- 00000 ... 00100101 t:5 sp=%assemble_sr3 +mfctl 000000 r:5 00000- e:1 -01000101 t:5