Received: from eggs.gnu.org ([2001:4830:134:3::10]:36718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvRRE-0001Yb-2m for qemu-devel@nongnu.org; Sat, 06 Jul 2013 08:18:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvRRC-0002MM-5S for qemu-devel@nongnu.org; Sat, 06 Jul 2013 08:18:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53400 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvRRB-0002Lu-VN for qemu-devel@nongnu.org; Sat, 06 Jul 2013 08:18:02 -0400 From: Alexander Graf Date: Sat, 6 Jul 2013 14:17:50 +0200 Message-Id: <1373113077-11698-3-git-send-email-agraf@suse.de> In-Reply-To: <1373113077-11698-1-git-send-email-agraf@suse.de> References: <1373113077-11698-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 2/9] user-exec.c: Set is_write correctly in the ARM cpu_signal_handler() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Riku Voipio From: Peter Maydell In the ARM implementation of cpu_signal_handler(), set is_write correctly using the FSR value which the kernel passes us in the error_code field of uc_mcontext. Since the WnR bit of the FSR was only introduced in ARMv6, this means that v5 cores will continue to behave as before this patch, but they are not really supported as hosts for linux-user mode anyway since they do not have the modern behaviour for unaligned accesses. Signed-off-by: Peter Maydell Acked-by: Alexander Graf Signed-off-by: Alexander Graf --- user-exec.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/user-exec.c b/user-exec.c index ed15f1e..82bfa66 100644 --- a/user-exec.c +++ b/user-exec.c @@ -20,6 +20,7 @@ #include "cpu.h" #include "disas/disas.h" #include "tcg.h" +#include "qemu/bitops.h" #undef EAX #undef ECX @@ -446,8 +447,11 @@ int cpu_signal_handler(int host_signum, void *pinfo, #else pc = uc->uc_mcontext.arm_pc; #endif - /* XXX: compute is_write */ - is_write = 0; + + /* error_code is the FSR value, in which bit 11 is WnR (assuming a v6 or + * later processor; on v5 we will always report this as a read). + */ + is_write = extract32(uc->uc_mcontext.error_code, 11, 1); return handle_cpu_signal(pc, (unsigned long)info->si_addr, is_write, &uc->uc_sigmask, puc); -- 1.6.0.2