From patchwork Tue Jan 23 14:48:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 125528 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1804457ljf; Tue, 23 Jan 2018 06:57:27 -0800 (PST) X-Google-Smtp-Source: AH8x226I9g6teZ04f4vWqMb/LqcQY40lkn1GldMxKsf2McdVN8Kpt4ZkW4dOowUr5V8zsS8o0ypy X-Received: by 10.37.191.207 with SMTP id q15mr2628969ybm.148.1516719447017; Tue, 23 Jan 2018 06:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516719447; cv=none; d=google.com; s=arc-20160816; b=hCS+Q586oY/PJfllqS+e/no2UM9gmPksTZec+pQrR2tjw0nNfMaOeYnOHsXhqUb0vA 0rrMeu6FI1QG6il8HzQ5SuHFk0/t/sfvCXks1lpbZTAUmwdV1sTp0k3hzwiGir/xx1xC hRKiHG7FDrxzcUzgI/QTBH4AyGNWrvvDXk55/TuRHCKnB8KehNrG6sruTH8Yb6tJ9BFj 9SI/2TGiObA5oQsKbo/DoEhCns5D2yzhx4lH73GZ2uQdrNxRTpVtQv3epn4JcXCnNfoh DzKiFRrYQqFn5bcPIHkXt5foHH2kaTVesHS36WHQ7GT8EhQYxcu25I3bQtyOCSFQ/BeG hvzA== 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:arc-authentication-results; bh=v/LrosPDm1rLmSv3N1dvz3PTJO2esdX8Bkfw3hvq1ic=; b=q+djeDJN4q1a6R/iVbv5EQk1jeCMdRsoHgqrbmjLvrQoVDrurN7qzOeNZ4Uh+Mvt+f faBLneb+sKFcXXs39nGRXoOu6HxdyAGYo+UT344Qx4ERW6GRcaTOh6H8sITVCTWIPmCm JvOX5S5ImagF3g079AhXxqwbPi+OV7lVXG6eyiB5SJ5aomZP8S9lfqXG+pG0Yf7XQOEW toMbawgsMwKq5w3k2xbjiLaKqLzsXZ8nXkBNDDAiM3xt+8t93FMO0ZH7riS/iEk59M7I G9Sso2r2FnxBrk+1DdJMvFMdny5F5DTGLR2o9+38JKeMqBEfkcPNFEsUkRf0Co0q6Ono ePmA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s124si2466782ybb.587.2018.01.23.06.57.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 23 Jan 2018 06:57:27 -0800 (PST) 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; 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 Received: from localhost ([::1]:33647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ee00s-0006Kw-Cy for patch@linaro.org; Tue, 23 Jan 2018 09:57:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edzs5-00077y-KJ for qemu-devel@nongnu.org; Tue, 23 Jan 2018 09:48:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edzs1-0002RE-8W for qemu-devel@nongnu.org; Tue, 23 Jan 2018 09:48:21 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:60970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edzs0-0002Pu-Te for qemu-devel@nongnu.org; Tue, 23 Jan 2018 09:48:17 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MYvnH-1eH9Ya03pD-00VeDd; Tue, 23 Jan 2018 15:48:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 23 Jan 2018 15:48:05 +0100 Message-Id: <20180123144807.5618-12-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180123144807.5618-1-laurent@vivier.eu> References: <20180123144807.5618-1-laurent@vivier.eu> X-Provags-ID: V03:K0:hMFxyN8c5zru5LIll7eVGuZ/RbAZWps8KUZ0gLDws2KgdsFccJ6 4tl7ZI2tZ+hlyiPJTC7Tt8Xrajlg2X6xzzJxc/M1I0iWSS22ogC9/VIimpDQeMirg9qHUEs WunMIH9aCJbygG6qtuE55xtOTLfLEeD7gYq+swkqGAqWb1hvTXIXJfj4axvJF89CRHqUkHO J0v9ReNWPRWH5YPRov9gQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:gHevY1lKvUQ=:tyZIFGyKsV7IAeNdBb2+N9 Fo5vgRnOoNClKypIGgEV0Vtx0KmUYwSSoG3z1yk+5T3DUMqABHBqEMaG4aPzSvnvw85MLUo4r 6PPd002MrC63GibfmAUhopGVH0DEyYsXCtHbMXi+eWyRmqpi2Q0tqNqIGRjYDTbD50zix/47y Wo/s/XLu9+b3B2xJ/ev5av/X8yMEhgEbRTI6LwrfUuFmfC2z5YSD0yQrncTcbcczv4x1OdZPW p1wOS2LgTbmlvLCdmyPI/i17y/mu2ElRYcXFck9vX6xINw9s4O6FEMPE6DLaXgWPM97hOWSxT VkKdVmJJeSxh+FsyjeFQYGOr35CnDJSVigUX+j/J5VxCOca3TkKeu9zSM2wVZkChs0gXs/0lw l5hocaUtsHP2zZcRe8mVUCd7rAEi0v5AqKJMUQsa1aUAEDbRpREfWUNW3L0xp00CwQFhH9T2E 9ID3jCNpXtm+7MheWWNFxlrBCe0HMigIeIBynaydm5xoTtP4QzgRXkvU4os+Y6qcZ/b5xEiGH 0qnHbkUrn/xlzFQs/XzaXoUB4N2BWIGeqPN30ZTKcV9zrDPeNPPEgHw0w0TXoTJFhsI95zR9H PXTpT+cHGosqfzpzdWr9fIK5cZdcPUr8KJzxNAoh2a434tSh5Z81K7rGqx1sMlRX1nnZyKhfw DseamHeXhJsN68Qa7hQi3HWd4LOfdqANqFN76qhy+8pBHZ5A54KwMOxkNmjgY0sIvdaHgvxcX +PPWeUdwk5hLpsZeEXXDrWFwrb/QVJyWGuNIMg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL 11/13] linux-user: Propagate siginfo_t through to handle_cpu_signal() 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: Peter Maydell , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Currently all the architecture/OS specific cpu_signal_handler() functions call handle_cpu_signal() without passing it the siginfo_t. We're going to want that so we can look at the si_code to determine whether this is a SEGV_ACCERR access violation or some other kind of fault, so change the functions to pass through the pointer to the siginfo_t rather than just the si_addr value. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <1511879725-9576-2-git-send-email-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- accel/tcg/user-exec.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) -- 2.14.3 diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index f42285ea1c..e8f26ff0cb 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -57,12 +57,13 @@ static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set) the effective address of the memory exception. 'is_write' is 1 if a write caused the exception and otherwise 0'. 'old_set' is the signal set which should be restored */ -static inline int handle_cpu_signal(uintptr_t pc, unsigned long address, +static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info, int is_write, sigset_t *old_set) { CPUState *cpu = current_cpu; CPUClass *cc; int ret; + unsigned long address = (unsigned long)info->si_addr; /* We must handle PC addresses from two different sources: * a call return address and a signal frame address. @@ -215,9 +216,8 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif pc = EIP_sig(uc); trapno = TRAP_sig(uc); - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - trapno == 0xe ? - (ERROR_sig(uc) >> 1) & 1 : 0, + return handle_cpu_signal(pc, info, + trapno == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc)); } @@ -261,9 +261,8 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif pc = PC_sig(uc); - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - TRAP_sig(uc) == 0xe ? - (ERROR_sig(uc) >> 1) & 1 : 0, + return handle_cpu_signal(pc, info, + TRAP_sig(uc) == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0, &MASK_sig(uc)); } @@ -341,8 +340,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, is_write = 1; } #endif - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - is_write, &uc->uc_sigmask); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #elif defined(__alpha__) @@ -372,8 +370,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, is_write = 1; } - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - is_write, &uc->uc_sigmask); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #elif defined(__sparc__) @@ -432,8 +429,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, break; } } - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - is_write, sigmask); + return handle_cpu_signal(pc, info, is_write, sigmask); } #elif defined(__arm__) @@ -466,9 +462,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, * 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); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #elif defined(__aarch64__) @@ -495,8 +489,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) /* Ignore bits 23 & 24, controlling indexing. */ || (insn & 0x3a400000) == 0x28000000); /* C3.3.7,14-16 */ - return handle_cpu_signal(pc, (uintptr_t)info->si_addr, - is_write, &uc->uc_sigmask); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #elif defined(__ia64) @@ -529,9 +522,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc) default: break; } - return handle_cpu_signal(ip, (unsigned long)info->si_addr, - is_write, - (sigset_t *)&uc->uc_sigmask); + return handle_cpu_signal(ip, info, is_write, (sigset_t *)&uc->uc_sigmask); } #elif defined(__s390__) @@ -583,8 +574,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, } break; } - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - is_write, &uc->uc_sigmask); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #elif defined(__mips__) @@ -599,8 +589,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, /* XXX: compute is_write */ is_write = 0; - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - is_write, &uc->uc_sigmask); + return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); } #else