From nobody Tue Nov 4 15:26:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530030295956601.7694448780953; Tue, 26 Jun 2018 09:24:55 -0700 (PDT) Received: from localhost ([::1]:53777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqlv-0004Yr-QZ for importer@patchew.org; Tue, 26 Jun 2018 12:24:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqgh-0000sC-MN for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXqgg-0005rB-0j for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:27 -0400 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:38663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXqgf-0005qs-RL for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:25 -0400 Received: by mail-pg0-x22d.google.com with SMTP id c9-v6so7848532pgf.5 for ; Tue, 26 Jun 2018 09:19:25 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id 67-v6sm5054306pfm.171.2018.06.26.09.19.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 09:19:23 -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=ZLWqrKTay5s2fLcjH27HhBkYzDQBc58NJK/v5oxeTOw=; b=OJtRphyMO5W1hGRRJOQNuoLYfZvRGvwLJ8R9OGgfhZD4soI6WtCd9xcck1F7k1Fk9D sLgnuKtjuxpTmCog9R1vwDSdvbpPEwUq7DMuqo4ylI97kh4yKNTxEty9dinmjpI+0MgL UGCkkO/kY2kNjIhy8w91Wrv6SjJcVhnAyEIzg= 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=ZLWqrKTay5s2fLcjH27HhBkYzDQBc58NJK/v5oxeTOw=; b=co/CBbOWaFjd+s2qt7PHO/H6oPX6G9Wytrhn80Bekd0+X0CL/b2UCrq2bR/KhOlIf3 HYs+GbMd3/5Q68GLzyLzrq0Z8pvfFnKjlKwdTiv64m6B2DSFSco+GnGaaW8OZSOqa9a3 V4rBPDrROyfNKZD8nAIkelONti74ksRR+zhMGPAUxtbcr0xgIOeOsAHkVRJu57FgR/FJ diGPZbWw09roXOGYpqgEWfOPGjohQe0aWnYl6R1JBJzyg4t6utfIELcbRzuI1IXXY0v1 EaWMFRw3ZjRozznubU0MEVn5onN5WEy9JgLgT5EvVt5zi0n2zEtkW2tHUk+WMwMnmEel NH4w== X-Gm-Message-State: APt69E2qmLJG3WMkaoHLioGYV+thcrTNtNQ/2OqvC8nc8Ugy2UzM1XzP rDR9/ohYqRPt0OSuL+016a9kty5bUaw= X-Google-Smtp-Source: AAOMgpcEHMQJVovtFzBEQ/VHexozRFm8J4lvrdqM40z7ivzKKfWucyB31bi3Jp646t6P0MuDpzirEg== X-Received: by 2002:a62:1fd6:: with SMTP id l83-v6mr2268806pfj.182.1530029964566; Tue, 26 Jun 2018 09:19:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 09:19:09 -0700 Message-Id: <20180626161921.27941-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626161921.27941-1-richard.henderson@linaro.org> References: <20180626161921.27941-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:c05::22d Subject: [Qemu-devel] [PATCH 01/13] target/ppc: Add do_unaligned_access hook 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows faults from MO_ALIGN to have the same effect as from gen_check_align. Signed-off-by: Richard Henderson --- target/ppc/internal.h | 5 +++++ target/ppc/excp_helper.c | 18 +++++++++++++++++- target/ppc/translate_init.inc.c | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 1f441c6483..a9bcadff42 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -252,4 +252,9 @@ static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPC= State *env) void helper_compute_fprf_float16(CPUPPCState *env, float16 arg); void helper_compute_fprf_float32(CPUPPCState *env, float32 arg); void helper_compute_fprf_float128(CPUPPCState *env, float128 arg); + +/* Raise a data fault alignment exception for the specified virtual addres= s */ +void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr); #endif /* PPC_INTERNAL_H */ diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index c092fbead0..d6e97a90e0 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -22,7 +22,7 @@ #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" - +#include "internal.h" #include "helper_regs.h" =20 //#define DEBUG_OP @@ -1198,3 +1198,19 @@ void helper_book3s_msgsnd(target_ulong rb) qemu_mutex_unlock_iothread(); } #endif + +void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) +{ + CPUPPCState *env =3D cs->env_ptr; + uint32_t insn; + + /* Restore state and reload the insn we executed, for filling in DSISR= . */ + cpu_restore_state(cs, retaddr, true); + insn =3D cpu_ldl_code(env, env->nip); + + cs->exception_index =3D POWERPC_EXCP_ALIGN; + env->error_code =3D insn & 0x03FF0000; + cpu_loop_exit(cs); +} diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 76d6f3fd5e..7813b1b004 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -10457,6 +10457,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) cc->set_pc =3D ppc_cpu_set_pc; cc->gdb_read_register =3D ppc_cpu_gdb_read_register; cc->gdb_write_register =3D ppc_cpu_gdb_write_register; + cc->do_unaligned_access =3D ppc_cpu_do_unaligned_access; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault =3D ppc_cpu_handle_mmu_fault; #else --=20 2.17.1