From patchwork Fri Jun 4 15:51:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 454147 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp653956jae; Fri, 4 Jun 2021 11:25:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzKZgJfVIPQ/SDKSslMETJ6ArND2QyVMkM/phh3FJzVYkAlwTbsCh8FxWXA7Ty5Ohj65Ov X-Received: by 2002:a9d:7d8e:: with SMTP id j14mr2139580otn.336.1622831107526; Fri, 04 Jun 2021 11:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622831107; cv=none; d=google.com; s=arc-20160816; b=mjQ88a1IncGnzHzDmFbfvqPhe04m49DYJL+OlbYrmDAJlykInv2XwTC+opAUg1HGWJ uGk5VMlX/e8hAGPcgY6fY6n6fbjM9VFco7MEmLWpb2s2gSBU+s6C6JI8Ns1tWMNRRSIG DfUlbVbp1l4/fEr/XRjRdK638Nn1O4ckIbjTSahxVvFdGIwS30IjFqrPuehUCapZu39n XZYCBxL94S9CIDflgxPIIbA9H1bib0p1c0KJsNcgW5+a9TFD9qyR/jPYbMxbpRXdfIEY EuEoG6EWy7mlVayaOb2VWdSoWuVFWZPwcDArfdw8NXxmjvVx9qRxXiTy9WHTvarkfmOS ywtQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dUqxN4lb+GfiuAaelODfQHE3gWgKHRBOE5j2GQAObTg=; b=hyOqGUWq/ne1S/0QwQSeOKFRigwEQQNIiIYdVg6CEkhvyzo10UoHObxSA12trgT1ZD D6XJdsik3N2RewfXDIVIFTUmO5CNHHKMNr8jD0mENquLe4YjVCZVZSTzl0G2XD2/ws+j uVW6xrhpn1mjof/Kl2w1txA0Qd4cY35TTQUPniSuWEfYivCsUWoKHbMoQRqMoRqFLaZ2 Di+j3i48iKNOtgakWnTtl/z+xA7zff1tg3K7bn+ZpG6ceur+xkyTzuoDyHsvSv0++WP1 dkdBU/RMrfMolGKvLJpN4lNwelsjUuLYvHNa8Sx73OOZGkk6PV260UFtXL6mjqrpP/Lw BP0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=con1IPL0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id t13si1704158otr.249.2021.06.04.11.25.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jun 2021 11:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=con1IPL0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:42174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpEVG-000738-VD for patch@linaro.org; Fri, 04 Jun 2021 14:25:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpET3-0000rJ-0g for qemu-devel@nongnu.org; Fri, 04 Jun 2021 14:22:49 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpESv-0000Jt-2N for qemu-devel@nongnu.org; Fri, 04 Jun 2021 14:22:48 -0400 Received: by mail-wr1-x42e.google.com with SMTP id y7so5556985wrh.7 for ; Fri, 04 Jun 2021 11:22:40 -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 :mime-version:content-transfer-encoding; bh=dUqxN4lb+GfiuAaelODfQHE3gWgKHRBOE5j2GQAObTg=; b=con1IPL0H5Citz/LQVNUjQpcsxmgkwNYBNV+VAnRxx2DTqj9xwtk0zKC6/PmD+h/3c ko+vjrFDOg2zK6vLv7abojdId7lbwhUELOlt9w6lDUo65VdLyOqDizIxlArxYQUQA/l2 up+B1Ml8eYmWMEkl1hAYHYjuHmuByNNAghbZIsCh38RViJE3IOl9yuy3hcyKcc+MTU2t U0gRXemaHaVoYHqnxO/I6Ye6IvV/XQi4mbNAyu8vnmC74hq7YqD7lraBooglFZLoeHkg yIWpaU8LfcWdAjgwOT9g8Abm9h0K0YvyqQ9HsYg//T2CZn8BNHJn9NSpLyGUy4nXloZL 5opg== 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:mime-version:content-transfer-encoding; bh=dUqxN4lb+GfiuAaelODfQHE3gWgKHRBOE5j2GQAObTg=; b=msL3Ad0CUNcJuoGMq9QV6CRbwKH1hUl7x7mAQu2+4yXH5V1Talt6ySIJF5/87yd9dz 0a9f/maigvbB9jClx1p1RL2vxHCfDhDVL9BCJ46WKjXJbZYZanQZ6DVUa0fGAvLbzYMQ vTMbabUw/NfhgercoxXENpRiRdh+hh7nSCtvFAHvn0Kx5WXs/9A6ARWE4NK7wDdgD9ef UcM9TYCNlh4UsZQH8dWI9xYVOBFNFOonGp2eT2aUbG4aSjGkoWJEEyRMBEq6qbsabCv3 ELgvOaKAIqgVEzBwS15qNSlUw6ihJno+LldD8PRwdp06vWLTV3pmJUHJ2+xVkdk3JF4O jPjw== X-Gm-Message-State: AOAM530KC5F6YkXtbSeNu6dMpBtyx9Aclz8DYaI8moDGYs9BmQaB6cb/ kOCQErXgQ5JPVnByH3f26IpBRA== X-Received: by 2002:adf:f7c3:: with SMTP id a3mr4752291wrq.253.1622830959561; Fri, 04 Jun 2021 11:22:39 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y189sm6540544wmy.25.2021.06.04.11.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 11:22:38 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7351C1FFAA; Fri, 4 Jun 2021 16:53:14 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v16 20/99] target/arm: tcg: move sysemu-only parts of debug_helper Date: Fri, 4 Jun 2021 16:51:53 +0100 Message-Id: <20210604155312.15902-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210604155312.15902-1-alex.bennee@linaro.org> References: <20210604155312.15902-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Richard Henderson , Claudio Fontana , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Claudio Fontana move sysemu-only parts of debug_helper to sysemu/ Signed-off-by: Claudio Fontana Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Alex Bennée --- target/arm/tcg/debug_helper.c | 27 ----------------------- target/arm/tcg/sysemu/debug_helper.c | 33 ++++++++++++++++++++++++++++ target/arm/tcg/sysemu/meson.build | 1 + 3 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 target/arm/tcg/sysemu/debug_helper.c -- 2.20.1 diff --git a/target/arm/tcg/debug_helper.c b/target/arm/tcg/debug_helper.c index 2ff72d47d1..66a0915393 100644 --- a/target/arm/tcg/debug_helper.c +++ b/target/arm/tcg/debug_helper.c @@ -308,30 +308,3 @@ void arm_debug_excp_handler(CPUState *cs) arm_debug_target_el(env)); } } - -#if !defined(CONFIG_USER_ONLY) - -vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) -{ - ARMCPU *cpu = ARM_CPU(cs); - CPUARMState *env = &cpu->env; - - /* - * In BE32 system mode, target memory is stored byteswapped (on a - * little-endian host system), and by the time we reach here (via an - * opcode helper) the addresses of subword accesses have been adjusted - * to account for that, which means that watchpoints will not match. - * Undo the adjustment here. - */ - if (arm_sctlr_b(env)) { - if (len == 1) { - addr ^= 3; - } else if (len == 2) { - addr ^= 2; - } - } - - return addr; -} - -#endif diff --git a/target/arm/tcg/sysemu/debug_helper.c b/target/arm/tcg/sysemu/debug_helper.c new file mode 100644 index 0000000000..0bce00144f --- /dev/null +++ b/target/arm/tcg/sysemu/debug_helper.c @@ -0,0 +1,33 @@ +/* + * ARM debug helpers. + * + * This code is licensed under the GNU GPL v2 or later. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "qemu/osdep.h" +#include "cpu.h" +#include "internals.h" + +vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) +{ + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + + /* + * In BE32 system mode, target memory is stored byteswapped (on a + * little-endian host system), and by the time we reach here (via an + * opcode helper) the addresses of subword accesses have been adjusted + * to account for that, which means that watchpoints will not match. + * Undo the adjustment here. + */ + if (arm_sctlr_b(env)) { + if (len == 1) { + addr ^= 3; + } else if (len == 2) { + addr ^= 2; + } + } + + return addr; +} diff --git a/target/arm/tcg/sysemu/meson.build b/target/arm/tcg/sysemu/meson.build index 6f014f77ec..1a4d7a0940 100644 --- a/target/arm/tcg/sysemu/meson.build +++ b/target/arm/tcg/sysemu/meson.build @@ -1,3 +1,4 @@ arm_softmmu_ss.add(when: 'CONFIG_TCG', if_true: files( + 'debug_helper.c', 'mte_helper.c', ))