From patchwork Sat Sep 15 16:17:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 146784 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1943141ljw; Sat, 15 Sep 2018 09:23:39 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda6nnyYkdCWUdzmr6QHGa0s54PieVOV4yMW+/ozzUMmqWPUNn1iLINYxlTBqjwtLUWyy37g X-Received: by 2002:a37:c392:: with SMTP id r18-v6mr12406428qkl.56.1537028619890; Sat, 15 Sep 2018 09:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537028619; cv=none; d=google.com; s=arc-20160816; b=AorqzAR/N88/7crDPvmdqVd+ziEURoFsFlmShyqiYpJJqoLBIDRbgHjD22FLW00dV6 1xD4Yxrp9+uVV8iOF7gKiK4Gxi12Efs3GRdwBIs20R7AmARYYRjUhV6o8jipDUClSMTS sbPoLokI4uEiAPESblmtNYHRSxVO79owqHSPkoYuL8UYt+wT0FX9DOOCVB2XyPQxB3k6 cikc/CBb6wur90Xx2/VXkXyhPUXh2GxI3WjUpbk719wtOfSrIJWCv5PGmiPZCKWRvmbM 6fkZnv3F09AUDRmxiTrLnr+jLVN3fclcw33hpcBof5er0H2Tiod40pONKrZLGhTkQBpp +4iA== 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=ZeBhA5gK6Nz1BUUeKdqdNFL5VVM/P7Tt/zCtWw9GfPs=; b=fFftGqpu1JwWTHaXb29FeAlp76OU1LIl8aOUjWrUO3QePxHmYrrxlvvGE0+EK+LLRp BAHleoLIZSNkGM20zcZ9ZGf1Hx9z+HuRf0EItZSBJOaDyEE65DTFm68sl/THqao3lmw1 GuGyFWMMjGGc5Sz5YcyBEUZ36x1zgTd/m+PRqTT1GCe6CdsabTbxY9tkJCREiVVl3U13 qKDrV5SVpCUxuTbTXQrQ+N2EZPk+6jZJQ217bSySpc5ODCdx2vU6JYNK2Qceg9VAjRZB aVei97L0rF8U07/ns0UnJLyGodGzGy+J/TcXuBNOmAIiMHUHkrbNUgkgsGdF9/SAbHl3 illg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZipBv+TR; 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 4-v6si2554976qkt.92.2018.09.15.09.23.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 15 Sep 2018 09:23:39 -0700 (PDT) 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=ZipBv+TR; 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]:56119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1DMB-0001Pd-8G for patch@linaro.org; Sat, 15 Sep 2018 12:23:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1DGW-0004UV-77 for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1DGS-0003rf-Bb for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:47 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:34607) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1DGS-0003qF-2S for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:44 -0400 Received: by mail-pg1-x541.google.com with SMTP id d19-v6so5764633pgv.1 for ; Sat, 15 Sep 2018 09:17:43 -0700 (PDT) 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=ZeBhA5gK6Nz1BUUeKdqdNFL5VVM/P7Tt/zCtWw9GfPs=; b=ZipBv+TRAxaO5DErzuMe4OEJGjbVr9s4j9CtUshJsEHnvnbeXQpx3GJoYcVclumgTd o4dHh1ygGFnQNJcO2hvHZE+zCVq/9w3yNc+Sj4YunmQ9WeGoBsVDqDFbFIEDDARxGDqN KvIAFpQBML9wFD3Nt9t3BT9sBniA1wOvWb7es= 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=ZeBhA5gK6Nz1BUUeKdqdNFL5VVM/P7Tt/zCtWw9GfPs=; b=O+bNDjF4K3+SwhAtyacmLHHj7rWWcEZ7hanBxsiIY9nNZdqWZu59O37K7zslAiHyaz fJzGDvuvVwUnEU3cV33soxfqVlTU6IDgwXLw4ByXdjwjG7Uxjiyr2ZemRRU8DUlKM3qL UaMilqpY2N0myzk7QiepwPKSEKLWWu24YJz3dsrFdJnfy+XtIZyO7Wt99KIiuKDe/yCf Psiw5i4ieMdbd43U0TMm0sye24Q778dwhcwUord1xuHnyHh+TqolxKwG8eSJ0UWqFCdX Xzl/Lpz2HZagsgS4l81YOUOXVCfOgtnHlfNc6Yr57Ffivh5VOZC3+VfOFXVtwi0ZAnz5 80kQ== X-Gm-Message-State: APzg51D21SKdlmBLWVwRhreyce2udLenDALuYAeEbhuXZAZJfHzPCLMy 43iwkv31yZYkEahZO5enwPBTB/NAMCw= X-Received: by 2002:a62:4e56:: with SMTP id c83-v6mr18189248pfb.240.1537028262612; Sat, 15 Sep 2018 09:17:42 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id k26-v6sm18648793pfb.167.2018.09.15.09.17.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Sep 2018 09:17:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 15 Sep 2018 09:17:26 -0700 Message-Id: <20180915161738.25257-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180915161738.25257-1-richard.henderson@linaro.org> References: <20180915161738.25257-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::541 Subject: [Qemu-devel] [PATCH 01/13] target/arm: Add ARM_FEATURE_SWP 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" These insns have been removed from the ISA, but are also not present on some cpus with V7VE. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 1 + linux-user/elfload.c | 3 ++- target/arm/cpu.c | 10 ++++++++++ target/arm/translate.c | 4 ++++ 4 files changed, 17 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 65c0fa0a65..acfb2f9104 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1495,6 +1495,7 @@ enum arm_features { ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ ARM_FEATURE_V8_FCMA, /* has complex number part of v8.3 extensions. */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ + ARM_FEATURE_SWP, /* implements swp/swpb */ }; static inline int arm_feature(CPUARMState *env, int feature) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 8638612aec..fcac2563f1 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -450,7 +450,6 @@ static uint32_t get_elf_hwcap(void) ARMCPU *cpu = ARM_CPU(thread_cpu); uint32_t hwcaps = 0; - hwcaps |= ARM_HWCAP_ARM_SWP; hwcaps |= ARM_HWCAP_ARM_HALF; hwcaps |= ARM_HWCAP_ARM_THUMB; hwcaps |= ARM_HWCAP_ARM_FAST_MULT; @@ -458,7 +457,9 @@ static uint32_t get_elf_hwcap(void) /* probe for the extra features */ #define GET_FEATURE(feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) + /* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */ + GET_FEATURE(ARM_FEATURE_SWP, ARM_HWCAP_ARM_SWP); GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 258ba6dcaa..3bc7a16327 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1075,6 +1075,7 @@ static void arm926_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); set_feature(&cpu->env, ARM_FEATURE_JAZELLE); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x41069265; cpu->reset_fpsid = 0x41011090; cpu->ctr = 0x1dd20d2; @@ -1089,6 +1090,7 @@ static void arm946_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_PMSA); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x41059461; cpu->ctr = 0x0f004006; cpu->reset_sctlr = 0x00000078; @@ -1105,6 +1107,7 @@ static void arm1026_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); set_feature(&cpu->env, ARM_FEATURE_JAZELLE); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; @@ -1139,6 +1142,7 @@ static void arm1136_r2_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x4107b362; cpu->reset_fpsid = 0x410120b4; cpu->mvfr0 = 0x11111111; @@ -1171,6 +1175,7 @@ static void arm1136_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x4117b363; cpu->reset_fpsid = 0x410120b4; cpu->mvfr0 = 0x11111111; @@ -1204,6 +1209,7 @@ static void arm1176_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG); set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS); set_feature(&cpu->env, ARM_FEATURE_EL3); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x410fb767; cpu->reset_fpsid = 0x410120b5; cpu->mvfr0 = 0x11111111; @@ -1235,6 +1241,7 @@ static void arm11mpcore_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_VAPA); set_feature(&cpu->env, ARM_FEATURE_MPIDR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x410fb022; cpu->reset_fpsid = 0x410120b4; cpu->mvfr0 = 0x11111111; @@ -1378,6 +1385,7 @@ static void cortex_r5_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_ARM_DIV); set_feature(&cpu->env, ARM_FEATURE_V7MP); set_feature(&cpu->env, ARM_FEATURE_PMSA); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x411fc153; /* r1p3 */ cpu->id_pfr0 = 0x0131; cpu->id_pfr1 = 0x001; @@ -1426,6 +1434,7 @@ static void cortex_a8_initfn(Object *obj) set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_EL3); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x410fc080; cpu->reset_fpsid = 0x410330c0; cpu->mvfr0 = 0x11110222; @@ -1500,6 +1509,7 @@ static void cortex_a9_initfn(Object *obj) */ set_feature(&cpu->env, ARM_FEATURE_V7MP); set_feature(&cpu->env, ARM_FEATURE_CBAR); + set_feature(&cpu->env, ARM_FEATURE_SWP); cpu->midr = 0x410fc090; cpu->reset_fpsid = 0x41033090; cpu->mvfr0 = 0x11110222; diff --git a/target/arm/translate.c b/target/arm/translate.c index c6a5d2ac44..2688380ae6 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9390,6 +9390,10 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) TCGv taddr; TCGMemOp opc = s->be_data; + if (!arm_dc_feature(s, ARM_FEATURE_SWP)) { + goto illegal_op; + } + rm = (insn) & 0xf; if (insn & (1 << 22)) {