From patchwork Tue Jun 26 16:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140016 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5445553lji; Tue, 26 Jun 2018 09:23:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOBtcZePOCea6kzabNng///xrGa3pz8YdT6Dpxy/fA1oJrN/6a3fmYjmiYklzgzyG0umsL X-Received: by 2002:aed:32c5:: with SMTP id z63-v6mr2125668qtd.106.1530030193839; Tue, 26 Jun 2018 09:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530030193; cv=none; d=google.com; s=arc-20160816; b=rjobBD/WJ6Jxigub/QbR+T8+/Kbh8UJXAbtSTvXv19YOgy45vhmnE2Q/584Jgy7Qma vY2davkMGahtS9bRht4V4hfXvqJynhJmgRg+VtjnslpoxsN7fN4/tM42G4dHIhV5Qiz5 3fmSN6rfpnSXMFv8OGvf67l5A2ADSGdvOwfOXJYUnbykNMCC8FYbnjpAErCjuuqjwhK2 tiJMkNtvbxHZ/ApKUV6jYiJ9KOT2nZ4xueTwWQja3bwUYqelW4+WsArF2igM5K2Ki2gD 2ojusbTAPscQMrz9Vb1gE/uHPl828sM5ettRd2Y897fjKDlbd90HY5jUyYwlfLTT8XMm Bu4A== 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:arc-authentication-results; bh=ZLWqrKTay5s2fLcjH27HhBkYzDQBc58NJK/v5oxeTOw=; b=GK0b0IFIEX8/LkC+2RZUfexTAKmS+eD33/M3GsE0OOk1kiKV+8Nd8WRu+vU4oUDsQj gDuGOGp+7VoWWu6hEifhqGCoETSIXhaXw5TDfWPVw8WMyNjAoQr2GjH0PLU0IV7XsEHu oMA2+JNjPUPTJNkxbf++faz7WhD8edsbxpxkaQfyUBTFqmyICUTFveREBpd1EuFz1ZIJ MOEROPWgCp4eS9ogGIiMx+UA+d3haSEBaTBSj84Gn8n5F5mLBlLzNrgh0/hW34+SdpG9 NUZ3qpbdsDcClfFUMJ+xbgoWcsklr280cY06Yhjjm0ytMPfTlDbZIvNIzCI5Nm0xwgkK QwbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OJtRphyM; 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 k45-v6si1905227qvk.217.2018.06.26.09.23.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jun 2018 09:23:13 -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=OJtRphyM; 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]:53766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqkL-0003RI-4M for patch@linaro.org; Tue, 26 Jun 2018 12:23:13 -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) 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-Received: by 2002:a62:1fd6:: with SMTP id l83-v6mr2268806pfj.182.1530029964566; Tue, 26 Jun 2018 09:19:24 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.1 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, CPUPPCState *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 address */ +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" //#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 = 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 = cpu_ldl_code(env, env->nip); + + cs->exception_index = POWERPC_EXCP_ALIGN; + env->error_code = insn & 0x03FF0000; + cpu_loop_exit(cs); +} diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.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, void *data) cc->set_pc = ppc_cpu_set_pc; cc->gdb_read_register = ppc_cpu_gdb_read_register; cc->gdb_write_register = ppc_cpu_gdb_write_register; + cc->do_unaligned_access = ppc_cpu_do_unaligned_access; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = ppc_cpu_handle_mmu_fault; #else