From patchwork Wed Oct 13 02:45:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515691 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp6085702ime; Tue, 12 Oct 2021 19:59:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOfyF9llWT98psGljgrPP/Zf2SfqgDBW3ZVk0jgb6u26RWkZD6poDcrZyVvmasop1HXDH9 X-Received: by 2002:a05:6602:26c9:: with SMTP id g9mr26848667ioo.207.1634093974679; Tue, 12 Oct 2021 19:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634093974; cv=none; d=google.com; s=arc-20160816; b=zIwBc2YbGN5btEwfM+A2xEHv1EoeluoDVvr7dRu0LifBVHmWYfRh3fxR01aRrf9V9Q GOlJacqTNUFbels6pGH0Yrb1lFJ9NBeEYgSJzKuSRW4yrSf6tIypORBrMYDZiMwi/dmo qK6C1Gzx41+Fncj3jfRE+Tp8XnyT9+W8Prqa8rh1mpAA92y3IC4htuvu5WNEtq1wkUUn rlLhPdS9bfGwUG4Dpm61FJay8auEOOQxHWAqceeyRWZplAWbOsUIrlwfA1vKzp775cjK p6rlFBb5FL0bmJ5TAa3YF36vl9mREafme8byEpmCRITz02DLcalxMkbavTl9oYUO0uUd 1c8g== 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=jfz53S3QlKXNPBsRIkUXBiTrLPBdQUAc4SLrCyr0OTo=; b=oyCKGNnW3NX0IqhkPJ1V7z6vOlrO8f022tPJPoull8Fjza4XsRSwkUUG3JZTghRrnl QgIZnZfWSzGSDA8IsFEi1ZCIQW1rvhnJfyhIp895gBWTCQvHh15RArixG33zK08QWvoc FG+RDKCb9AATsaS7d9dhQuH4lisHg3H899NqCqCaZV89DRR+9//hglOb9SoLWzcsNN21 1rQE59t2DfT6Yh/wE5sL6tkLjuAKNsR9hEyr5tdB6KAGRKTyteep7BBn4JgTEBV2oNLg 7aJJtQnKWxnWFlAsiOT7xdpAV17oqAcDirWtXwdmdIXL3WdUa5YiPTJormRNY1Rk/2Zq UgYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TyH11BbE; 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 g3si9959997jat.38.2021.10.12.19.59.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Oct 2021 19:59:34 -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=TyH11BbE; 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]:56210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maUUQ-000095-31 for patch@linaro.org; Tue, 12 Oct 2021 22:59:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maUHy-0004wo-D8 for qemu-devel@nongnu.org; Tue, 12 Oct 2021 22:46:42 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:46723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maUHw-00056N-Qw for qemu-devel@nongnu.org; Tue, 12 Oct 2021 22:46:42 -0400 Received: by mail-pf1-x431.google.com with SMTP id t15so1120425pfl.13 for ; Tue, 12 Oct 2021 19:46:39 -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=jfz53S3QlKXNPBsRIkUXBiTrLPBdQUAc4SLrCyr0OTo=; b=TyH11BbEZlhZZ9CwLFfuKqI5Slkl3q8NgO2ONI2unalRU205XAqYLYiggtzAHObMah Yh2m2uiMIaOTnLzcAY1dkt+VN+AtrwVRE2EIHmMWIQfkqVD+GmgnEWdDN7v0+hYS2Obm vwjQvMgdanDVN93HsVSLX3ZnsKcqsWVuLnRObWWs1N2D3nYm4etBfJMvM0lV2pWUURoB 3zifmzISTh5CxScwTJXj4vyBCCq9PBuYhds1LdAdZjAKWOeYtwRa8/BkHfB9kr2yIHhi icW3lnlsaL9cF2W2Aai5aK+uk1/vvPOSHiV9PrL1G4skbHlG8Lm/Weuj34duCD7jmonF aECg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jfz53S3QlKXNPBsRIkUXBiTrLPBdQUAc4SLrCyr0OTo=; b=Baj7+qWkr/pbMRJkPOqxcjftlXkwiMeE6OFdkJ3nC21BzVMjCNzb2rJBOVnoRkBwDv Ar/vpCiPn4DLOWZcUUrCxiwENZy2Tw1Bgb/dIPr35NCpl54Ttq+JXB6bbXi+bXo+75re plsfQbRKDeEwt77hzQOdUwYMY4aBSXoRxOd9x6BePKxcwz3wDSe+EBI85/o3Y1QLPcjh Uqew9mRmVRi6V3F8x+lo1J6AWtrm+ImOZURYHbsYty2tazti05+4n9OL9Gma4hhG7xmg Zi65YIAsc+kjd48287V7yj7dW+DdVGn2c/Of6PzPjutrww0qgwNJd1TT4WZaGxJKFRRc P/3g== X-Gm-Message-State: AOAM530TA9QOFkyDcwPRpwDrFnxRbch60FkB61VBWENT5BS1ehwMp7aj rJ8pxqHTT/W+tmUUnht/OGE9oxKOBfM= X-Received: by 2002:a63:b214:: with SMTP id x20mr25777738pge.460.1634093198930; Tue, 12 Oct 2021 19:46:38 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id qe17sm4855014pjb.39.2021.10.12.19.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 19:46:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 30/48] tcg: Add helper_unaligned_{ld, st} for user-only sigbus Date: Tue, 12 Oct 2021 19:45:49 -0700 Message-Id: <20211013024607.731881-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013024607.731881-1-richard.henderson@linaro.org> References: <20211013024607.731881-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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=ham 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" To be called from tcg generated code on hosts that support unaligned accesses natively, in response to an access that is supposed to be aligned. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/tcg/tcg-ldst.h | 5 +++++ accel/tcg/user-exec.c | 11 +++++++++++ 2 files changed, 16 insertions(+) -- 2.25.1 diff --git a/include/tcg/tcg-ldst.h b/include/tcg/tcg-ldst.h index 8c86365611..bf40942de4 100644 --- a/include/tcg/tcg-ldst.h +++ b/include/tcg/tcg-ldst.h @@ -70,5 +70,10 @@ void helper_be_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val, void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val, MemOpIdx oi, uintptr_t retaddr); +#else + +void QEMU_NORETURN helper_unaligned_ld(CPUArchState *env, target_ulong addr); +void QEMU_NORETURN helper_unaligned_st(CPUArchState *env, target_ulong addr); + #endif /* CONFIG_SOFTMMU */ #endif /* TCG_LDST_H */ diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 7d50dd54f6..0473ead5ab 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -27,6 +27,7 @@ #include "exec/helper-proto.h" #include "qemu/atomic128.h" #include "trace/trace-root.h" +#include "tcg/tcg-ldst.h" #include "internal.h" __thread uintptr_t helper_retaddr; @@ -217,6 +218,16 @@ static void validate_memop(MemOpIdx oi, MemOp expected) #endif } +void helper_unaligned_ld(CPUArchState *env, target_ulong addr) +{ + cpu_loop_exit_sigbus(env_cpu(env), addr, MMU_DATA_LOAD, GETPC()); +} + +void helper_unaligned_st(CPUArchState *env, target_ulong addr) +{ + cpu_loop_exit_sigbus(env_cpu(env), addr, MMU_DATA_STORE, GETPC()); +} + static void *cpu_mmu_lookup(CPUArchState *env, target_ulong addr, MemOpIdx oi, uintptr_t ra, MMUAccessType type) {