From patchwork Sat Feb 17 20:31:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128743 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1897842ljc; Sat, 17 Feb 2018 12:32:21 -0800 (PST) X-Google-Smtp-Source: AH8x226CrHqqM/n5MHMm9psZxS+Ozwb/9m5ZmKPnD0l+6qa96l0AeEh8BYSECDuZ/dM9o7lRjcyP X-Received: by 10.37.131.206 with SMTP id v14mr7252745ybm.170.1518899541260; Sat, 17 Feb 2018 12:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518899541; cv=none; d=google.com; s=arc-20160816; b=keO5KFl8NvtUnbhgzgUcLwcJ2SL3/JL4uMqC/KQI8P4jCPtBx0vKT3j5taLsUcGi3h 11s+N7EqDbL//R1SsJnZ4lT8+I9Q0MbWhtpziaZ806dXNPkoKlyGaE1vn3kuJT9+QGe8 lxVMaQSLPFB/DAqe6R0WxcPffWAR9z7egCyt3UgI0JPqquT0IBVwnuO1fnIr3uPhy3Eu 9uZpbJPt0sL0i+zSMHJcg6i/fVt+WmGsvRLPo5eYedVILEYqn7AKLVTnWPn7oYr7TLs6 1ZMG7nMyswKpAH4lzBVvx1dCmnoLQdCPtLxX2UDRPCXFbFnOWqPdruO4dS1NpYWSMp7E YbQQ== 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=Kxo82Nm2DNo3fZAvJrTs4BuOnNd2IVKa1W3rcivOeME=; b=FKakvLhZIbbvznYSMuGO4R6a2046Ir4wOZd6V5YmMQPjoJkrtrLmmkFuALtpL8kE9T TKbUaBRao/ijPMi7aUwLM2JupopkvB2QCL2PsT79rUD4pR8AKjCCSNoZ6yEVlaatcIvb NslKLSv50aJAgFbapVsNfI34MeB/oApwJ96d6xLqjqiVnI4qRRJpA7/2rm1cpV/30v+x pkzbRvB1L5eADFU483andTUcdClVMfevm25lbR6W/8pO7xh2qMVDx4g5avR2N5xHcslo LhpbWrYvi+oefKIxZRtr+dZPKFqfzUt1kxn7OGXxV+4Ly3rOPgFoAtGgJtnICCWpNsn8 inZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KSXilp1A; 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 q132si159611ybb.663.2018.02.17.12.32.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Feb 2018 12:32:21 -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=KSXilp1A; 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]:60373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en99g-0008UO-I1 for patch@linaro.org; Sat, 17 Feb 2018 15:32:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en998-0008Rr-1A for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en996-0000kj-LP for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:46 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:43655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en996-0000kT-CQ for qemu-devel@nongnu.org; Sat, 17 Feb 2018 15:31:44 -0500 Received: by mail-pf0-x242.google.com with SMTP id c63so659218pfa.10 for ; Sat, 17 Feb 2018 12:31:44 -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=Kxo82Nm2DNo3fZAvJrTs4BuOnNd2IVKa1W3rcivOeME=; b=KSXilp1AFNs1lgGckgcMuISqN231O1/V2sJ0HhdTE5A2dKpYalPmonWbSjVMDqZfkW 6gzEjQaQ620eeNjrrXX5W3X8ZMPM0zJKUnW5dOjjNT82M3Vtta+2z5hkaIPSaqsU0drE VZaOlMUsS82j+8w+TS8xwvVovON+dYC7EG1XA= 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=Kxo82Nm2DNo3fZAvJrTs4BuOnNd2IVKa1W3rcivOeME=; b=sZZQVyXT+ve202TNkiuWpwj6ysr82GoagcVHktYyJNi0IRmeq32m1TgylvnFdd2XZz 4I1fM0zu9/EOAURvuPCpo1ccdU5lRSCsLUlWSP2/w5htfoOaRS/vrRUOHwBI+i64f1TU mew/8NQCS+agGSMqWz/VKz7N6upOsklCLAOw7garXs6lgQjgak+Pl/pYgHo/5eO/K9Ug wcHa0sYZgpF045xYrjVMUeWmwOLFtP2Q3fyrzkfNuJT9tfYRfoXva6o1t7CGl1WYXmr2 Dax3kz6PMbEhClccz+njdWVk8mwwhNC1z8lUb0U5fx9ca7IssOQcvYHJOLXtqO8RS4yA /0iA== X-Gm-Message-State: APf1xPBojdVa9Li3OkYK1QX1Pv3h6WhknbbKiwRiy45VWY9g6xZQBHo+ 2ET94dbr8SXPrrNmpwn+cBLAQqiH8dI= X-Received: by 10.99.1.130 with SMTP id 124mr8600915pgb.208.1518899502858; Sat, 17 Feb 2018 12:31:42 -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.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 12:31:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 17 Feb 2018 12:31:17 -0800 Message-Id: <20180217203132.31780-5-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:c00::242 Subject: [Qemu-devel] [PATCH 04/19] target/hppa: Convert remainder of system insns 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 | 92 ++++++++++++++++++++++-------------------------- target/hppa/insns.decode | 12 +++++++ 2 files changed, 55 insertions(+), 49 deletions(-) -- 2.14.3 Reviewed-by: Bastian Koppelmann diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 9b2de2fa2a..ae5969be0b 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -290,6 +290,18 @@ typedef struct DisasContext { bool psw_n_nonzero; } DisasContext; +/* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */ +static int expand_sm_imm(int val) +{ + if (val & PSW_SM_E) { + val = (val & ~PSW_SM_E) | PSW_E; + } + if (val & PSW_SM_W) { + val = (val & ~PSW_SM_W) | PSW_W; + } + return val; +} + /* Include the auto-generated decoder. */ #include "decode.inc.c" @@ -2007,7 +2019,7 @@ static void trans_break(DisasContext *ctx, arg_break *a, uint32_t insn) nullify_end(ctx); } -static void trans_sync(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_sync(DisasContext *ctx, arg_sync *a, uint32_t insn) { /* No point in nullifying the memory barrier. */ tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); @@ -2187,20 +2199,18 @@ static void trans_mtsarcm(DisasContext *ctx, arg_mtsarcm *a, uint32_t insn) cond_free(&ctx->null_cond); } -static void trans_ldsid(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_ldsid(DisasContext *ctx, arg_ldsid *a, uint32_t insn) { - unsigned rt = extract32(insn, 0, 5); + unsigned rt = a->t; TCGv_reg dest = dest_gpr(ctx, rt); #ifdef CONFIG_USER_ONLY /* We don't implement space registers in user mode. */ tcg_gen_movi_reg(dest, 0); #else - unsigned rb = extract32(insn, 21, 5); - unsigned sp = extract32(insn, 14, 2); TCGv_i64 t0 = tcg_temp_new_i64(); - tcg_gen_mov_i64(t0, space_select(ctx, sp, load_gpr(ctx, rb))); + tcg_gen_mov_i64(t0, space_select(ctx, a->sp, load_gpr(ctx, a->b))); tcg_gen_shri_i64(t0, t0, 32); tcg_gen_trunc_i64_reg(dest, t0); @@ -2211,28 +2221,14 @@ static void trans_ldsid(DisasContext *ctx, uint32_t insn, const DisasInsn *di) cond_free(&ctx->null_cond); } +static void trans_rsm(DisasContext *ctx, arg_rsm *a, uint32_t insn) +{ + CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); #ifndef CONFIG_USER_ONLY -/* Note that ssm/rsm instructions number PSW_W and PSW_E differently. */ -static target_ureg extract_sm_imm(uint32_t insn) -{ - target_ureg val = extract32(insn, 16, 10); - - if (val & PSW_SM_E) { - val = (val & ~PSW_SM_E) | PSW_E; - } - if (val & PSW_SM_W) { - val = (val & ~PSW_SM_W) | PSW_W; - } - return val; -} - -static void trans_rsm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) -{ - unsigned rt = extract32(insn, 0, 5); - target_ureg sm = extract_sm_imm(insn); + unsigned rt = a->t; + target_ureg sm = a->i; TCGv_reg tmp; - CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); nullify_over(ctx); tmp = get_temp(ctx); @@ -2244,15 +2240,17 @@ static void trans_rsm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) /* Exit the TB to recognize new interrupts, e.g. PSW_M. */ ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; nullify_end(ctx); +#endif } -static void trans_ssm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void trans_ssm(DisasContext *ctx, arg_ssm *a, uint32_t insn) { - unsigned rt = extract32(insn, 0, 5); - target_ureg sm = extract_sm_imm(insn); + CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); +#ifndef CONFIG_USER_ONLY + unsigned rt = a->t; + target_ureg sm = a->i; TCGv_reg tmp; - CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); nullify_over(ctx); tmp = get_temp(ctx); @@ -2264,8 +2262,8 @@ static void trans_ssm(DisasContext *ctx, uint32_t insn, const DisasInsn *di) /* Exit the TB to recognize new interrupts, e.g. PSW_I. */ ctx->base.is_jmp = DISAS_IAQ_N_STALE_EXIT; nullify_end(ctx); +#endif } -#endif /* !CONFIG_USER_ONLY */ static void trans_mtsm(DisasContext *ctx, arg_mtsm *a, uint32_t insn) { @@ -2284,15 +2282,13 @@ static void trans_mtsm(DisasContext *ctx, arg_mtsm *a, uint32_t insn) #endif } -#ifndef CONFIG_USER_ONLY -static void trans_rfi(DisasContext *ctx, uint32_t insn, const DisasInsn *di) +static void do_rfi(DisasContext *ctx, bool rfi_r) { - unsigned comp = extract32(insn, 5, 4); - CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); +#ifndef CONFIG_USER_ONLY nullify_over(ctx); - if (comp == 5) { + if (rfi_r) { gen_helper_rfi_r(cpu_env); } else { gen_helper_rfi(cpu_env); @@ -2306,8 +2302,20 @@ static void trans_rfi(DisasContext *ctx, uint32_t insn, const DisasInsn *di) ctx->base.is_jmp = DISAS_NORETURN; nullify_end(ctx); +#endif } +static void trans_rfi(DisasContext *ctx, arg_rfi *a, uint32_t insn) +{ + do_rfi(ctx, false); +} + +static void trans_rfi_r(DisasContext *ctx, arg_rfi_r *a, uint32_t insn) +{ + do_rfi(ctx, true); +} + +#ifndef CONFIG_USER_ONLY static void gen_hlt(DisasContext *ctx, int reset) { CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); @@ -2322,17 +2330,6 @@ static void gen_hlt(DisasContext *ctx, int reset) } #endif /* !CONFIG_USER_ONLY */ -static const DisasInsn table_system[] = { - { 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 }, - { 0x00000c00u, 0xfffffe1fu, trans_rfi }, -#endif -}; - static void trans_base_idx_mod(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { @@ -4512,9 +4509,6 @@ static void translate_one(DisasContext *ctx, uint32_t insn) opc = extract32(insn, 26, 6); switch (opc) { - case 0x00: /* system op */ - translate_table(ctx, insn, table_system); - return; case 0x01: translate_table(ctx, insn, table_mem_mgmt); return; diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 01b8a52ca5..b2131a269b 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -23,6 +23,8 @@ %assemble_sr3 13:1 14:2 +%sm_imm 16:10 !function=expand_sm_imm + #### # System #### @@ -37,3 +39,13 @@ 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 + +sync 000000 ----- ----- 000 00100000 00000 # sync, syncdma + +ldsid 000000 b:5 ----- sp:2 0 10000101 t:5 + +rsm 000000 .......... 000 01110011 t:5 i=%sm_imm +ssm 000000 .......... 000 01101011 t:5 i=%sm_imm + +rfi 000000 ----- ----- --- 01100000 00000 +rfi_r 000000 ----- ----- --- 01100101 00000