From nobody Wed Nov 27 00:43:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1703013478; cv=none; d=zohomail.com; s=zohoarc; b=H59tCfmL2MJn3ZU040sLYlydJJ1xIZj6ebLgMDsjxLHjnrpwb04Z45uhIvb4X6VspBy8J3BLgdINwZUT9e/wN/JyHUS2Q5KrW8UUenJ+SdMGETVh2v6xP272+Isu0lingtSAxQc/u9hYdBeZL7wd50x79UoINzGK3UuiIEiWfWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703013478; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=Ku+7zxeUKUJMUxVPqQDK2gFDtGrYkzffZzuDnYb6rLU=; b=nKGDxp7CXvESzmIq4l8y103PquG3PXaw52mUhgOr5doKTca1LZABA8mWdIt/SCSOhsHvHa1PVZE7hSLgD7rh3TERMfzTN+l8ScyNHuNWywKF/VHgP33l+69IC+tKneTajBPlMBau+9n+U2bMUlBBfrFvuSqZcv7enHGleEyU8Yc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1703013478196456.1067952624154; Tue, 19 Dec 2023 11:17:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFfX6-000215-D6; Tue, 19 Dec 2023 14:13:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rFfX4-0001zd-40 for qemu-devel@nongnu.org; Tue, 19 Dec 2023 14:13:34 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFfWz-0001sl-B9 for qemu-devel@nongnu.org; Tue, 19 Dec 2023 14:13:32 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-336417c565eso4661219f8f.3 for ; Tue, 19 Dec 2023 11:13:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f5-20020a5d5685000000b0033657376b62sm12007754wrv.105.2023.12.19.11.13.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 11:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703013208; x=1703618008; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ku+7zxeUKUJMUxVPqQDK2gFDtGrYkzffZzuDnYb6rLU=; b=iDK1gF4jGdB5k6JhJOxN5/TF156oA8Z6XE24HLxIydKmuLCpsb2rstxORr+qM3vtKg 17TOAChFMCfX9oCfQECrAJEg6Azf6VdID6mDS5iPcBEYyBKVlzt5c2eCFYqhPI736qmr z825Be4G9pNGweMgAyz9+ZEUk9UWwQedHJWMI5gjrDLzojPMEE33qBHWkk4GgjPmDd7x 7zR7b5ebFfkC+tJGM4beo7u/BZI6XBqta9NkHHAWDqpzISd27gjIEitwo9yVpO1PTljr mOTYaQOlmZpY3VbhlpWPOL6VsUMQsx4LjhB0zvVIwr01a10kCGnnkxZDUOMaMtWtEufs QCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703013208; x=1703618008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ku+7zxeUKUJMUxVPqQDK2gFDtGrYkzffZzuDnYb6rLU=; b=SFwVlv6MqNRbjPNCwx6EJ5hbT/KP3Kqq4rBYVTVojD7E8Gjy1xFjvrRZ3vYwJ6UsSf fxxHDp48zdJUI1oxwaUc3EH4U/njb/kSTeVb5yAT6kjy9dQFYjFSQ9H3tmYrJFRgZbM3 3xxzHg++NXV6I/o3qbXSamWvStDq6Lt7BycTNiePiL64zE24XkyBu8yKOZSQNM4q/Qem TOsaeMVEQxacnGJP68zQd/fmszuuyHCgLs6yIK+Ds4BNGX94lw0F7DqKpKhV5x633Cfq CWeZvWfpger7aqmlw1u7aDIU6HBPZ31XufmENVm9rW+zr4xnSE4ywtzPl8hAi0DL4GCZ g6sg== X-Gm-Message-State: AOJu0YzPLCATRGBHPGSNn151GcAYHY9CmhaEIVx3WeTHCWRgLO9Lnd9I bPf9jwY/ZnwHNPXK9cH8bcZQ0Jd8dpUjQmy92a8= X-Google-Smtp-Source: AGHT+IElnIP5Id16grkP17VHgilK0qg5TH9wnMC2m/E5OIi9DIMGcM52SECJ8yT3fJsjCznt6GBMJA== X-Received: by 2002:a5d:588a:0:b0:336:6b74:87e9 with SMTP id n10-20020a5d588a000000b003366b7487e9mr1335492wrf.14.1703013208003; Tue, 19 Dec 2023 11:13:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 39/43] target/arm: Restrict TCG specific helpers Date: Tue, 19 Dec 2023 19:13:03 +0000 Message-Id: <20231219191307.2895919-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219191307.2895919-1-peter.maydell@linaro.org> References: <20231219191307.2895919-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1703013478954100004 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20231130142519.28417-2-philmd@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 55 -------------------------------------- target/arm/tcg/op_helper.c | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 39830c7f948..5d4796b99a8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10142,61 +10142,6 @@ void cpsr_write(CPUARMState *env, uint32_t val, ui= nt32_t mask, } } =20 -/* Sign/zero extend */ -uint32_t HELPER(sxtb16)(uint32_t x) -{ - uint32_t res; - res =3D (uint16_t)(int8_t)x; - res |=3D (uint32_t)(int8_t)(x >> 16) << 16; - return res; -} - -static void handle_possible_div0_trap(CPUARMState *env, uintptr_t ra) -{ - /* - * Take a division-by-zero exception if necessary; otherwise return - * to get the usual non-trapping division behaviour (result of 0) - */ - if (arm_feature(env, ARM_FEATURE_M) - && (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_DIV_0_TRP_MASK)) { - raise_exception_ra(env, EXCP_DIVBYZERO, 0, 1, ra); - } -} - -uint32_t HELPER(uxtb16)(uint32_t x) -{ - uint32_t res; - res =3D (uint16_t)(uint8_t)x; - res |=3D (uint32_t)(uint8_t)(x >> 16) << 16; - return res; -} - -int32_t HELPER(sdiv)(CPUARMState *env, int32_t num, int32_t den) -{ - if (den =3D=3D 0) { - handle_possible_div0_trap(env, GETPC()); - return 0; - } - if (num =3D=3D INT_MIN && den =3D=3D -1) { - return INT_MIN; - } - return num / den; -} - -uint32_t HELPER(udiv)(CPUARMState *env, uint32_t num, uint32_t den) -{ - if (den =3D=3D 0) { - handle_possible_div0_trap(env, GETPC()); - return 0; - } - return num / den; -} - -uint32_t HELPER(rbit)(uint32_t x) -{ - return revbit32(x); -} - #ifdef CONFIG_USER_ONLY =20 static void switch_mode(CPUARMState *env, int mode) diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index ea08936a852..9de0fa2d1f6 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -121,6 +121,61 @@ void HELPER(v8m_stackcheck)(CPUARMState *env, uint32_t= newvalue) } } =20 +/* Sign/zero extend */ +uint32_t HELPER(sxtb16)(uint32_t x) +{ + uint32_t res; + res =3D (uint16_t)(int8_t)x; + res |=3D (uint32_t)(int8_t)(x >> 16) << 16; + return res; +} + +static void handle_possible_div0_trap(CPUARMState *env, uintptr_t ra) +{ + /* + * Take a division-by-zero exception if necessary; otherwise return + * to get the usual non-trapping division behaviour (result of 0) + */ + if (arm_feature(env, ARM_FEATURE_M) + && (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_DIV_0_TRP_MASK)) { + raise_exception_ra(env, EXCP_DIVBYZERO, 0, 1, ra); + } +} + +uint32_t HELPER(uxtb16)(uint32_t x) +{ + uint32_t res; + res =3D (uint16_t)(uint8_t)x; + res |=3D (uint32_t)(uint8_t)(x >> 16) << 16; + return res; +} + +int32_t HELPER(sdiv)(CPUARMState *env, int32_t num, int32_t den) +{ + if (den =3D=3D 0) { + handle_possible_div0_trap(env, GETPC()); + return 0; + } + if (num =3D=3D INT_MIN && den =3D=3D -1) { + return INT_MIN; + } + return num / den; +} + +uint32_t HELPER(udiv)(CPUARMState *env, uint32_t num, uint32_t den) +{ + if (den =3D=3D 0) { + handle_possible_div0_trap(env, GETPC()); + return 0; + } + return num / den; +} + +uint32_t HELPER(rbit)(uint32_t x) +{ + return revbit32(x); +} + uint32_t HELPER(add_setq)(CPUARMState *env, uint32_t a, uint32_t b) { uint32_t res =3D a + b; --=20 2.34.1