From patchwork Sun Aug 22 03:55:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501395 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1058344jab; Sat, 21 Aug 2021 20:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMuOOYC0qQIJ0nRYmUWAC273AGcGFt1KIJld+8HveqFxQxGp8/KrmI54jxgK8UsxzRFop1 X-Received: by 2002:a02:aa96:: with SMTP id u22mr24084719jai.9.1629604612322; Sat, 21 Aug 2021 20:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604612; cv=none; d=google.com; s=arc-20160816; b=Fn58gXXl3Zi4APIFWDJ/iZCvH67DULOl6mRosdf6FtqjOdWpeRtSrp8Z7fwLBsB5EY 8uatTzF87Y5VTXwx2Bt/1m9ORH9NVYNbrYIvBAMCieVpzpUSw0JGT+AH37YQhFM/CyEY uZrZeVl91gneIgIy7JfMewfTWupw8OgGXR2XtQ5MtpCtDt7zFmAtAhxgQIE9dM0y1JKG NTfy7CrdIuCIXg0G6w+CInb3LsjueYU1aDavFjxp1AJ7dV2HsPxcoreSaB535blY8z5G PmDg8Ur9sSLIhn3jIDyzFQU4JQCWH7O/3+MAunmkUSEFWfQL0jLVKnvs66E49Fm8vdq4 fp5w== 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=+WaIHji4UVCfbzWSWYeif0ORIYit2XTMtjCt7U1K6k4=; b=f5RLkeFecK12ZmIHRS9CQW9I6mNJSinxAdIueadj5pF/qoANSgnbzxBsy2pPylgmps Rpl8h4+sPtPda4HUrvzRp5Fn9SGvNfdsQabBJh4kU3+ObSAjc+Vic7Z0KBQYugbK7djs 9XiLsxMnWsMCzpy/6thY6gAJskUAcaaOJDG4v1wPrLORw4bfRF9Xwbm4WlzS33L1bIlY ES+hCmOTRxR9K0mFyeD9r+Ae/6N4TkCd/sIk52dSaiUJwkDvFJ/k1b8mnyHP52gGF8RG fXnTeZScYyiIek5+WcOWQUSygML4sruxbiEKwmEGMayb+nzy7N7DwdT8P8zvbG0JYAwE RHKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h4FuiIBN; 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=pass (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 t7si10919235jah.88.2021.08.21.20.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:56:52 -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=pass header.i=@linaro.org header.s=google header.b=h4FuiIBN; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHebL-0007hL-PM for patch@linaro.org; Sat, 21 Aug 2021 23:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaF-0007fb-MB for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:43 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:40545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaD-0000Xn-35 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:43 -0400 Received: by mail-pj1-x1032.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso16420573pjh.5 for ; Sat, 21 Aug 2021 20:55:40 -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=+WaIHji4UVCfbzWSWYeif0ORIYit2XTMtjCt7U1K6k4=; b=h4FuiIBNN6iHZAQYRGRklNXnq+teFHvidRu7A6p5WHDv9N/ZrS4GUP2+W6fkGm5T9y b+Rn52UN61F4k4QC8cvqGjF/nVYZU/kUJbZOIQZkwne6BkzQOzZw/xwTfQ8/E3Belh0n XIryIhYA8RyksYzfb3T/Z0W0M48DvcFKyKB+nfat83HbSaDm75zXiVdz0UsmQ0ZFPzO9 9v+adFTg0Fq2PSSilbAt1S1fka1cvBNCPlgU6fP5ccNlTkFMW5X/HA6pGW03071jEbMZ Ipb8MLvI55GzY3tjnW8i68XPon8agyP28e0q0Qwmsw7rhgBI6nlQDz2wb9gM8sbzHN4w +Z2w== 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:mime-version:content-transfer-encoding; bh=+WaIHji4UVCfbzWSWYeif0ORIYit2XTMtjCt7U1K6k4=; b=qG/5kQ2kAY26KbEUsBwJdJywAkGRy+0+OEaH2jxK8IZaEovJCAr6deufCBWWrqh4pj GgKQ0fMI0RwkBHwaWpBXy52MVdDLQYlo2md5nb2ybA7Azd4lTJW9yqHvmY8D8gTMjzBz o6+tlKO7TrvEZHWRNE6yc/KrD3pMcu6JASG/FYVHBSRxYcMkl+B47Ua3v0yepbkVeGcN rbuF3dDd6roEceFhDNQXAyCjenN6dpYR8B3Xc5TQN1DsDLVVA57hD74j21N3pGyh5xv7 Ub6AbZB8yuEueUgdpMwI9uLZ6a1OPs3sUle+XtWQvRuXzqDaVgatCqNGHgn8vwYWwl1u Ye5Q== X-Gm-Message-State: AOAM533asicm6HMG0+YFSpl07y0YjHoKVn1ly1NvyQHi+dsT7aqfHX4u qyJ2AE4lVJDYPbs3485nTZC/nv6R/n69jQ== X-Received: by 2002:a17:90a:404a:: with SMTP id k10mr12982277pjg.145.1629604539504; Sat, 21 Aug 2021 20:55:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 01/30] linux-user/aarch64: Set siginfo_t addr field for SIGTRAP signals Date: Sat, 21 Aug 2021 20:55:08 -0700 Message-Id: <20210822035537.283193-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field to the PC where the breakpoint/singlestep trap occurred; this is what the kernel does for this signal for this architecture. Fixes: Coverity 1459154 Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-2-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/aarch64/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1 diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index ee72a1c20f..5d8675944d 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -148,6 +148,7 @@ void cpu_loop(CPUARMState *env) info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; + info._sifields._sigfault._addr = env->pc; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case EXCP_SEMIHOST: From patchwork Sun Aug 22 03:55:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501398 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059080jab; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw+Q2XS0wxJbTDd3mfTOGmBA/YKlecWjZ4bjLdyk4xN9iFMrBAr9tBnvWx1tB+5cjmtQ4P X-Received: by 2002:a25:6949:: with SMTP id e70mr15700713ybc.67.1629604724100; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604724; cv=none; d=google.com; s=arc-20160816; b=biHICrEfDGEbzmfIEN/stCytlCwP3yIx4L5XDuX6/4wNzfFbxqKUrZv+FsdScY6tjw aTQNXF32Wb6/Dancdm0lBPThMdmqfsl5TUYPna7te7NACGirkPAmKi7S5mSaW2XSY5ih IckzIWS9/6PMvnLGNbq4amWSz7OfVLq3/Sr47s2WlEdqkHG7An400ABZz1rENsui0443 zrcCcw2uWLkiPIT1zliie9GaY6gFpTmuNedcOSA3lORulFi91A+5kvHHAWL1H33LBubo QwBsHf67QAK6Edzs5SXTnD5c8DFySgEzJD6QWsuW0CcOSeEuVHYiqM45+WtSqGViHfj7 34nQ== 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=wxQXtJmn/5fHjbKQYnHYNPRKlKJ8RKfJONraii7URWo=; b=pgBmXPZRCDroj0dCwCWoNUQVnvnGCQAewXoCwFfATdbe479bL2X1r+HtKc0bCaazA4 /SJkxIoc/Ma/c80W4rL3Onb7KfEMqk9w1V8mrFjQVWc8vQN8DapmD4ttwHQ2ouN+U989 DwuXUYYwzTU7AyQJt5uCP3a2AVUlEw5NVnjgGIgZefO5x2REdgybY+WfKqytv/9C2XFN ZCFv14D+mBdszAyGwEO/4DBIRtDE7YeKfDwBi3RF8+yEIU+0je9af7iS0y8uChO30RnV SY0dXCk8fhf2UurtwVvEg+OsB+quJJ83klhrKQ96Snw8r5YbyzNO5Xm7sliC1bGY8ANV qL/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MXbarbi2; 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=pass (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 l203si12819533ybc.359.2021.08.21.20.58.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:58:44 -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=pass header.i=@linaro.org header.s=google header.b=MXbarbi2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHed9-00055C-Gd for patch@linaro.org; Sat, 21 Aug 2021 23:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0007hE-UF for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:43570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaD-0000Ym-9c for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: by mail-pj1-x1033.google.com with SMTP id qe12-20020a17090b4f8c00b00179321cbae7so9900605pjb.2 for ; Sat, 21 Aug 2021 20:55:40 -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=wxQXtJmn/5fHjbKQYnHYNPRKlKJ8RKfJONraii7URWo=; b=MXbarbi2spXS8eJpRD710txdVUYKuU3Oju+UFC5UZV1jMy5QJ1Ee87CNEs6F3TOEdE ez894NSfY6DhA34yqPloyFDQaf1/vw1E1EX7Ibzr9bcQznCABKLQkxz4Hd3h3TOi7aEn u+sob1uzzXzKDU5/WGE9+UpkmVCILvyUHHM8GPrqtvIhgiuOz9O6oxGhxYCUfOh+Nr7x 5bYXZDJnK9IUzVarpMedqR601CWmOgE+z+sXxvWus+t7DDVav7/bTaNLLjZfULomO8GE TErcKD57UC2zrBhgPt4k5iHCLplTuY4KB+/bja0QmkRRac1NbfRu3IkNcYsCZPefxigp TEEA== 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:mime-version:content-transfer-encoding; bh=wxQXtJmn/5fHjbKQYnHYNPRKlKJ8RKfJONraii7URWo=; b=FhGKT0abD6nbxOWNbDeuJZfUyTQK6xJUeMdIUmrjXkPqKI2nMh3i5fHgbhzQA6sumS TqOT7xsqANo58hXCW+PcXq/LBDLGnK5x+TheBdFliCM/ERWj/H18bKnq3hOFGp0BI1X0 7Pyl5Me4vhdL8X0eNsNih2SaGzeR+is7aOqE9wmPnsVQ2PtyG1HluIpkhSQoPxs2w72g Z4ojuWJUnVNc2oh4T0QHk1YwEBWx9mcFxLIfh9qfdsLaNUhidtY1ZgtkjWsirRgI9VCo PcK5Z1UrHAT7niHT6WbD1GyKkXtSS8TfN+/bXuBZNuWBKbTuUC88/p6RR2+7XZHBPeKr i5rQ== X-Gm-Message-State: AOAM532KKaukxAjJVWqSNLO+I6BiiJN1BH3UvdjxV7WZ0Bdg7zZxe5TW zytGsEB09zROHbVImgmo+udWNJe8jHCRNA== X-Received: by 2002:a17:90b:4d91:: with SMTP id oj17mr4023013pjb.209.1629604540080; Sat, 21 Aug 2021 20:55:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 02/30] linux-user/arm: Set siginfo_t addr field for SIGTRAP signals Date: Sat, 21 Aug 2021 20:55:09 -0700 Message-Id: <20210822035537.283193-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell When generating a TRAP_BRKPT SIGTRAP, set the siginfo_t addr field to the PC where the breakpoint/singlestep trap occurred; this is what the kernel does for this signal for this architecture. Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-3-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/arm/cpu_loop.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 69632d15be..007752f5b7 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -453,6 +453,7 @@ void cpu_loop(CPUARMState *env) info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; + info._sifields._sigfault._addr = env->regs[15]; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; case EXCP_KERNEL_TRAP: From patchwork Sun Aug 22 03:55:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501400 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059085jab; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyewB2B/cwkBluBwypwsIFczFOkGNR15FWxkYW9/X1Pq+mRC4RQ3xQ8tgkrBjVUtmW3HKyY X-Received: by 2002:a25:b08d:: with SMTP id f13mr36457719ybj.399.1629604724722; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604724; cv=none; d=google.com; s=arc-20160816; b=Dg9fmWJQXTinx26cc4jfKwZcSBdQ3UApIR16Fl6o3FFIlr2oSwWySRM8U/HZ3KITqw qH+7gpJHhTM1e87KMV1/Mop5UdWELl/IXQfyc0bNxMbVX6yZ4mH66MRynYfEgRtueE9t akDzxQe2npYHRlVekuJTtPRxdKbS10HW3vikvTeaDv5gJkbccO/Qn2GBZTeIMwNUaLdR PequJt06X3VpCwiXx2l9OIufuOi2SvLUxdDJePYJHKLlR3mEbJfucDppFKQtOQGTG5Xz CBZ0Z+gQbF0wsr33CEJhuN479ZY/utyQSO/+AGSab4OwarGGl+TZ0PHMAc+2aBUT28ZZ QLGQ== 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=P3z2Cv7lHE53m9POhYgaeHFo5xT8ZP8ac0XeVQmhvwQ=; b=nkpQu/zADkUjr98i1h/qg53Xzj93PpcDrvcg73qQVR/IuphlkGBnQwW1C9VJCnFYi6 QkdZjjUcY2K5t7V3IlBQ5bdlkaozMUTQ6Ws2+knjGKx9i0P81QLEmU6th1C3lgF76kM9 VIdd0wzCbCS0CirSwhIZ9kQ4zP93EFOVdEiOA49S+/5TLCS92Ni9PJGq4pXhra2EF6F8 +pReEtWWq0Zwe9nNBC3zewq1uusfGWWrb1YbECbZcNdHD6QVSApRxJdYsqzqEHk9eKDV GRZtgR8PkxV3UFvgMkC5eIj1UxB4rv7oidRuyCBZf6vStbbOGlrkiB8AyK1tAV9zUUYJ PBsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BoxTtglY; 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=pass (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 f6si10311629ybi.102.2021.08.21.20.58.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:58:44 -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=pass header.i=@linaro.org header.s=google header.b=BoxTtglY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHedA-00054S-3l for patch@linaro.org; Sat, 21 Aug 2021 23:58:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0007gi-JZ for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:52120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaE-0000Z6-0M for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: by mail-pj1-x1030.google.com with SMTP id oa17so9841835pjb.1 for ; Sat, 21 Aug 2021 20:55:41 -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=P3z2Cv7lHE53m9POhYgaeHFo5xT8ZP8ac0XeVQmhvwQ=; b=BoxTtglYPFlrwXK9iX545hsKNtVKGnxuf/L2GOiyYn3L7G+M9OJjAHNPl7L9yvtd1s WF02wxLUbTSaQPlISIYyBccBonWjKtHW9jzcdXCZgQ+HMt6zBIlVz6zmr72kyae7rgN/ zQLpV3lPY1Ihg3FseIedz4+xOPcG5jIoGckeflKrR6C7FwHtt/gBiHjtlJEgBjWyDDUi n/VR9CIo/Otp8mx2dlXslzgr+a2Qm5+hXwcs/NFsel18hfrn4OILt1/5V8e7D+zQ/KW4 uGOI4Kh8HbuTgOvRR1CvsF83WpYGI2Wheu8WzG5SGIqvdO6mpe3fZUm+6MnW2SO8tk59 uboQ== 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:mime-version:content-transfer-encoding; bh=P3z2Cv7lHE53m9POhYgaeHFo5xT8ZP8ac0XeVQmhvwQ=; b=p9ddI2vJIvA05IdDYwvgUNH5RNrfots4h3WiN0Fd0m8vZSu48Lab2x/hzTvpj7+X2i DzpIeFospdm3zJLrwsIg6qAf4kQ6L4Ib1Uo/vBI5fouipmWnxeuN8sJSdKkSCrGcU+zy R2kZqw+n/hZo1fwh3Qdmn2VlYlsv/ZmmwpR3WEQztqr1DHoqKtRhuwUyGFcfCH7HMkDG 4stpvlxkK12xtObDL8n/TYsAxww5jXpe6jLnDyDxBqODz8Shu50S9funPEzdyXv5aLm2 aKpZttRHuYeeYm5E/GaTAceGGZZzlNBPVOH/+si3J2CXh/qtPeO+QYjj/GW1M/2HIYJK /R9w== X-Gm-Message-State: AOAM532+/n+Ra+RjlGusipt7eBxSfoD5nDtjz4rYcqDCnAkUa9EOpKgN WqjBQ0D/0yKghsU6EiS2tXzXNMqjsqvSIQ== X-Received: by 2002:a17:90a:bf14:: with SMTP id c20mr12576889pjs.184.1629604540708; Sat, 21 Aug 2021 20:55:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 03/30] linux-user/arm: Use force_sig() to deliver fpa11 emulation SIGFPE Date: Sat, 21 Aug 2021 20:55:10 -0700 Message-Id: <20210822035537.283193-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In the Arm target code, when the fpa11 emulation code tells us we need to send the guest a SIGFPE, we do this with queue_signal(), but we are using the wrong si_type, and we aren't setting the _sifields union members corresponding to either the si_type we are using or the si_type we should be using. As the existing comment notes, the kernel code for this calls the old send_sig() function to deliver the signal. This eventually results in the kernel's signal handling code fabricating a siginfo_t with a SI_KERNEL code and a zero pid and uid. For QEMU this means we need to use QEMU_SI_KILL. We already have a function for that: force_sig() sets up the whole target_siginfo_t the way we need it. Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-4-peter.maydell@linaro.org> [rth: Include signal-common.h] Signed-off-by: Richard Henderson --- linux-user/arm/cpu_loop.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 007752f5b7..b8ece169f9 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -22,6 +22,7 @@ #include "qemu.h" #include "elf.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "semihosting/common-semi.h" #define get_user_code_u32(x, gaddr, env) \ @@ -266,16 +267,13 @@ static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) ts->fpa.fpsr |= raise & ~enabled; if (raise & enabled) { - target_siginfo_t info = { }; - /* * The kernel's nwfpe emulator does not pass a real si_code. - * It merely uses send_sig(SIGFPE, current, 1). + * It merely uses send_sig(SIGFPE, current, 1), which results in + * __send_signal() filling out SI_KERNEL with pid and uid 0 (under + * the "SEND_SIG_PRIV" case). That's what our force_sig() does. */ - info.si_signo = TARGET_SIGFPE; - info.si_code = TARGET_SI_KERNEL; - - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig(TARGET_SIGFPE); } else { env->regs[15] += 4; } From patchwork Sun Aug 22 03:55:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501396 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1058346jab; Sat, 21 Aug 2021 20:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK9qz4TLJ0TPo+Fa/26rKGRVglGdhtV5spqY3my/06EluOREozR6qlohS9l2TppKJHuPf+ X-Received: by 2002:a05:6638:2712:: with SMTP id m18mr23953654jav.76.1629604612889; Sat, 21 Aug 2021 20:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604612; cv=none; d=google.com; s=arc-20160816; b=MmCcTntgJWl368gEuf9PL2DECnR0Csrf6nv7xEpWlswc02pSd4YYB47l5DTzd6mFY3 JpxYGhV9a3m3o1NfVt8x00gECO5opic/wVQZAMcN/fOp6/9gUMCsCY3JKk47K2JzMIMd f7FxUSXdqaAXzq/nmi3INijYlZCSPhfaMR/P38buk2nMFrdPCNYToicb4+SeiMF76FoF k9KPuTrotyZq51Y7M7KuKc9+94Oel0mVeFweInqZcNeME6nbiQPwAMq6JEr1gaqWOVde swEoUhFQlTEuifHtepYn6JTRzjb4cMC1ArQ558s5u6QhRRAylXstWgGxpKqxwcm2Tf6q mR6A== 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=BtM7var2ggs0sC3CkTYi8ly4990ZgrcQeQZtuDarh58=; b=tXtFLXZoJYHAPG4+IRnOVp+pCZ2hCeYorSzuff4viP+4V9ErFOYPnX7ZfuECC71MNw /eUOWm7l6g/Ho+yqsxhk9epsThirg+Swjv/Rm2fUaFoqSHkOUKesOu1xwdXvdZBjY2G/ WoGMaz/mUXIRCqkmKEghp6CfGYKLdiALq2SiMmlguyNX8mbj4hcP9/WbY0xeQjfe/BFx gDPrguujmJ4aC55D5QbNCT2UAbtHWFBbwLiRxLt08pPJ7lO82lPOweZkCWAmVAVjDKqc a/6UON2HP4uAnpgpWI7+5PGJO9U12FKMT59A3qH39aLeqTNYAS252oPIRsjqbjLOt1Aq bmzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L2j01erI; 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=pass (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 l15si14006449ios.94.2021.08.21.20.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:56:52 -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=pass header.i=@linaro.org header.s=google header.b=L2j01erI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHebM-0007iv-D7 for patch@linaro.org; Sat, 21 Aug 2021 23:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0007gT-DA for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:36494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaE-0000aG-Rs for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:44 -0400 Received: by mail-pl1-x633.google.com with SMTP id f1so1365725plg.3 for ; Sat, 21 Aug 2021 20:55:42 -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=BtM7var2ggs0sC3CkTYi8ly4990ZgrcQeQZtuDarh58=; b=L2j01erIoPdFBFriRxhnvxopl6a3DUivI6y6/350cFG8fO6eUlEoFJqZ6uxsMl5r0Y CgMaVDitjhaM1LN+17BcHiKzNagTyKOIlYf5pEbUzrRV4Yw494Vxh2XIbmUyI1bkytfa exkJ11I87RDhDm0jRt6962ivO4LSKEaCGt7BaTe8MmcXwXhVu9e7ANcXkHXNuWd0wiUm boZiIopLEWHR3GjK1W2e0T4MbcWHrjnIPjC4Kx9FMY0nNPcFVx4gdRp6Rc6MLa3SND6j 6q24JFcuRCr2boV1iGsY+amfWbwaKpxz4b2N+2xlmtDIb1OO+zpkYnAlMaezcEAyJff0 3OCg== 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:mime-version:content-transfer-encoding; bh=BtM7var2ggs0sC3CkTYi8ly4990ZgrcQeQZtuDarh58=; b=bqASQUt0VCUhS+5Dse3OOFcUacqxkg9IUh5mu5IV2HiSi/5XXQiP40NVUlGZC9Z848 jezNnbgaI3m8divJbuVM+D8aUabkXtbjjjSmkFmyzFqLZ3rjvA9At3kbvALY0TpX6/rv Myxpup27weYoqPWwWGOuS2ESVL+TzmF6nTNhDHPS7Ic9EVIs79rMjjXpARmkMd0tgDm0 a0Sjw702dP9Uwh5wTo/86FcWPjdwVwAeY7LAdXxY0Sr4HSy2SgTF62m+DZFBAbx3TVs1 m6F8hD8bB3JEgyrLR4+mPItdNoVb4l3dhuEpZ3lIzK1cgTDvpzZkGNYDK/1WlT3yOCq/ UPTQ== X-Gm-Message-State: AOAM531l3W8uswwYvfG2IYx4uczxoauFMeKJ5pl+u8ijcrP+gorwWyT1 qy0K7nRrLXIZpQhHqgei4/x7hxn9qaClGg== X-Received: by 2002:a17:90a:9292:: with SMTP id n18mr12881447pjo.120.1629604541385; Sat, 21 Aug 2021 20:55:41 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/30] linux-user: Zero out target_siginfo_t in force_sig() Date: Sat, 21 Aug 2021 20:55:11 -0700 Message-Id: <20210822035537.283193-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The target_siginfo_t we populate in force_sig() will eventually get copied onto the target's stack. Zero it out so that any extra padding in the sifields union is consistently zero when the guest sees it. Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-5-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/signal.c b/linux-user/signal.c index a8faea6f09..fd3c6a3e60 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -636,7 +636,7 @@ void force_sig(int sig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; - target_siginfo_t info; + target_siginfo_t info = {}; info.si_signo = sig; info.si_errno = 0; From patchwork Sun Aug 22 03:55:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501397 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1058351jab; Sat, 21 Aug 2021 20:56:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzseOJGxCxiQwbQKbQRkMWwuOpIS2o/j12/f/H5JtSC8xCEUuRMfB2Ji75R1UU0JymiFheH X-Received: by 2002:a02:90cb:: with SMTP id c11mr24756010jag.53.1629604613487; Sat, 21 Aug 2021 20:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604613; cv=none; d=google.com; s=arc-20160816; b=HBbz4499SlhXsONrR85aMq0L8RTD29wB4fnco1n4iDgn9yF2Mo/bGy5CoiUX0aaZcn Fd8pmX1KLZEhHpt9/LbklyXWuaWlX3vsng1EdmwsVbHeyMUc4VjaD2UlrziiR/1QEylz qwZjyBmRMp3oXaTGTE/b4x3eFUcVFruzAQraCAe23q9oyvobziv9pWgsH5UXqVZgHftX 58Czfd+l2+AO1JAN0OKS7EfrfeksaMkcsA7UHbrm3AqHzzD3xUk5l8JcfTuRnW/XOcb9 3vY1WPHtFvvynIqe3e79Tsh129BkgvlthF8ms2FJI/OKutqNCW52ARh4wYp5CNMXZffH SqpA== 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=979JNGT4wJobTC0t4pJ3IOQQyDJEP0/xlu4yVxqsbGA=; b=JOTthgH1iHT/1LPTwoU/224x6NIhj1/BaxkZ5hMBSYtWWxfCQK7l7tuhQj07rk7He+ v2U+3pxfeuMxH9la07mXvH0pyZJ/IsnWjlgUW43fdfhMF9GaGWheQJUEpM4umM5ewn01 9waQXG+3zcx/g5eDGPFCOyL4W/VjbMq9nBoSoYwjYO3ESaYkv7aDBI2HAJpXc1c6PJGJ wPEb/5nHEWPcex0WfUWEp7sx6ZyO48MyniOSGwOSwiPpxREdfO+A3Kx7eSY5KVyfeSlk OGGYv8XPDtoz+yfgm1yKQ5njKBa0FtkQ6h+/FswXysWgOqb98g6laauauAIMhnZoNgsJ x0ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sXIQlFWX; 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=pass (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 u26si11822398jam.6.2021.08.21.20.56.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:56:53 -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=pass header.i=@linaro.org header.s=google header.b=sXIQlFWX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHebM-0007ol-V5 for patch@linaro.org; Sat, 21 Aug 2021 23:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaI-0007jb-2V for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:43983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaF-0000aT-Hb for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:45 -0400 Received: by mail-pf1-x42a.google.com with SMTP id 7so12293899pfl.10 for ; Sat, 21 Aug 2021 20:55:43 -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=979JNGT4wJobTC0t4pJ3IOQQyDJEP0/xlu4yVxqsbGA=; b=sXIQlFWXzLiSGVi1spYyK05n9F/FbpM+1VGYghNS1BTmETFZcZSldOC9MNjoKyIOM6 9Mp1HZ7cJxidGiDSHi+lUcKusX0VA6dl8zhUFR6mnxSJpAE2cQIOmLAzxeqMKhSfo1od JC6oyjniG1qBgXjEMLGZMCqBTKk3XS/lPZjPwKFHo0ngPDMIy/oBchGCx/vgqFyrJyUC UOxDTAxIADVSzWEEuyX+j6SjCcv7f9zvEUUJIUW0TwahgRDqvJcYftQckuuzSkf4RkB2 Rx+CoTQTkveKXe0EncT6MPATlbETFTiiOSiOlQ55QIcLCZJxkIMKjdZQmE9g8PkGa8Hq Bj7A== 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:mime-version:content-transfer-encoding; bh=979JNGT4wJobTC0t4pJ3IOQQyDJEP0/xlu4yVxqsbGA=; b=RHe7bSm+btPU2iFkO2o4LDUZovVGKmG8Xk+TGol/ieUmaYVVPJgI6RNbfe/3w7wp9w ZbhK5W7MVMQOqzimcYX7i3k2um+TXraXzcFEOa4e8UbEfC+i933TvGxGtC57xTULWIf4 j0F5Sy2ebGXn0iM8YxPlhuar+K/svDAepf2DeR3JClT7SFd2qYaccxXiPoSykVNQzix0 SFOB127LlN7A8RTQv66+Pw4l/snNF6NFELzZJQCTt+h563dsz4yDwJNn4KvuRDb0+bU3 PVWvo0DkJ/zs19aSGLMXXiivkyYqGDtKUQOulHdLqrs4M0NbHLIlGwFp56YDBWtB5bz/ Z4IA== X-Gm-Message-State: AOAM532Ehd147mrJjUphKYMcSsquuI+6J0/FAI/Y2CrRabpNWJ9MIej7 vJ6K8xWEmpu0NStqADOA/uymny5x4V48dQ== X-Received: by 2002:a63:b91d:: with SMTP id z29mr25949433pge.436.1629604542211; Sat, 21 Aug 2021 20:55:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/30] linux-user: Provide new force_sig_fault() function Date: Sat, 21 Aug 2021 20:55:12 -0700 Message-Id: <20210822035537.283193-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In many places in the linux-user code we need to queue a signal for the guest using the QEMU_SI_FAULT si_type. This requires that the caller sets up and passes us a target_siginfo, including setting the appropriate part of the _sifields union for the si_type. In a number of places the code forgets to set the _sifields union field. Provide a new force_sig_fault() function, which does the same thing as the Linux kernel function of that name -- it takes the signal number, the si_code value and the address to use in _sifields._sigfault, and assembles the target_siginfo itself. This makes the callsites simpler and means it's harder to forget to pass in an address value. We follow force_sig() and the kernel's force_sig_fault() in not requiring the caller to pass in the CPU pointer but always acting on the CPU of the current thread. Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-6-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/signal-common.h | 1 + linux-user/signal.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index ea86328b28..536c7ac2c2 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -40,6 +40,7 @@ void tswap_siginfo(target_siginfo_t *tinfo, void set_sigmask(const sigset_t *set); void force_sig(int sig); void force_sigsegv(int oldsig); +void force_sig_fault(int sig, int code, abi_ulong addr); #if defined(TARGET_ARCH_HAS_SETUP_FRAME) void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUArchState *env); diff --git a/linux-user/signal.c b/linux-user/signal.c index fd3c6a3e60..5ea8e4584a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -646,6 +646,23 @@ void force_sig(int sig) queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); } +/* + * Force a synchronously taken QEMU_SI_FAULT signal. For QEMU the + * 'force' part is handled in process_pending_signals(). + */ +void force_sig_fault(int sig, int code, abi_ulong addr) +{ + CPUState *cpu = thread_cpu; + CPUArchState *env = cpu->env_ptr; + target_siginfo_t info = {}; + + info.si_signo = sig; + info.si_errno = 0; + info.si_code = code; + info._sifields._sigfault._addr = addr; + queue_signal(env, sig, QEMU_SI_FAULT, &info); +} + /* Force a SIGSEGV if we couldn't write to memory trying to set * up the signal frame. oldsig is the signal we were trying to handle * at the point of failure. From patchwork Sun Aug 22 03:55:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501399 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059082jab; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylZezhkgMmTwYOYBsYEHA8Ylxceb99gYjPLMcHE09TFLio7wEqmJPV9vyLKqmtoCbzNwd0 X-Received: by 2002:a25:27c1:: with SMTP id n184mr35867237ybn.496.1629604724235; Sat, 21 Aug 2021 20:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604724; cv=none; d=google.com; s=arc-20160816; b=QcFjQReogbKKl1lElsXmBJ1GLE4uF5HyQ7I0dsrtaWRjsYvNj7vdmLBq0a37w74ym8 lUcqHCPN0LftgZzYvTn8PJ1dhhPqjyGdK2L9THgu1pEsxdZXTQXnmpmbr5PCIIVHYzNx 27h2KOhVvthSdagz0wGxbjEAqgMZ/9QYR9sfbTduDdGBCkY5MDbjHJqmpEg+sNqedlye heAb8zr8bdnOLFPmqS3vSUUwTtal2WNia4719TDisThOZP1rq7VN41pCx8Jf8R/1Jmg3 4QNQn9fGepBZWzsaWWgWDIp3RxWJUJ5qnrKjtYDavDBh4qqdCVe/3KMm48cCtAjkq0OY FAWQ== 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=cY+r+qc1fo0mUajc1uVUA6DlV/7AqfXH+Cyy+hdjevk=; b=lNontiOnvaDn94Mwxi6Arg7DVTU9BygsvZnBE78KuuRTVj2W9/p17pbBjJ/Eo+BPKs r1P9dVEKGjxmxybAlJgb2jNJrcNlIk6ex8e6FI2ox76YQZ634WCvfSnS6hExxMSbO02Y KhlMGDyQ6NYIlgQO9Eb868q1K53wKQnA8r9MAykF2TxzlSmuf8WPbrMfzxVH35Xofwym 35jH/+IiIcquA5uhsK0Z86514ZdEFNw6C0dIbvWGCOb9bUq95Mwrowdl512X4HAMMTTB h34ZQFLSZxK8sl5G2S3IgLZX6wkFxYr+VEZLfC1JRHqcqzd392aPArNfLg5Dne7SnN9Q pgng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ItsZ1/5Y"; 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=pass (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 h96si10500992ybi.320.2021.08.21.20.58.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:58:44 -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=pass header.i=@linaro.org header.s=google header.b="ItsZ1/5Y"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHed9-00050b-LH for patch@linaro.org; Sat, 21 Aug 2021 23:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaH-0007ig-KO for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:45 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:37858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0000bD-44 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:45 -0400 Received: by mail-pj1-x1032.google.com with SMTP id j10-20020a17090a94ca00b00181f17b7ef7so3615208pjw.2 for ; Sat, 21 Aug 2021 20:55:43 -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=cY+r+qc1fo0mUajc1uVUA6DlV/7AqfXH+Cyy+hdjevk=; b=ItsZ1/5YzIOYxk/YudsBeBxuLVspEi7CUCnAIl08eYp0YOfTeDLHP9oiZO3YZMUPdw FfSruxRPTHxqFd1PfBZ6iGBO4qXMVLP2+RA86h+5HZbvJfrlklrEysKgyXUmtW4ZANeu yF6HD/ayAnX4ccMJZBPnKNDf7urhP7IZ9tUXuZH90uTwrLZ83nUcwM1w83PS0aKBDoFe d3YSSUOKJEn9rH/8VUoDY9/FkwLkLdpRUx0ezxDG9HtX1vf3nlxjpIMq7h+RkK3keoPB MAMu3EI3hjPNQumjrMOavT1X70oF5/uowCFayC3xNhcyU8Fr45NOxG5Nb9Wg/Jn+BGzf RvoQ== 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:mime-version:content-transfer-encoding; bh=cY+r+qc1fo0mUajc1uVUA6DlV/7AqfXH+Cyy+hdjevk=; b=halBYXMFbR7CwtX9FRB1V4JlQ1UKZ6L6GAZCLJJtR/yk/agVD7ZB41NC8K1h+rbwEl xM2LcEmgkubG/N3Nvf5gvDWWtKnImGSXj0b8AbzbOKJD8Ti7zgpVTiraq8/Ct0mRvSC6 d7SVP4wnykyRzja2vgf9mNwKMtLKRB5GvBGaJpIviC7vHpnQ6pY2kDLcc1JgfWhz4lkp J+fZ5FFNaiLt+CxQQUdGTl5yB90lcNSMEZd9gzYKV90wHH3AYY7VHIW1kUHAH71GLS9y 0XMYEP/AQpw10Ch2Pi6JsW892CRLmCyr4TCoyEoQgdROr3BPB3cYpvFiYXMKu0jxV2wh 3h8w== X-Gm-Message-State: AOAM533e3SG0dfr6MtG6hZKLrnBhHPDMoxZuscAd+1w1I1nANmKTsiY7 yDQTTHaaq1g//WMxFAvUYuDNEg/K6ZI/7Q== X-Received: by 2002:a17:90a:116:: with SMTP id b22mr900846pjb.108.1629604542950; Sat, 21 Aug 2021 20:55:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/30] linux-user: Provide new force_sigsegv_for_addr() function Date: Sat, 21 Aug 2021 20:55:13 -0700 Message-Id: <20210822035537.283193-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Most linux-user targets so far do not distinguish between SEGV_MAPERR and SEGV_ACCERR. This function will be used to fix that. Signed-off-by: Richard Henderson --- linux-user/signal-common.h | 1 + linux-user/signal.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 536c7ac2c2..9090bbb315 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -40,6 +40,7 @@ void tswap_siginfo(target_siginfo_t *tinfo, void set_sigmask(const sigset_t *set); void force_sig(int sig); void force_sigsegv(int oldsig); +void force_sigsegv_for_addr(abi_ulong addr); void force_sig_fault(int sig, int code, abi_ulong addr); #if defined(TARGET_ARCH_HAS_SETUP_FRAME) void setup_frame(int sig, struct target_sigaction *ka, diff --git a/linux-user/signal.c b/linux-user/signal.c index 5ea8e4584a..0bb369c888 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -663,6 +663,24 @@ void force_sig_fault(int sig, int code, abi_ulong addr) queue_signal(env, sig, QEMU_SI_FAULT, &info); } +/* + * Force a synchronously taken SIGSEGV signal for @addr. + * Distinguish between SEGV_MAPERR and SEGV_ACCERR here, + * in preference to doing that for each target. + */ +void force_sigsegv_for_addr(abi_ulong addr) +{ + /* + * MAPERR indicates the page is not present at all. + * Otherwise, it must have been a permission problem. + */ + int si_code = TARGET_SEGV_MAPERR; + if (page_get_flags(addr) & PAGE_VALID) { + si_code = TARGET_SEGV_ACCERR; + } + force_sig_fault(TARGET_SIGSEGV, si_code, addr); +} + /* Force a SIGSEGV if we couldn't write to memory trying to set * up the signal frame. oldsig is the signal we were trying to handle * at the point of failure. From patchwork Sun Aug 22 03:55:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501403 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060172jab; Sat, 21 Aug 2021 21:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5cFwxbhV7Ley2aC1+TnINCviXHgO8fbWYa4lPWU3Hp+KFxhDCtN5xqKjM1crxbnmcVcP9 X-Received: by 2002:a25:b790:: with SMTP id n16mr35049872ybh.274.1629604875498; Sat, 21 Aug 2021 21:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604875; cv=none; d=google.com; s=arc-20160816; b=xIZKa2yNHUnhiM5/nUBcKBwyAVnSD1KjXGEeb6Nwi5ZHNjVM5y8eXriRD3YQ5UWIG0 e1M6Vm3ldLTz6tyDqjKhesiygdpmP4CaoGj4QHuMk9kjbTiiM041v9/IrsYv7NYekcAU Ga8KYDJ7to3omlTs6d9hwz0kFxVEzwcStkjQbSVXJtIkfu+HrAW+06zuFPnrHcONNCSU /d6MwIVWCScHi/pTpPy7/S5OMENZ8w0BTFuuX5mZ/ydQP6Zheb7NzPP+AnYmTSVvJW4Y X+15jLmAlSC3lbuwNw6PaTE/pnyP7BsHQk331O3a5oUcUIfWhFW9iG+afPl3c/mUltmD wWBw== 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=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=tEPV3tAIMHPFTGzpVLDZOnfY59kvtr1iuAskNAcZOn5pFpuHxhtf2nknKCFlpQiJUN Rqh4hd+yq4ivayJ2qmWjQIfxIZqQNIMNocfvpXmRJghl31RxbT7N1tDRYpcTlAu8FgQs 2YbQ+HLm1HhpYfYI1i/O7LN3vhWGBdW1u5VVB4OhdhNWTx3KT40npgVX+t68FMdCrcMt /bwteKbTdGtxroVf2lfFk741+e+hiLCrhbVIRwYIabdAdE0N+/Cq3vot3crL/bUh3hnR 10a65FtnRK3P33i5xb/KyRaPDCDAfrOd0MfQba5o/QgrT+SPcdz8jHMJvAdeNDoDQu5I cEXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q0UfAH+l; 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=pass (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 f187si9084993yba.121.2021.08.21.21.01.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:15 -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=pass header.i=@linaro.org header.s=google header.b=Q0UfAH+l; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefa-0002Dx-SQ for patch@linaro.org; Sun, 22 Aug 2021 00:01:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaI-0007l3-HB for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:45760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaG-0000c3-So for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d17so8184185plr.12 for ; Sat, 21 Aug 2021 20:55:44 -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=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=Q0UfAH+lsheZ+rL9/EIPlLbjIhmJghjkBazqhaoQgHeNMqmFGQFAZz0KSllGnjjhWo Nnu6fMjAaFalx9zKoYADERsIBoh9p/dRJ8u2gVjE5vyCCpunpOCd682TCgjtpm/XWgkA SPXItbBXQsMPwNV8WrTUhjztC8qj6BDNaxvmy9boZYBMftvLBYaTDVbfzdzGQrgBWjCW +hdD2LlNqNu+CKv0GJpfTcc6h7W9EotoamT/Z9rZOdoTZAGifB2D+wmxySyYUAIQjkCd 0x96RiqMOjeXst+t7eJAoeoPWT+HExTLAy90wy23dngQf1o/S2sdUILsdCyNUeOipCqC 6npg== 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:mime-version:content-transfer-encoding; bh=qnzdMjgcBsPzYrCkXKkHqDyfkhXP0vzUSwft+EOabQ0=; b=Q/VyUmgVwasbdpg6RSc4Ic9uGANmk96wK2v5rEC6eZQCKG2hlEGeQVM3NeSpF/9aWF y0s8ERDD6pjLVBBnyuKNDdR9+77GR3/FgRzBcbkW31DZAAmCLICzfkYn/Hb2ZiwShdCs IrXNQqzepeIm2zMy6xE/3J+A9Y09rG+ARaV1dkm05kJAOt2SMAtDk5NfI0nJBn/q0K1p 3eYQiZh+TVcgf+OIkctOprMBQ1g54PzsdOJc0EK+zzNSZQTBdDpkzMdUyzcCexACgFiW sJ1k1Uv0PuVdMQ0P6pYy98LUuE9LqZhZJ4go3j/atduTAzEm3EWBg7LcKgjuHFzghXm4 LB2w== X-Gm-Message-State: AOAM533K4zj3gDSk2VTsmHbQ1BPg0zD5KkiNslzQuYxGy+QX1+/HcxDD N7yj+arq9fSW18uGzIw8I8byTEBOo4YCUg== X-Received: by 2002:a17:90a:5583:: with SMTP id c3mr12634365pji.133.1629604543624; Sat, 21 Aug 2021 20:55:43 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/30] linux-user/arm: Use force_sig_fault() Date: Sat, 21 Aug 2021 20:55:14 -0700 Message-Id: <20210822035537.283193-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the new force_sig_fault() function instead of setting up a target_siginfo_t and calling queue_signal(). Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-7-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/arm/cpu_loop.c | 53 +++++++++++---------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index b8ece169f9..d4b4f0c71f 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -93,7 +93,6 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env) { uint64_t oldval, newval, val; uint32_t addr, cpsr; - target_siginfo_t info; /* Based on the 32 bit code in do_kernel_trap */ @@ -142,12 +141,9 @@ segv: end_exclusive(); /* We get the PC of the entry address - which is as good as anything, on a real kernel what you get depends on which mode it uses. */ - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->exception.vaddress; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); } /* Handle a jump to the kernel code page. */ @@ -285,8 +281,6 @@ void cpu_loop(CPUARMState *env) CPUState *cs = env_cpu(env); int trapnr; unsigned int n, insn; - target_siginfo_t info; - uint32_t addr; abi_ulong ret; for(;;) { @@ -321,11 +315,8 @@ void cpu_loop(CPUARMState *env) break; } - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, + env->regs[15]); } break; case EXCP_SWI: @@ -393,18 +384,14 @@ void cpu_loop(CPUARMState *env) * Otherwise SIGILL. This includes any SWI with * immediate not originally 0x9fxxxx, because * of the earlier XOR. + * Like the real kernel, we report the addr of the + * SWI in the siginfo si_addr but leave the PC + * pointing at the insn after the SWI. */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLTRP; - info._sifields._sigfault._addr = env->regs[15]; - if (env->thumb) { - info._sifields._sigfault._addr -= 2; - } else { - info._sifields._sigfault._addr -= 4; - } - queue_signal(env, info.si_signo, - QEMU_SI_FAULT, &info); + abi_ulong faultaddr = env->regs[15]; + faultaddr -= env->thumb ? 2 : 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, + faultaddr); } break; } @@ -435,24 +422,14 @@ void cpu_loop(CPUARMState *env) break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - addr = env->exception.vaddress; - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = addr; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + /* XXX: check env->error_code */ + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: excp_debug: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->regs[15]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->regs[15]); break; case EXCP_KERNEL_TRAP: if (do_kernel_trap(env)) From patchwork Sun Aug 22 03:55:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501404 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060196jab; Sat, 21 Aug 2021 21:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztUiL7KePdxOfGGlN9dTHeibUfAo+5DE0VsSXr4YV3TMGWvTcI2Vr9vGIdAwSOlrBXw1hI X-Received: by 2002:a02:a490:: with SMTP id d16mr25231697jam.42.1629604878018; Sat, 21 Aug 2021 21:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604878; cv=none; d=google.com; s=arc-20160816; b=ndHH/LqRg6qhIV3HqxWOrO89NcFC36INOgtAKJi10pmmnvBMqVB88KWMgSlBoq7RGC Qy/tO5y4KS+n5WvwnhVLRttdWOXOPtRhNwHPOBp8Rlx9HSbJP03c2R4j9hubgTq4VHpr VxNS85S9M4xwlWCbefeGV0IfwjIu8FCxnq+nyCgboPlQkLeC7rkaXilRfzpS4vcFXQP1 RLw2gwkFMOH6WkkWPDahS6Hc+qbf8lhxKzCXKYjHw6o9OCR3KWCKUwWbfEbbtFecKcJH yhkahFt5y8kuBA+RzrZ/d+Ahgb50Jy8cq3abjEi3nav5CjdmwxsMnKnmu56Ymf9tj8y7 qrYw== 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=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=tGnLAlv/uigd45p9mXEkm/kMEuIQbKKEKjArawcmPGxKnJhAQdO40q9xGx2ZzRubnU KjZdWUPiMFlVtpsQyb9z+AqZzah2IBfr4OYfiAU31zUb92XEgcX5811iwjjCBiCftG23 dezSLUKEs3DVweRe7m5bh6kvONIwBN9K+pBOS8/TyMH37UYTb/yJ5X8aXPc0pzKRXeKK tINuwbuiIO49HHLAR6DHnlgx68EsQIZeg0AZVqC971Z4Fn73dqpzXTq44dQ/wmPwMT8c myfsUpYu/q3ICozK5BX9UyGoUBtq1XPcQBtXtOnNftAfjiByWz81SsD6cdV79hjVjkpR DoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xchPxoDA; 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=pass (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 c18si11214329iod.38.2021.08.21.21.01.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:18 -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=pass header.i=@linaro.org header.s=google header.b=xchPxoDA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefd-0002GO-5s for patch@linaro.org; Sun, 22 Aug 2021 00:01:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0007mY-4N for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:47 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:37662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaH-0000cu-I3 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:46 -0400 Received: by mail-pg1-x532.google.com with SMTP id 17so13325252pgp.4 for ; Sat, 21 Aug 2021 20:55:45 -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=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=xchPxoDAQ04Eb5iiEHoc4Bee7DGqSwqeKuibN8T6S2vugK8iMJU67nCOn0UYusc5sj T7NQypJaVKqFIX2/C5oIOazxz8bI3W5R78YA+iWuber2asmW5No0pltsx6lglJi0724E Klq417kaIKeITb1VGbIgys5Y/nsZVU3+G/f2Fkm4vCzKnxDkTlwZ/Tcos/GNefA95ODo gGANtF3FgxCrqj0WqyfxuVdAnBkdWOzBUpSv9YA9LfHQqSEUELfQtb+FLN1lHQ9zCy90 m1dYI0qGtkrTJp/bQ7cV6qprMlI3xlF6Y25gXUJdaQqiYdm8PNOcXby32bHrU127LEIz rhsQ== 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:mime-version:content-transfer-encoding; bh=qGpOhcDg+ef3HF+AW1Lu1mwmMePA2ZX5mvS/TXPUc4Q=; b=kOQHMHcOIXEFTgKsRr9oL+oyOGgkAh28bqLiDi6FxgEMucfvf4acBcE8AsOxjZ9UjS UzqfNC1JKuTO/YB0TvyTkRavDoG6K0kzKR3DutnLhs3bZMLgCXzRad2H/kOHrcI7Jm0G 6n3AtZsYj8cPwoydzBBxR2LYhwNt2N48N8GTTM7y13qHqNzTcSgMT7nkh3BQKrxBnzlR +I0EKgFNYvlTYORzyBEWlN5b0v6+vaC+QP2zqTdHZ5R1IUv0qf+UTSuVGvVRG6qDOq/d aMmt9UTn8ZppmcaSZHwOtdmst+GqgS68ibJ2/KLHGSrR1oPq57cb9yFACKpsgnYlvYOl JytQ== X-Gm-Message-State: AOAM533iDqy2LcYHu91l9wmsouwmCk9SeJH8s/NTpUqkquDrFyoDTr5y Q/ySTdESWNoUObmQEc8xNuLJD/shXnOAaQ== X-Received: by 2002:a05:6a00:a8a:b029:356:be61:7f18 with SMTP id b10-20020a056a000a8ab0290356be617f18mr27434020pfl.29.1629604544241; Sat, 21 Aug 2021 20:55:44 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 08/30] linux-user/aarch64: Use force_sig_fault() Date: Sat, 21 Aug 2021 20:55:15 -0700 Message-Id: <20210822035537.283193-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the new force_sig_fault() function instead of setting up a target_siginfo_t and calling queue_signal(). Signed-off-by: Peter Maydell Message-Id: <20210813131809.28655-8-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- linux-user/aarch64/cpu_loop.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 5d8675944d..11e34cb100 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "qemu/guest-random.h" #include "semihosting/common-semi.h" #include "target/arm/syndrome.h" @@ -77,9 +78,8 @@ void cpu_loop(CPUARMState *env) { CPUState *cs = env_cpu(env); - int trapnr, ec, fsc; + int trapnr, ec, fsc, si_code; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -108,18 +108,10 @@ void cpu_loop(CPUARMState *env) /* just indicate that signals should be handled asap */ break; case EXCP_UDEF: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_PREFETCH_ABORT: case EXCP_DATA_ABORT: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = env->exception.vaddress; - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ ec = syn_get_ec(env->exception.syndrome); assert(ec == EC_DATAABORT || ec == EC_INSNABORT); @@ -128,28 +120,24 @@ void cpu_loop(CPUARMState *env) fsc = extract32(env->exception.syndrome, 0, 6); switch (fsc) { case 0x04 ... 0x07: /* Translation fault, level {0-3} */ - info.si_code = TARGET_SEGV_MAPERR; + si_code = TARGET_SEGV_MAPERR; break; case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ - info.si_code = TARGET_SEGV_ACCERR; + si_code = TARGET_SEGV_ACCERR; break; case 0x11: /* Synchronous Tag Check Fault */ - info.si_code = TARGET_SEGV_MTESERR; + si_code = TARGET_SEGV_MTESERR; break; default: g_assert_not_reached(); } - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, si_code, env->exception.vaddress); break; case EXCP_DEBUG: case EXCP_BKPT: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_SEMIHOST: env->xregs[0] = do_common_semihosting(cs); @@ -169,11 +157,7 @@ void cpu_loop(CPUARMState *env) /* Check for MTE asynchronous faults */ if (unlikely(env->cp15.tfsr_el[0])) { env->cp15.tfsr_el[0] = 0; - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info._sifields._sigfault._addr = 0; - info.si_code = TARGET_SEGV_MTEAERR; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MTEAERR, 0); } process_pending_signals(env); From patchwork Sun Aug 22 03:55:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501407 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1062155jab; Sat, 21 Aug 2021 21:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynul8p8h7nUqCSJ6/MNYLz9nYSrvDBrgNDpJbPdVU9qvLTQL5KMTk8fnJRYKsYbCafl6Sj X-Received: by 2002:a25:ad96:: with SMTP id z22mr17470480ybi.137.1629605105114; Sat, 21 Aug 2021 21:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605105; cv=none; d=google.com; s=arc-20160816; b=xU4/i/5JnXg1EaBMcwzUktbD7vhZCLX7ztK73qfS1xQB/br43pFG4V/jd9jNduX7Z8 WK6c474oukutaEKHEqi7ujTnxIYzQ2VXVt7Ks2Qm5bJ+UMW8t4A+CwKVxNNb8ENdxNzT 7EDNgtzGF9Oa3ZPMUXlmjZOgjTetrzFDHLuccZeAhLMn4XalZB7634FFKNbKfCw50OyV i6NRhfCciC+SV39kk0sPGG8I+GYZ2NbXH/EFOBQb7H3kDq6igetpSgJdJVAbt0VWJGKE VWqYDdn2CCKhdM2gu1EQC+LLMSWXTfeQsOaESC6RG6p2CMuwBE+Hh3wub5JREq8dTh6H wOFA== 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=aaG8+wKRstXR/idWhImzrCGyhK5/kWZ1S3StnyK++N8=; b=pqWXgKHh0JgwXCVLiJoI8kP5qO32VRcxLfPO24r7Jjib1wBQyizAUITKrKP6EnPkHq psdVwmXL8re+qBWkyIWrdr867Qojy4JjrSa6EZGhbFHb88kTPGxbKm9rIm7vQwfqd8Kn C041HttlDQZZ3WHY7Okgxm9lShPInWUSdVtRbQWK0hkYlJ76J+vHzacn2Nf1D3fWx/0x GR7FTdPV9Dq4NP4Tkb0OKzVwIAAaQihrpOd0HX2vxdHUuqlqcJ/EBt7LmyRSbj8x7wW3 bGohqe8OoM+n0NGjw/CIbop8dl/BpqsBT/wCk1RHrA+4aAA0P9OXu43ksqik54DH/f0c H28w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JhSE/FCD"; 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=pass (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 v11si10161123ybl.152.2021.08.21.21.05.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:05:05 -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=pass header.i=@linaro.org header.s=google header.b="JhSE/FCD"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHejI-00080F-Jk for patch@linaro.org; Sun, 22 Aug 2021 00:05:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0007nn-NY for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:47 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:46042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaI-0000d8-4p for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:47 -0400 Received: by mail-pg1-x530.google.com with SMTP id n18so13344828pgm.12 for ; Sat, 21 Aug 2021 20:55:45 -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=aaG8+wKRstXR/idWhImzrCGyhK5/kWZ1S3StnyK++N8=; b=JhSE/FCD9VpeiNgtOctsp8rBwzZ3IWhSLO/0K0C75LXZxUnzmJT06E5gmwz8kVIBxo 42i+SDOuvpRUWX/gVHzjRT9xn9ioLdgafmnxhksVVDRIsM/LMGLj7EpCbUAWrEAtNcNq etwYjwJAk7fsJhVtbZwZbsrnlQQf2csbX82lxG3OpfJsMJNzN9qcmZJ0ZMvBmBDG1xzU 0ASOvagUhCEBNtUPS3824vah4EBnELLkhGPm3If0lhnaCPnoZHjl9oFl/rmYi+4HEPzC ogbSWtWEOWD31DQjeWSs80TX7ia2Y1JcAGIxwdNLAj5a9JDniZ5HDnJFaeIpzr3eouXc Gihw== 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:mime-version:content-transfer-encoding; bh=aaG8+wKRstXR/idWhImzrCGyhK5/kWZ1S3StnyK++N8=; b=PuT0Fd3IAAFDmo09/vZb7qI8Wl9vdrCX9MSPaA+PxfYtBI1b28NBfgKsCB7bcCcMci Q19OUpfjl85TWy2ZzflAp86+qlfCYXk2OiNYK3RPEq3Nr4kxe0GYL47Qq8v9tkEUjWbb Kh48fIBNnr47RlKE0myN/VrsUrNEJ9a2PLmQvapJ1AL4F61i32O/BCjqs8V3h8bUtl7K /F6cDP6nNw5LjtdcnPc4+o3XpK2RoHcRRIn1HZmimNhdoS7CGdfFZsxkOT5pTXbF2Ck1 m5q6Eoo56FgQz/weTPduWOozhCS//VQKhENTg3uptV67/wXT/mjvkmBv7SA5bJmg/8Go k/Qg== X-Gm-Message-State: AOAM530B73ckA381ohqiiCs0VQXSs+1aDTqd8HPT6uJXSLbog1G8iZHq NXJ8wQbztfQccd4DIuwrjsfA8ZdzdngWCA== X-Received: by 2002:a63:2585:: with SMTP id l127mr26702754pgl.264.1629604544819; Sat, 21 Aug 2021 20:55:44 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 09/30] linux-user/alpha: Set TRAP_UNK for bugchk and unknown gentrap Date: Sat, 21 Aug 2021 20:55:16 -0700 Message-Id: <20210822035537.283193-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These si_codes were changed in 535906c684fca, for linux 4.17. Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1 + linux-user/alpha/cpu_loop.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index a5ce487dcc..55ccc6ae03 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -715,6 +715,7 @@ typedef struct target_siginfo { #define TARGET_TRAP_TRACE (2) /* process trace trap */ #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ +#define TARGET_TRAP_UNK (5) /* undiagnosed trap */ struct target_rlimit { abi_ulong rlim_cur; diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 7ce2461a02..b2e9503c50 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -99,7 +99,7 @@ void cpu_loop(CPUAlphaState *env) /* BUGCHK */ info.si_signo = TARGET_SIGTRAP; info.si_errno = 0; - info.si_code = 0; + info.si_code = TARGET_TRAP_UNK; info._sifields._sigfault._addr = env->pc; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); break; @@ -168,7 +168,7 @@ void cpu_loop(CPUAlphaState *env) break; default: info.si_signo = TARGET_SIGTRAP; - info.si_code = 0; + info.si_code = TARGET_TRAP_UNK; break; } info.si_errno = 0; From patchwork Sun Aug 22 03:55:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501402 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060138jab; Sat, 21 Aug 2021 21:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC4EH9fAyXOpiYvj+jcybt9MMfzNibCjLPCRf6Wy8EDObun76m21PobUnUHmi3wCpANH9A X-Received: by 2002:a02:c8cc:: with SMTP id q12mr24321158jao.93.1629604872525; Sat, 21 Aug 2021 21:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604872; cv=none; d=google.com; s=arc-20160816; b=H/mWcs5nxy7mOjiMbq32OGbhxASzE+ykbpWY8Z5ky5IcpTdtV6mJT43rtCPGL6Y0Ob EwBf+pFzEv5ReqcIYQoWGPrSqxh50TVioGd7NNMkcRvPlEO3ty+y/YCZPcroa9u8xkwt ri9q/5FvgfxotrmnK5ghijtfWOgVf+3PWfJFn0zn0MmtBiOjmEcV95btU8ooXYOsFjIh raRWVjnGSyO0z0H8/h3g6dEx4guvPqV8boTkLOitCOOQPFfe0WWjTrv3MHmD1Jx3jG2p ZSAdsNL8Et+cTvOQqjPbSf3AJsxCvu73c3P7qoYvuEJmibB3EUgYQK9f9tryd6O7V0CF Fbqg== 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=ZSv5B26XxDivA72RLN37D0Ox9MVhtWDMvhKjh5v96B0=; b=VKe0JT+V4ttUv4fEj0RKyoluEvQNs7GLnltlFwe0dPvMvTGdTuDLILZMGSoWbZ4mYy SVhTp3umhgaTeir+13cnyJQfWB4ZVeUYfXHnUw7GrnPuQ2Zs+kLhZxfwav1LrrebfdS+ DyouxzdlnvJ3LvVzuAzwhz4XBHkQRsJK3grmGf8ddzjDtsko0RR902Z1ksItphfNbJYu oO9/09MwPDpTEbxEEoHVsBbu9fGBl5NuZqbhPNO+cFd8dgth3q9PeeCE/BKhp8OXQT88 kPR8wOXYmBc9SPH8+fSuDNsFQDb+2ojOFJGt+nwgMlegYZBDoyMVa7Hk62zsT9chUztY Ep0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ML8S0l2H; 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=pass (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 z4si9947842ilh.138.2021.08.21.21.01.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:12 -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=pass header.i=@linaro.org header.s=google header.b=ML8S0l2H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefX-0002AE-Th for patch@linaro.org; Sun, 22 Aug 2021 00:01:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0007oV-VY for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:48 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:56206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaI-0000dH-Hh for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:47 -0400 Received: by mail-pj1-x1033.google.com with SMTP id mq3so9789104pjb.5 for ; Sat, 21 Aug 2021 20:55:46 -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=ZSv5B26XxDivA72RLN37D0Ox9MVhtWDMvhKjh5v96B0=; b=ML8S0l2Hio8vpNRfx8XETWrB3AouCdXVXAbkTjM/xFinjCqwFb8hbS9ScROBRr2OFX GSPP+aZTEEZErNzZeQ6PFjngAVaobpr+9Alh0m35sa9Yh3grdI1kEokC5aaSq9wDDYKB H8YI9D73M1wyxXcV+2SMgzX+UBSLEeU19QSWlrqV5DREeybEcPjwfcgg6RrKdGAd50C1 4RqGpCIIC1u334KhyZ544AqS5G+/zN1/yv5BZF6cXlkEzPJaXUpcrmX9Y13mMzf+DS+K PwkiWDboKuJU3xBdUjQRBCFQjILw1EYoGwXNht4b67HWoyFbuIKXJhbVppQVhP5DYSji tJgw== 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:mime-version:content-transfer-encoding; bh=ZSv5B26XxDivA72RLN37D0Ox9MVhtWDMvhKjh5v96B0=; b=SBWDHx5JOEmh9TZS9PpPxfHXrtYtHjs+cvFO2nyKAXbavLhc5jGs0lUIX2eOiNzM6c pLu++cB/LonYIDvcCkdg86wrHn3EMFdq3HuLArnFnn8X4SJp+DYD4chjvNnKIBI/GGQ4 CkXaTSD3cO61PiF9+FWytFApNQmQLVef6WdVMD3VM7W6y4I7J9gGchX15XChHWZHWua2 0sJ+WQBPOi8dnG6NOirTF//rYR0S43tPpWO5oFfJmLIuXnKjAHVW2IaNe4MLecqzhrYZ 7yDcpFbxhrKzgSaNMiV7qd4AdVwXIz228SqHvukiaqJofOe3jnG+Pp7qulB/La+nrwv4 q4FA== X-Gm-Message-State: AOAM533+3UDdH73MQzgn6RR5xr7bX6+CUG3+P62i4DItA2Hoxm3Qkv47 t21kW7BhDqll0xrJQszXqEtOlat8S2BgdA== X-Received: by 2002:a17:90b:4b0b:: with SMTP id lx11mr13141355pjb.70.1629604545417; Sat, 21 Aug 2021 20:55:45 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 10/30] linux-user/alpha: Set FPE_FLTUNK for gentrap ROPRAND Date: Sat, 21 Aug 2021 20:55:17 -0700 Message-Id: <20210822035537.283193-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This si_code was changed in 4cc13e4f6d441, for linux 4.17. Signed-off-by: Richard Henderson --- linux-user/alpha/cpu_loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index b2e9503c50..e5f78a439a 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -164,7 +164,7 @@ void cpu_loop(CPUAlphaState *env) info.si_code = TARGET_FPE_FLTRES; break; case TARGET_GEN_ROPRAND: - info.si_code = 0; + info.si_code = TARGET_FPE_FLTUNK; break; default: info.si_signo = TARGET_SIGTRAP; From patchwork Sun Aug 22 03:55:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501406 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1062128jab; Sat, 21 Aug 2021 21:05:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5M3pIOGUz8X5ce5mLSQ62eu/8aDIh+8VAkrvZEpqAqRKeOCUExjf2/FHZQVB8vREtz+ml X-Received: by 2002:a5d:81c1:: with SMTP id t1mr21997928iol.31.1629605102166; Sat, 21 Aug 2021 21:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605102; cv=none; d=google.com; s=arc-20160816; b=TkB/KsofFdekcEMdcVHKcFpR/nytT38xyRWa62OJz48K+zWKpiefE12kzwr1drnbEJ IQAamF4pXC+oWUwi6k6cM8yzAqYxd4WqNbJsP96CVYXZ8cKjpno3skTQcBpfSSkCnoag 6583VyXQtawog6PUSH8Mx74LjPyiJ3ZtynehMVeW1v7ZReA0PVPp6Ck+zuByInjw/tid 7mPvF/9y0yMy9R+wDEsEp+HiXrQgw+FcPcJzIB+MXvCzEWIaO4f+yGdjx1rO07A70s3E iSYIuNFP4wLAxMuBU2NyLZcUHTNFYvw1KcZwtVw96W1IZ7KQ390ygf6/OPrnNUw4B1sV 6EeA== 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=RXyNVnKqczOF3zQ3IizA0BEApi83sp6PDrOKK0oyLMQ=; b=ptdW5/EUitwixZwiaF5HUuRXHYeWyPidy5I5BuVskVNB5mLdznDA+uPfMU4Vwlk/9g KKZPn/kNgOhFKIuleAvAWMe2IuE3Q0CsR2HhYyuOAvO67uFqaucgbosgsIZIIcuK1gVs Nfp1C+FND5GweSoTGcQjG52tbA9apx4oJNNTBcJjqXsPbuawkNm3RWKSTcRBjQz17xLR f+QQ6onp7ixMPznu3U9jwKh0fz4hkHEK+d378TQr8vH0jEnjM+/Ny1lrG/ckmqKl+ACE VxUG6NLgIZTgc92reS2hxaWl71L+4laOM50XLJeVH1VLWXtc2g61mhgrCsoTgHKJM2GD 6U/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="U+ETfGt/"; 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=pass (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 u10si14579071jat.85.2021.08.21.21.05.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:05:02 -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=pass header.i=@linaro.org header.s=google header.b="U+ETfGt/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHejE-0007u8-K8 for patch@linaro.org; Sun, 22 Aug 2021 00:05:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaL-0007ph-0A for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:50 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:46594) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0000eM-A8 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:48 -0400 Received: by mail-pf1-x436.google.com with SMTP id y11so12287632pfl.13 for ; Sat, 21 Aug 2021 20:55:46 -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=RXyNVnKqczOF3zQ3IizA0BEApi83sp6PDrOKK0oyLMQ=; b=U+ETfGt/RXBkTWmiZ88zrYtFcLjGQXvms465QbgBK7FfsVVmz47qSA+gSeFhUehYYi a9iFVayxCryuyJzpVXbroy4llGepDRzMrx7jH7r3HlBAK7Xri1xPDbZzhFY1JyLhFSJW YGiUKH7A1LVIkkA6xXW697Wr6kfoXgSEH2jaDvDxajbKfSbQKsVLyzILumGD/gKt1PQP bq/ocqQj7+Ki3/+KtU9Z01ieMR4421XJ4IPo//l9TLf5m7p6uONEBeWS4nEQB+6/pHp+ 4hTqR3fIPKipz/WgbHKjlhbEqCdx6qaYdIAgyTFVeUdCIFMQoXDn3xeQDGDhbKwRoaac mitQ== 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:mime-version:content-transfer-encoding; bh=RXyNVnKqczOF3zQ3IizA0BEApi83sp6PDrOKK0oyLMQ=; b=mlRvyV96QEN6yz1kKNyvKQu76+GsU+XnmH10XRKb+IiTAfsXy/ZHf72RFG3Ybat7LJ 1KCa3uxOjOnt4iWRNnWRnBdvI18aeZa7Sl/NibSdE4+598dDAVXPYjczlcHMp+91QBLy qWw5408DfF5UAEFA/thqLuS+OZr+U4s5iZQU/8iVUhX9bwjGKZ/e2e4mUMnCecHciZoW gNGHqbGM+yyxAVEnSPC1l0wQVxLZ0RqsS8SPxXprzdAgrvmpjuVd1sBW04INm4t4OB6b LzNGM48/M2LnZM/L6HSGsVGfYX8ZC6gdweJ/nrv6LSu3xx0ecq7r3R5fhIKo3nSPN2Mn 68eg== X-Gm-Message-State: AOAM533SUZXeNs2u7Yb4fj/nYgl6RywwZYAHLZzA4L5EV8hG8P4fHSy9 6NNoYdenJNmJYa1CXWmlh6NvLDEJOn8Okw== X-Received: by 2002:a05:6a00:2405:b0:3e1:9f65:9703 with SMTP id z5-20020a056a00240500b003e19f659703mr27504036pfh.6.1629604546037; Sat, 21 Aug 2021 20:55:46 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/30] linux-user/alpha: Use force_sig_fault, force_sigsegv_code Date: Sat, 21 Aug 2021 20:55:18 -0700 Message-Id: <20210822035537.283193-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/alpha/cpu_loop.c | 76 +++++++++++-------------------------- 1 file changed, 23 insertions(+), 53 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index e5f78a439a..b624311a5f 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -21,12 +21,13 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUAlphaState *env) { CPUState *cs = env_cpu(env); - int trapnr; - target_siginfo_t info; + int trapnr, si_code; abi_long sysret; while (1) { @@ -53,34 +54,17 @@ void cpu_loop(CPUAlphaState *env) exit(EXIT_FAILURE); break; case EXCP_MMFAULT: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = (page_get_flags(env->trap_arg0) & PAGE_VALID - ? TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR); - info._sifields._sigfault._addr = env->trap_arg0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->trap_arg0); break; case EXCP_UNALIGN: - info.si_signo = TARGET_SIGBUS; - info.si_errno = 0; - info.si_code = TARGET_BUS_ADRALN; - info._sifields._sigfault._addr = env->trap_arg0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->trap_arg0); break; case EXCP_OPCDEC: do_sigill: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; case EXCP_ARITH: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_FLTINV; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_FLTINV, env->pc); break; case EXCP_FEN: /* No-op. Linux simply re-enables the FPU. */ @@ -89,20 +73,10 @@ void cpu_loop(CPUAlphaState *env) switch (env->error_code) { case 0x80: /* BPT */ - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; + goto do_sigtrap_brkpt; case 0x81: /* BUGCHK */ - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_UNK; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; + goto do_sigtrap_unk; case 0x83: /* CALLSYS */ trapnr = env->ir[IR_V0]; @@ -143,47 +117,43 @@ void cpu_loop(CPUAlphaState *env) abort(); case 0xAA: /* GENTRAP */ - info.si_signo = TARGET_SIGFPE; switch (env->ir[IR_A0]) { case TARGET_GEN_INTOVF: - info.si_code = TARGET_FPE_INTOVF; + si_code = TARGET_FPE_INTOVF; break; case TARGET_GEN_INTDIV: - info.si_code = TARGET_FPE_INTDIV; + si_code = TARGET_FPE_INTDIV; break; case TARGET_GEN_FLTOVF: - info.si_code = TARGET_FPE_FLTOVF; + si_code = TARGET_FPE_FLTOVF; break; case TARGET_GEN_FLTUND: - info.si_code = TARGET_FPE_FLTUND; + si_code = TARGET_FPE_FLTUND; break; case TARGET_GEN_FLTINV: - info.si_code = TARGET_FPE_FLTINV; + si_code = TARGET_FPE_FLTINV; break; case TARGET_GEN_FLTINE: - info.si_code = TARGET_FPE_FLTRES; + si_code = TARGET_FPE_FLTRES; break; case TARGET_GEN_ROPRAND: - info.si_code = TARGET_FPE_FLTUNK; + si_code = TARGET_FPE_FLTUNK; break; default: - info.si_signo = TARGET_SIGTRAP; - info.si_code = TARGET_TRAP_UNK; - break; + goto do_sigtrap_unk; } - info.si_errno = 0; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, si_code, env->pc); break; default: goto do_sigill; } break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + do_sigtrap_brkpt: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); + break; + do_sigtrap_unk: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_UNK, env->pc); break; case EXCP_INTERRUPT: /* Just indicate that signals should be handled asap. */ From patchwork Sun Aug 22 03:55:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501410 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1063509jab; Sat, 21 Aug 2021 21:08:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+/aw7E23gpgFOyq49729M7RnbcKIKJaFo/akW5ldr8ySeOgtE/0u7Qtd7PZuQg1pnVF9b X-Received: by 2002:a5b:884:: with SMTP id e4mr13699517ybq.124.1629605285381; Sat, 21 Aug 2021 21:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605285; cv=none; d=google.com; s=arc-20160816; b=vFRNCb4ZgdSce0xUxtRdQkJPM7Mjx6v8O86BQHJ97+YB+5BNq6yAMoBcVkdRF9rhpj Cw40V7mAuIFggh3/Y1gwRFG5TYmK060KUddwwGphC9LJT6CO9qsJJFt9C3LntnqBGwSj tSFSFQ7Ih9Gk4BF9Be2hRB8WM+BFhZpTKlChOak+Sj80VY/Ti3U19Hd3KYyjZax1S8mV kObVecGpn7AU/l8xtsVzIIPv9lyodGuAz+NFJ6nIMAe8ALFifUY40cQxLHo16SVpe9R5 7pdrdftD/6xogMO92DZBTzpxhG5+VpibR3joASRcB7Dz2mLEsx+u1c1UjX9uREJy8dqs tCcQ== 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=WrDsV8FuQ7eVHDLBH4cYkBRu3DriqEOVfUQFkxYbNm0=; b=00SO4z+GgXbq0+zFbOBQeA5WjLYn65DsTqw6Y3v85o8IKE67EtC6l/AAj6x4EczRxj 9EXQO94g2VW6ffwvlQ/JqBE4xwYe1Rhmgs3fprQeq+la3JOE5PB777KpaqaVyG1mDr72 gIn8FqI2uBLEF710klpNeKGBEBwqCSpuVdlHYSw5N/JhhEs03x+jDD/fm9bKPPrqfGHJ Rz7PTXW8GxiAS1Jg+NOeIwIz/3AIBlFudXmt/Bxhje/lGKupb0hrKcU32n30THBilsT1 rj0WF6I95pwvIOUtgGIHy/pEYLqM0OYzY0jhmt/MLCF1kZlkJHnUyvYZ1cuaVhBLSDm7 bmiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="S0ZT/QMR"; 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=pass (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 k20si11690680ybj.350.2021.08.21.21.08.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:08:05 -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=pass header.i=@linaro.org header.s=google header.b="S0ZT/QMR"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHemC-0005Fy-RY for patch@linaro.org; Sun, 22 Aug 2021 00:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaL-0007py-Ek for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:51 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:44840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaJ-0000f4-VM for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:49 -0400 Received: by mail-pj1-x1035.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so9883309pjb.3 for ; Sat, 21 Aug 2021 20:55:47 -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=WrDsV8FuQ7eVHDLBH4cYkBRu3DriqEOVfUQFkxYbNm0=; b=S0ZT/QMRBhf3vVb8u/7R3LEsKkFjJBCi0HxuN7UcM4LUI160vpIAjxxwgFfhbOq4MD esdaVv+eE/DMcMWYAKlK0LdAWyvh0wr77CyfG3ZbqcgU+uEDa58xYFHRoSaSn6TZW0VP qhJ9WzWBJl964uQcDXYC2+TShzD1gW2g9O+BcGyBcs/J3uzqJHX0Z+WTDHRx06ZyQAIo epZ8+w+GTOVeeVYkM5U4SRJEHwWbY+qirUc7+QXrRgYemyDu4spdAvGexF5s8K0AmKrg sRBYuASUu+/4R62kChy2nt1twRQE/3L57/WZ3o4mwWtGeWIKp36uVhuL1Sd41ZM2RVCd UvtQ== 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:mime-version:content-transfer-encoding; bh=WrDsV8FuQ7eVHDLBH4cYkBRu3DriqEOVfUQFkxYbNm0=; b=d/yHyf/HE4RIjXtirK7s/9p8R2TQZUPTfIERKc4Sx3lUT/61xHWAHZ25SJoY5J6oqY aPHveYoxHY/5H6uYhj4tgwY5eBi3f7RDirka+pmQ1w9YSswqZDsNkjQm8YmNuqj778zl sfsJ/iuAr8zUhQQiMsnML88uMQCYM89ZoN7uYGDu2vZpBdv2VrV+l3t/rmPewCab5eff 3+doolE1DFnmuHnhx5373zJlwUq6+SZhRkKinrGOdSeut3mP2KIF3wWW1q9tTCwkv3Wh DII2/hD7pBedY9G4lxbvQeXxgtvY/ojt6ywqUNVlsz0AjeVXMVCVshG2CjOTWAAJ4PkV tXrw== X-Gm-Message-State: AOAM532HxslQVtzSucgCn0fOPrpT8mN4KYsdVyJHio3324iO7g93uYkc X+xr6IwoeojM13df9dgcSRreUFyQnrXslw== X-Received: by 2002:a17:902:c401:b0:12d:8258:e07e with SMTP id k1-20020a170902c40100b0012d8258e07emr23088099plk.51.1629604546656; Sat, 21 Aug 2021 20:55:46 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/30] linux-user/cris: Use force_sig_fault, force_sigsegv_code Date: Sat, 21 Aug 2021 20:55:19 -0700 Message-Id: <20210822035537.283193-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/cris/cpu_loop.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 334edddd1e..7a31402ab4 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -21,13 +21,13 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" void cpu_loop(CPUCRISState *env) { CPUState *cs = env_cpu(env); int trapnr, ret; - target_siginfo_t info; - + while (1) { cpu_exec_start(cs); trapnr = cpu_exec(cs); @@ -36,18 +36,11 @@ void cpu_loop(CPUCRISState *env) switch (trapnr) { case 0xaa: - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->pregs[PR_EDA]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + force_sigsegv_for_addr(env->pregs[PR_EDA]); break; case EXCP_INTERRUPT: - /* just indicate that signals should be handled asap */ - break; + /* just indicate that signals should be handled asap */ + break; case EXCP_BREAK: ret = do_syscall(env, env->regs[9], @@ -65,10 +58,7 @@ void cpu_loop(CPUCRISState *env) } break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501408 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1062194jab; Sat, 21 Aug 2021 21:05:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+KTtrrXwW9S2fDEPEnednZ08gNsQGWBV8Xq0HyFQrwkzIytJoUyq6JukW820OI2Vqaj9b X-Received: by 2002:a25:d183:: with SMTP id i125mr37307071ybg.408.1629605110302; Sat, 21 Aug 2021 21:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605110; cv=none; d=google.com; s=arc-20160816; b=hi+S7GKSqYmBKI7YaLOBcYd7F3u4aCzcXvDKDmK7gwyiIXLnFaP2SG22eV2xG5cHqk SO0oMQscW/p8dr0pQ2Y91WOG1X8Fnq2oU6JFCqJg6JHNo0Fm0G3EwihESA906xv4p+3M 3TGfDv/RMKTKpxDJRTE/v8ozTkY0Wa06og3uWCui95DkIJ6Y4BNytNstuQkFBgXaGx0l zppSIKBCGpKl+GVQVoDPUn1kp/KmLRK5m+oqTYR96NtzLpFSe2WkzgUFFK71Hkt0lOv+ 2GXDju1BCCF2UeycTaYSMtXQIaPlBCRAEArKmpkWCJRHpW9YP5LdM9Y3fdiZONOMg7CH cFWA== 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=gD9ah6vfgzNO0EDh/fgGFyEHak0Syu4+YvWk62gPhQA=; b=rfCYKfYqPtzVga2jYt7/gkRsl6HY8um3w8S58Pljgxh7FYAUxKZ+hUSxnPE9YVvTep yZ4quc4sMP9A892E3cg3SBPnIFIXjN2orFxvRQOXkZjEbu4JEqElF2IVMiS/2GX1rEu2 l3w3baeFyou6Znr5DpSucR+/dGMZsPqChtFxCOYCT5P6rEYWcMgbawoymPTLcQaT00NC K3H5YaKqEcIXO5aTKYKLowORhY0y8XfzPXh+sET7Rh9sChVohsiLE0LOUNpX0/Vs3EKk FP0hBnw9ZIXTuZrnwVHdZ+K3kI40UcSHcTWzWiGiHI+Vr6jwtGSzNsoMkfCHyGV3Iq/L /EpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yFXC0gwb; 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=pass (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 v16si9368258ybq.403.2021.08.21.21.05.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:05:10 -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=pass header.i=@linaro.org header.s=google header.b=yFXC0gwb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHejN-000846-MS for patch@linaro.org; Sun, 22 Aug 2021 00:05:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaN-0007q4-2M for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:52 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:38904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaK-0000fo-GZ for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:50 -0400 Received: by mail-pj1-x1034.google.com with SMTP id om1-20020a17090b3a8100b0017941c44ce4so16445235pjb.3 for ; Sat, 21 Aug 2021 20:55:48 -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=gD9ah6vfgzNO0EDh/fgGFyEHak0Syu4+YvWk62gPhQA=; b=yFXC0gwb+N0guip7oQqK4473UXpg3KJKiqPTY+H2ExtyAgv9Oqn5/2h7ZK71GHX/B+ phs99iKotIT3FJSGCD3PTIYvTfeBP+EsVh0lpmJ9qwizTyXWWL1nJns2CwzKs1wYpb97 fkevAy9RD8MNHOcDi858Vn8HWPZ0RGOt4lqbnQIA8lHiRMI3q8nVepMuPjKeNfKTCpF7 RrnagGtr7CCEWlSz8xehz8Ov3T/GAfAEnSrSJka0HupKViWuIKBOKIA3NGVZbXBhcpiO 0IFVPbf9UkyeBfLd78uF6KcVThiYuHqvyX7oRHs3NXQ/kAJuOfqV+iXCrnsh58/GX4Ex KDPQ== 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:mime-version:content-transfer-encoding; bh=gD9ah6vfgzNO0EDh/fgGFyEHak0Syu4+YvWk62gPhQA=; b=A+lv3lfGVbSvNKfcjPldIgWiodWXQKRFxsBL9BEEm8S6WfP/iR6MVElxEKbt3vfCDR 8V+PKWYjELwYwZR3bcI27UMlEbW+79eQMbJTgdgdpbzERTZ97+dm2cR/g8FSxiZuvts5 jmpMbCuybq9goP3pg6gPN4ylBN55YTlOHOoPWrv0NOnxt7453lShxTAL1zzfcS4qzdIl U7fazkd0KQaNTWq2b3Ek7oP5g/UBV37Z/ViQzG/OQ+beItgbKpW0DKu0qFBs79aLhzgD k+5RD3vm+oQQim+/w/OL3oq989xgcXfYllHMuEYEJpnHVlwcG+2IQuUbTDb2ijjwvatW RDSw== X-Gm-Message-State: AOAM530hF3LUiudzPRqyOqIWfy7SXS8RI9vTttMhfoQN4W5fFEdMlIgW lEUNl1fedSJhoW+Sw9IwD7Q+lVPF67s8iQ== X-Received: by 2002:a17:90a:c908:: with SMTP id v8mr4859872pjt.196.1629604547255; Sat, 21 Aug 2021 20:55:47 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/30] linux-user/hexagon: Use force_sigsegv_code Date: Sat, 21 Aug 2021 20:55:20 -0700 Message-Id: <20210822035537.283193-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Note that we were incorrectly using QEMU_SI_KILL instead of QEMU_SI_FAULT for raising SIGSEGV. Signed-off-by: Richard Henderson --- linux-user/hexagon/cpu_loop.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index bc34f5d7c3..6095ca06ca 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -21,13 +21,13 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "internal.h" void cpu_loop(CPUHexagonState *env) { CPUState *cs = env_cpu(env); - int trapnr, signum, sigcode; - target_ulong sigaddr; + int trapnr; target_ulong syscallnum; target_ulong ret; @@ -37,10 +37,6 @@ void cpu_loop(CPUHexagonState *env) cpu_exec_end(cs); process_queued_cpu_work(cs); - signum = 0; - sigcode = 0; - sigaddr = 0; - switch (trapnr) { case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ @@ -66,8 +62,8 @@ void cpu_loop(CPUHexagonState *env) case HEX_EXCP_FETCH_NO_UPAGE: case HEX_EXCP_PRIV_NO_UREAD: case HEX_EXCP_PRIV_NO_UWRITE: - signum = TARGET_SIGSEGV; - sigcode = TARGET_SEGV_MAPERR; + /* FIXME: need to store vaddr in hexagon_tlb_fill */ + force_sigsegv_for_addr(0); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); @@ -78,16 +74,6 @@ void cpu_loop(CPUHexagonState *env) exit(EXIT_FAILURE); } - if (signum) { - target_siginfo_t info = { - .si_signo = signum, - .si_errno = 0, - .si_code = sigcode, - ._sifields._sigfault._addr = sigaddr - }; - queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); - } - process_pending_signals(env); } } From patchwork Sun Aug 22 03:55:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501411 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1063526jab; Sat, 21 Aug 2021 21:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQSco+imnpVXMLV0sxvifowJygfgSO19ctsXEJ8Kha54rWSlbp6rPnM0CEnKsLXlGJymgZ X-Received: by 2002:a25:c057:: with SMTP id c84mr14895418ybf.420.1629605287821; Sat, 21 Aug 2021 21:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605287; cv=none; d=google.com; s=arc-20160816; b=hfwnLchuyt4iRHEW1GP+o/nsFN8lsuuRWpTzQyVK3Dc+E/nTD9bTRhF0QRi6nYQNrp iLfIY/oa2ppoeItIWZBPifzk3+3T9q8D6lhEZq3YwqxPEV/Ux5ObpxPaXn5yh4dkXCUq fP5zWXuWl68yQ3TQnMQd/500lHTIN0XrhUysG6L69Uv6JLrtk0YwbPdnB6GwanM0GUnX 8mrzk79es19hGKMZ0xnTWpCv3zAW+WsKKNzJDZrXXiYUxB73QXT9sKw0vTROb7BS0+F0 bcwcEc7U+OsJSTasS7mnFulwL6jLcaz7hNUwC6aBvBx69sWj0rOvNWbjdIg2/mwZ9iLf tl/A== 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=1vrWXXk2QGk0hTQCIleqy7sIqee8vTHllkla9WWLZlc=; b=ZUKfAEQ3Vk0JHGhiddAW3WPGszq+x/srDVg5mlSglaUTOuMOtcftTbjEKQByAno/Fv 4pvyx+MmiKYyzrlGsB2uo0+4WijzifvcqiaasIiibrdcoXXpe1PD22rs0bJwNlO3u9am nPdLQu9qBQFgKNW66m8qBMFuR/2QicSThHRd/fjaVV1ac1XEubrlNctl+I83TZVYyRxf 3EUJYx6OClENx7r7FyteQtrKub+Y1Mf16Tmg70wHFJqGvgPeIPNvl7H3Z+l6d5ijxH86 lZgwmuqA/wq/QwxlLNkrb5mrhA1TK/qXFf4AGwyCbw9mKKBRENMHqRsd0T5fHVu7e2dv vHeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JHpHPx0o; 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=pass (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 c20si10836657ybj.321.2021.08.21.21.08.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:08:07 -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=pass header.i=@linaro.org header.s=google header.b=JHpHPx0o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHemF-0005HG-8P for patch@linaro.org; Sun, 22 Aug 2021 00:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaM-0007q3-V5 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:51 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:54829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaL-0000gJ-Fv for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:50 -0400 Received: by mail-pj1-x1033.google.com with SMTP id n5so9807499pjt.4 for ; Sat, 21 Aug 2021 20:55:49 -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=1vrWXXk2QGk0hTQCIleqy7sIqee8vTHllkla9WWLZlc=; b=JHpHPx0ooW1Il+WvyGLE3GWbFwP+YU9ohioLo0VuVDpk1lcJuOdEcyBSCckLQI4GeM CkMFVUPjAky7dwYbnnC1cNFVb+wCuGxz0JdstwAZ5oF023fpp342zeS/M8F8Oi2MVzmO pDjxtHTJhEmZombFkvplfrottSL9+hR/eKKSmf5uyVgn3NISYvjBDGtdaIFceCGn40Tx Tl135xg8RjZMJsQWIylN0Xd8BY6BTs0QeQEJlYtWxeG/hxCx1Y/FEyQO7tsBbpGsgo7R X4Ie5/KRRo+AS3aILOHShlEFlUYe/1ZK5i7HQvbTBNLTIlnSDJrRFqDMfIOjfZ8sqY+0 MfJA== 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:mime-version:content-transfer-encoding; bh=1vrWXXk2QGk0hTQCIleqy7sIqee8vTHllkla9WWLZlc=; b=D0GebufwLtqzOmxr4l8cIwa2972X1aEvb/7W/EXeDQ4r6WoPIZ3Z6kFq++Ep5XTiih LDLUx64KoeRUdQ2dSAjzpSVyFT/bR6iqPDPWTkYhUbxfsyUzEYJz4ecl3OeqzPUlAsgu 9ID6c4JKiWKteQSkOsuKbYXtr6GSt6cSEcjy94oxLMfmneqlDGYYfhWpfHMJvqXs5XBK csSoPXIq904rOkQiOQiiKPXZ/6s550lyNx1DNDC/dfiTQVFcBrNLvCSPXAQQcIVTXLjZ j3N2JWXgVVuQBe/XXCjFzkz398C6Y3s6jhU+kK16AzTj2ubDprn04Lxxfy7B2qaTxmPK eKXA== X-Gm-Message-State: AOAM5322bhVBZA4dRYqPeyRONQVdlrTFDpHq+35y26eGGtsHI6rY4ZEi HPQSK1sib5CCzdlGknPQgNmOOEYhuQHEaw== X-Received: by 2002:a17:90a:a087:: with SMTP id r7mr12962651pjp.84.1629604548389; Sat, 21 Aug 2021 20:55:48 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 14/30] linux-user/hppa: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:21 -0700 Message-Id: <20210822035537.283193-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/hppa/cpu_loop.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 82d8183821..3500b2c291 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + static abi_ulong hppa_lws(CPUHPPAState *env) { @@ -108,7 +110,6 @@ static abi_ulong hppa_lws(CPUHPPAState *env) void cpu_loop(CPUHPPAState *env) { CPUState *cs = env_cpu(env); - target_siginfo_t info; abi_ulong ret; int trapnr; @@ -152,42 +153,23 @@ void cpu_loop(CPUHPPAState *env) case EXCP_PAGE_REF: case EXCP_DMAR: case EXCP_DMPI: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - info._sifields._sigfault._addr = env->cr[CR_IOR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->cr[CR_IOR]); break; case EXCP_UNALIGN: - info.si_signo = TARGET_SIGBUS; - info.si_errno = 0; - info.si_code = 0; - info._sifields._sigfault._addr = env->cr[CR_IOR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->cr[CR_IOR]); break; case EXCP_ILL: case EXCP_PRIV_OPR: case EXCP_PRIV_REG: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->iaoq_f; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->iaoq_f); break; case EXCP_OVERFLOW: case EXCP_COND: case EXCP_ASSIST: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = 0; - info._sifields._sigfault._addr = env->iaoq_f; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, 0, env->iaoq_f); break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->iaoq_f); break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ From patchwork Sun Aug 22 03:55:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501412 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1063538jab; Sat, 21 Aug 2021 21:08:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT84EGjR7vx4UVIEHFMh/wjWJgHMCV9xkCKqXPIBjh6vgP8py28IrlZBtGYmJGfttLsFfL X-Received: by 2002:a5b:a8d:: with SMTP id h13mr4776718ybq.83.1629605288821; Sat, 21 Aug 2021 21:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605288; cv=none; d=google.com; s=arc-20160816; b=RsNcHoCxzGbIEz6AbnZCe7DGWt3FlezuVRMOpkcrQPbfljBmOWGz+nR5mQFIky276o a0WM54zBUyvfa1EGkaD92EmPtN/ni/OTTZY4pfod6IYJOzLymrJuD2PwrigLnMDlShm+ 2MnqEVGCogt7J6Sx4FeScRjaLiVUGExN+TZ0lBW+qurWxXgWwDhpeyfpaPvROilvPpPo 6wLVaFmKP4+upV7XZY67bwQNdymT6GMFPe+wiVMDpMD3tRMUy6j64TDcz1+dIm17z1bO kBEqlY80pGOwj44dvO2Z55CeUwYdVGUqx6KzMS91eWcZnd2YgocSNzzLKCha8Ukv5PNp vxAg== 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=jgJJjeTXjiUbDbukKE88rjflxSR0+x8oJyqtKcc0hjQ=; b=vV+70jtj2ta5P87w8ryLo+JvoFkSmdFQj2vYVYwohjeGzBKjX8FEieFXpVp73rlj2b EWleq7gmesBZ8ON5W5nP65mR0trqOdWYX4Jwssa2E0uQMlDkDs7jQPjfrN6VT371vVMG T45ME6eQKnzYlCW6CAR9+FgYtd6FwyZ0V6t5eURjBT0kYLn/BwYcGnBeo3xypCzI47eJ i7E0E1nMDPKYaJtEag6y+R5Xj/PfVIv1UR3Wzxf7QZZWUUJfCI91IFEtsM2B99gBScEC vMb9Kx/dummt+CZZD8XFkoRnbEU2F4XkELkaE/8se8VutvkohWwdrVIElqDZ+VVuRFtX 3RYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gj3DeRrQ; 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=pass (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 l6si9571084ybo.300.2021.08.21.21.08.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:08:08 -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=pass header.i=@linaro.org header.s=google header.b=Gj3DeRrQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHemG-0005MM-2a for patch@linaro.org; Sun, 22 Aug 2021 00:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaN-0007qX-HA for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:52 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:40538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaM-0000gV-6G for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:51 -0400 Received: by mail-pj1-x102a.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso16420672pjh.5 for ; Sat, 21 Aug 2021 20:55:49 -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=jgJJjeTXjiUbDbukKE88rjflxSR0+x8oJyqtKcc0hjQ=; b=Gj3DeRrQ3WVvfNNZ/wsC05LHMuAg4oi87tQTGJeVeEO0w25mz8bq4D7Sl+KHxVyvNJ 72xA0UTF7cz21IrPT9dPTwwMmpDeNT61fFQY4oj69uNB962DC1SDMW+KwHp5f8o0m8Wl k8Fwczdgz/kRy652jOzwWPXu9yJcOWi4b/FCCyq4D5jtFC3qOFF9vSRF0Vozu51TG075 AEcMw5cP9+onml+cbMcjtl+OwYs3GsaT6Fp08aaj+JVwyBFrgidBCCKWeXDXDwCXqjfD oAYJiKZC2ouxuAD8LrWDrhv5h/HtVtLctlptV1c3vQBWWW7CxPN4YG9vAwuIywEgoUFK /VZg== 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:mime-version:content-transfer-encoding; bh=jgJJjeTXjiUbDbukKE88rjflxSR0+x8oJyqtKcc0hjQ=; b=Y8S1gX52h3zytPKopWY/xxaEzlx/UH5f2SK/vUd1rgdBlmmEVy0eoLPK89EBqqRDLp kQAs+oYTyFPN/Z0jHHngTQpnjztTY841kI8rqNv1R8hwD0eNpyxSRv5J8ADtQ3wzoMcV oMC3zYea1W3AXEXQZBNeyf4bJSMvR5KsxOeM9kCeKzEDfkZNMmGEFTw9cK6e/sqZQyJA a6SBoframuwcBAVGoNYUkNNnJ7Npny+mLnut0xP7XKgaHDEJVL7Sn+erEcHJcBLopSVy 7jNC76s/rkTHHlJNgC3Hnmh+bQYqEMuHabUCQ7SAYdzIWxjsmo+RfuLi4NE8eFlArQkA DmjA== X-Gm-Message-State: AOAM533O1jfQqlbKQRzlb/LTu2kAOyLfJNkLScxEE3/zXS2h6Eu8PrNj gVVnpxiUQasx4eRc8lMl7ouGzB0AqeQahw== X-Received: by 2002:a17:903:2443:b0:12e:6093:2877 with SMTP id l3-20020a170903244300b0012e60932877mr20146060pls.21.1629604548904; Sat, 21 Aug 2021 20:55:48 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 15/30] linux-user/hppa: Use the proper si_code for PRIV_OPR, PRIV_REG, OVERFLOW Date: Sat, 21 Aug 2021 20:55:22 -0700 Message-Id: <20210822035537.283193-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These si_codes have been properly set by the kernel since the beginning. Signed-off-by: Richard Henderson --- linux-user/hppa/cpu_loop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 3500b2c291..7bc85dffd0 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -159,11 +159,17 @@ void cpu_loop(CPUHPPAState *env) force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->cr[CR_IOR]); break; case EXCP_ILL: - case EXCP_PRIV_OPR: - case EXCP_PRIV_REG: force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->iaoq_f); break; + case EXCP_PRIV_OPR: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->iaoq_f); + break; + case EXCP_PRIV_REG: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVREG, env->iaoq_f); + break; case EXCP_OVERFLOW: + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->iaoq_f); + break; case EXCP_COND: case EXCP_ASSIST: force_sig_fault(TARGET_SIGFPE, 0, env->iaoq_f); From patchwork Sun Aug 22 03:55:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501420 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1066079jab; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOG0WOeQwIiOHqdv1k+r4oDsVb4GMBC4Jnv0T8ji5jZKM5mK2A0bfqUOnR1N7qVaKhUrGX X-Received: by 2002:a92:dd82:: with SMTP id g2mr19397392iln.279.1629605668570; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605668; cv=none; d=google.com; s=arc-20160816; b=GN0MtrbXYv4JvRnUHPZus3D8DJmyjaYPNXDiXkR7s1rIpx6NI1WRiB9D4Q4uDm45PJ L15LOYG8A1w0zF3Mfq8hyapdwuKhsTvZLn3/667zH68Eu2r9FbMGLm8ltyxRCZXniry4 Uypb9WjMD0MbjT+VGxGYjVs31fK3RXnnTy65TD1is7NjPcbji4ooADK5rqRGpb1SafzA i0aJAvMpI8pdaTHaqI1clQxRyvdddS3uh2oPGCSK9jJHIMdi9NKWMZaM4PVf1K81BFsV FC/nBhU7ZQ8TbXJ9H3pifL4fCYqq8K/CKfqrnMYfv2+G7KTFbNRjQf6jY3ND7YDbyV91 5KyA== 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=jKxkWJetc9mOamPS46VjF9q1E3iRdGdDObeSI1Rk2wY=; b=d36VRnFD50T+g0PGUuoxHBk+vo2nKKP2BY7bt0KYvFuGNQgRJJhQNJ/sj6qLgsxQrC 63bVWsTPzuuQ8mtL8QBY2yWjikmKs6aDb+8zVd7i2I+jDIvJlyj8l87JiH+7INmLM6gZ s5k9vFQFtFaAH5XjBrgSsOg0w5mDnPN/wyilBMhptDGfSgbd+wZPcqv1/kepdVerMKxW OBrsRu8SWJA8RdVqpyU4wsQCcPW5+H8QmrZqsn2ViSTzY6ks3PmfZ3rdxF6o15wYiDzg YIrE4RNQyfesCwXCOL3+RXXB6Amjzuk8E/5urg/0YW5dSeD8Vmgqeg/U6hcIKJiSOrlu aWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s4PImu7w; 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=pass (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 l5si11675212iln.118.2021.08.21.21.14.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:14:28 -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=pass header.i=@linaro.org header.s=google header.b=s4PImu7w; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHesO-0008I4-0A for patch@linaro.org; Sun, 22 Aug 2021 00:14:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaP-0007rM-6S for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:54 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:39924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaM-0000hC-Mk for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:52 -0400 Received: by mail-pj1-x102a.google.com with SMTP id oc2-20020a17090b1c0200b00179e56772d6so6573897pjb.4 for ; Sat, 21 Aug 2021 20:55:50 -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=jKxkWJetc9mOamPS46VjF9q1E3iRdGdDObeSI1Rk2wY=; b=s4PImu7w7akX/eHAWYCNWLnjz0bbwMF3F+YbTeGtdfTkvEEgkKq0bNu0nTC1TwB4/x bWXaDk8OCdGewwM0ZD51LXcshT74dPWcMf5VzJ5vHY5KvN5C3BK4fWMTAqRdO8Bp5M6r YKxo3j8Xhhdn/4RtP4LYaQU6C3DCMJYPuq5+yOD6cguW9GM9zmCIKE50cCOUekqd4FIJ Rh6WMP1XK0tLeP/LHaOgdNZN9oN/1gRSmetIjK/bIssEFi+m45iTjcXGQdzLWLKkSBv1 Gre8b7QJtjiT7KMFkyx6znWlvSGx9HaxCdwnnx56lh59DSxqpzn6aJ9EcEk9I8g2Jp65 qNiA== 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:mime-version:content-transfer-encoding; bh=jKxkWJetc9mOamPS46VjF9q1E3iRdGdDObeSI1Rk2wY=; b=aWjULolKyyYSepXgHuUv+gUm5NjE7aFEzVuho4k1HZ9IYLwO9NSFmtoezGbUuBV0iq t8nPx10WeFJueRLOcLvajS8V+QUbhtnp/uKv2gE6U0kVwbxj4sTnIzWuZpmfpd1p13mj Nc2C4hHr6d+6vp6byOyDEiid6m833DZlEBtq8lfsB1gA+70ku2YuGTAbb5mizt+x2JkT GGOhrUuc/UTnxcrYmZwYrBS/VmHonXEPxwPt0bV/WpqJFVvEqn40ITv6sqKA0ovkEkkw oZdmBiI3wl8S/OyxYcn+bQUY1R4Rkm/iv2N5O2vV3cVl0p17e+aAR+V0zU4PF0Zl8Jm3 rY+w== X-Gm-Message-State: AOAM533rW0/HvPRaOQ7CWsIIsnhyj2ah+SiQyLjn7lMr3f3zb35qRI5q 0fBJZVJv77p/gBXnIOqAgPuCRoOX9+hTvw== X-Received: by 2002:a17:90b:1102:: with SMTP id gi2mr12909025pjb.43.1629604549559; Sat, 21 Aug 2021 20:55:49 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 16/30] linux-user/hppa: Set FPE_CONDTRAP for COND Date: Sat, 21 Aug 2021 20:55:23 -0700 Message-Id: <20210822035537.283193-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This si_code was changed in 75abf64287cab, for linux 4.17. Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1 + linux-user/hppa/cpu_loop.c | 2 ++ 2 files changed, 3 insertions(+) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 55ccc6ae03..f9efbffe0c 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -688,6 +688,7 @@ typedef struct target_siginfo { #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ +#define TARGET_FPE_CONDTRAP (15) /* trap on condition */ #define TARGET_NSIGFPE 15 /* diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 7bc85dffd0..cc076e7cdb 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -171,6 +171,8 @@ void cpu_loop(CPUHPPAState *env) force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->iaoq_f); break; case EXCP_COND: + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_CONDTRAP, env->iaoq_f); + break; case EXCP_ASSIST: force_sig_fault(TARGET_SIGFPE, 0, env->iaoq_f); break; From patchwork Sun Aug 22 03:55:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501415 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1064795jab; Sat, 21 Aug 2021 21:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH7MWcgxCbOHD0ClrF1uh7q0HkLyNCEV1ZRSCLsURaN7YzMLTdVDlpxZEEoxIl8J/mqgZ0 X-Received: by 2002:a25:1fc5:: with SMTP id f188mr36321429ybf.375.1629605480990; Sat, 21 Aug 2021 21:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605480; cv=none; d=google.com; s=arc-20160816; b=CNQOnXec6Y9O/PzD6aRv53v5p64UJCuKoj2TNb0OsnDDTR6j4BfFMnmuy0Da37Eevw Tlx7Z/1oKsbzQZ72sjcSKOiEZP8y1BnIM7GUEfBk4EVNb1TfZZJ0Vr/OtXuDvwZQ34NH Esq7HiiJ4KCLPozw70WRcdKzj0xdeEdU3sWAtvTiXfW6pNFOsECRdJ4l7F7HVkpRbLF7 FLrlCLc7JLvsakqp4Vm/1FTCsqkLtAjf1YjRY9kjs80zhvU0khdTn2m/ANecCLnFq07i 9aypd4C2A0sdcG2RXkJ15Xgoa/bId4Iwvhmlq7nQYTVhsPR8sf7kLT3dq9h9Sa8VJG3f 56TQ== 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=Aoy4O375ZO7hM1BTzhLh8wcId79QwPq349k/5KQ0lXY=; b=E12ujNLd6malnBc1e3jtI31Xz8aW+9wkArBoeKxPcr/KFVfLan6lbWljYqThnrhLYr XZiX8/LlMVVqTrDvxh3bMV1dL4esRiXDKUqnJ6/ByvdpW12dmBuemFK7y/T8unCf+voB +JcOH7BcoWowD4shemF3TPayJFIRuqzSfkIvmyd9Wna63ba5id5wf6Mpxz8D31kBLBYy La8WV9Eo3hj55ZXrnYW3FbM28OgVkWukm4mYlO1QMSvfLQO5M36vVIQCu14b0TlQ15qU 0ySab9ROadbFepioZtlnXuaco0braJDGBvB5MBQuSOM1OFKkiKndKlInLjwt1nGJsBCY Eohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ml0s82Zd; 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=pass (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 n2si10991621ybc.8.2021.08.21.21.11.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:11:20 -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=pass header.i=@linaro.org header.s=google header.b=ml0s82Zd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHepM-0002WX-Do for patch@linaro.org; Sun, 22 Aug 2021 00:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaQ-0007rW-2D for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:54 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:42786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaN-0000ht-Ca for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:53 -0400 Received: by mail-pj1-x102b.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso9907114pjb.1 for ; Sat, 21 Aug 2021 20:55:51 -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=Aoy4O375ZO7hM1BTzhLh8wcId79QwPq349k/5KQ0lXY=; b=ml0s82ZddlQ+EDgwGzqJngs/c9cXOYSbyW0bP5lupk5AKzJGoScFuh9IQSdNv732tu 3UzTLYNVh8WjoJfmkIxX/Hthqn5q5iMTSAs0kHL14jdqtD/aZ4+CTFzZ4KMc/710QzfF WMLzIUUpwWcx5MDzJ03TOL8S3v8VIQxYM+rtRC1jC/nPQoyP2uMlqxoswGz6HchHrt8u 8YMfHr1fDniHZKJgoxF8R0rLoIyB+0MQtv+SFMLQSx8wQoIgYP9nN6RW2EkjjYKBVVYn 61TbXMp3FRNijPYbmJcK5kd6Kw5b8YJZtfiL5YFezH2Fm7t0vtHiUqm7g+lUVQNw8xFx rvbA== 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:mime-version:content-transfer-encoding; bh=Aoy4O375ZO7hM1BTzhLh8wcId79QwPq349k/5KQ0lXY=; b=uYzBl+IGCggqDUX3sf+bJEWqsXVAM87I8kJehWka9NWZCuUGr6064/Jyddfowl7WdI DwDVqOMxWmDwMI15ptQBKnwuU5pDfVqWPQ13Y53u7n9gzSv+RbmkynasdlFzmdiecJg2 iZ5vD8dP1SDRW3JmGSaDTOT5MTMtRmhegophFVzYfbATgLPdDpelOSohlX4BQEe1WG9b FY3IsrgjP+A1572vX8poo+QJWpvCnr/BTCSDY5jTzKXb92nGrwz2njrRCIfid8kB3HBc SWG1w9OAVxl1nJmsHoQNfXb0zDloVarTjloT6yOZUQrNBW5XQjKT8Iq3bu2OtBJbgl5L o1oA== X-Gm-Message-State: AOAM530Ml8xbWSPj5ZPgzZKPHWpcvkvix3gWaY7Pd0Ul1cEpKZrGssqt KVpwMrREE+ikDLxsOYK3xSeWCiokWycvlw== X-Received: by 2002:a17:902:b711:b029:11e:6480:258a with SMTP id d17-20020a170902b711b029011e6480258amr23135868pls.41.1629604550154; Sat, 21 Aug 2021 20:55:50 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 17/30] linux-user/i386: Split out maybe_handle_vm86_trap Date: Sat, 21 Aug 2021 20:55:24 -0700 Message-Id: <20210822035537.283193-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reduce the number of ifdefs within cpu_loop(). Signed-off-by: Richard Henderson --- linux-user/i386/cpu_loop.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index f813e87294..5866e98441 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -195,6 +195,17 @@ static void emulate_vsyscall(CPUX86State *env) } #endif +static bool maybe_handle_vm86_trap(CPUX86State *env, int trapnr) +{ +#ifndef TARGET_X86_64 + if (env->eflags & VM_MASK) { + handle_vm86_trap(env, trapnr); + return true; + } +#endif + return false; +} + void cpu_loop(CPUX86State *env) { CPUState *cs = env_cpu(env); @@ -256,12 +267,9 @@ void cpu_loop(CPUX86State *env) break; case EXCP0D_GPF: /* XXX: potential problem if ABI32 */ -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_fault(env); + if (maybe_handle_vm86_trap(env, trapnr)) { break; } -#endif gen_signal(env, TARGET_SIGSEGV, TARGET_SI_KERNEL, 0); break; case EXCP0E_PAGE: @@ -271,22 +279,16 @@ void cpu_loop(CPUX86State *env) env->cr[2]); break; case EXCP00_DIVZ: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); + if (maybe_handle_vm86_trap(env, trapnr)) { break; } -#endif gen_signal(env, TARGET_SIGFPE, TARGET_FPE_INTDIV, env->eip); break; case EXCP01_DB: case EXCP03_INT3: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); + if (maybe_handle_vm86_trap(env, trapnr)) { break; } -#endif if (trapnr == EXCP01_DB) { gen_signal(env, TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->eip); } else { @@ -295,12 +297,9 @@ void cpu_loop(CPUX86State *env) break; case EXCP04_INTO: case EXCP05_BOUND: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); + if (maybe_handle_vm86_trap(env, trapnr)) { break; } -#endif gen_signal(env, TARGET_SIGSEGV, TARGET_SI_KERNEL, 0); break; case EXCP06_ILLOP: From patchwork Sun Aug 22 03:55:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501414 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1064792jab; Sat, 21 Aug 2021 21:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6nZo9AsdmQoFovXumwXG899av7t4AdKRe4EpU4msWjmvVZvpyxIdOiadqLeDAMthB2EY6 X-Received: by 2002:a25:a408:: with SMTP id f8mr35501595ybi.155.1629605480832; Sat, 21 Aug 2021 21:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605480; cv=none; d=google.com; s=arc-20160816; b=KVo7w3wlSWAjL/jtAKs+3GGlRkDXHbnmkxbSgemen+Lap0/SPWNOuWK3/Suldoq8YX hkrho/4dPsnwBzRGmJwZ5AgayaGM+eMM22onD5uIs8uHctVXzDnqXqdPXpu2e8xYEmjP Tfy5E5Y9OdmIeW7QThMiA6Pcn+oGnGvtDaPhvTxEfTvi+w1dU1mScrz8ncdTIPr6e9LL vtK9+WqkvoNg9Sc5g48dXxDkLBhsY0R+P1Z2oiln9Z2/ox84nooCDP6y9UdinWw9KmYo DY+MGmKyLn813uEp3rsooOdY+Dnq+VtqL/4Q6xmRhTFlxZ//tvOSoucwe5Y7TWpHOzJS px2A== 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=3KgmD/eYr3iehKDdNb5+g/qn4jDvTdLMR/PvVQX5enI=; b=ejdhhSp4iW6WmdvJ/Kr9Akb7jItmq3HzRWsD3x0WTx2MVMhPWqKosBMNIwAsEAE6YF oDt6T6+JIbBCcAL3+cWAUDZOTmHa1OZ/QAVLUFkFtW5bPvJwJPtDhA5XRdDQmEWBJmSB I5zbTpO5okJf6o6D++ynwgMryAY9GuPZeqM+Ez30FyYOTy1QeVm7ZYyCMYLXinkuaURS TJIioMxOgGRVO20gAurH3VNeYoFZxwYrGDY9Jtu1MGS3rC2iUPT3j/UJQaeAo06VqtAu Wqckt9IBUQpg7Jeph9lyvXp+tkzvLQyZuoPdXJod+sM7OoJKsikHNtx4M7M96L8b5Cfl yDTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DWTQ3qJf; 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=pass (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 i134si9832967yba.199.2021.08.21.21.11.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:11:20 -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=pass header.i=@linaro.org header.s=google header.b=DWTQ3qJf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHepM-0002Um-8k for patch@linaro.org; Sun, 22 Aug 2021 00:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaQ-0007rb-KP for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:54 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:36486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaO-0000jA-U7 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:54 -0400 Received: by mail-pl1-x62a.google.com with SMTP id f1so1365815plg.3 for ; Sat, 21 Aug 2021 20:55:51 -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=3KgmD/eYr3iehKDdNb5+g/qn4jDvTdLMR/PvVQX5enI=; b=DWTQ3qJf7dwxazOLmwmBgb3A8U/dCCP9BCCtsASL1DJsEMT45g1ENCWiUg5rgirBRw 6LdMDAzrdv3n1n3+/j7D0QzM2lMIDploxnsOhIn8wSSnBmCOUyt2zaVle/wQU7ZECLSj DHTNgnnet+83mxemyVi93V78jdMi0K6ITt2YqW2u4ki02tzqGM7eRQo/WMu2wxMoZq/b xX1isnet37EEelqei6Ch4MXYM50+rlg9Iss5VVo60Z3iJlVeZqn5UiNjPEjR+yLQNelk NdT+9Z1kAEtmcSL68dExR+IwfcYCxRjSc4ds2OZF4rHoCLno9jEX5SB3p73bo4SoXDkw 8dSw== 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:mime-version:content-transfer-encoding; bh=3KgmD/eYr3iehKDdNb5+g/qn4jDvTdLMR/PvVQX5enI=; b=hfwD55xYysk3+wLkM5wAJZHbVjXiMaAL0xsnvYtHsLrFoNHjQs89u1XK4lM0XI329A 46r/zC2HUCSvz/A17C6GWZVFrTsmigKRKhGmHGZPCbOBbf7yqVhZXZUwuvAyTDnoCkEj +9qM32uZwmUp9DyRypARtjTu7qiU1bpRiJunE/Tn+XJx9c012s3xaEPoMbEkH83WZQga FCAYQHCJaY6gNr+nQx2tmPWrhGUpCs880XoWvZ1MrSndypy+w60qMo2QaHP1jq8pE7G4 Ko2NMpczdSnmwjOQ9HelebJhL/PLcyerogGlusRVJlF7XcvK1F8T0g2nIHUkp3y36ZF+ qw7w== X-Gm-Message-State: AOAM530m8kBd+xnmMFCeOy70MERMmkxCmWHogMbHm4+4GMui2Kb1lywA WMEmKArbmy4RFLNWTeb0FuQpJGSf4GIsUQ== X-Received: by 2002:a17:90a:4e8c:: with SMTP id o12mr12781267pjh.118.1629604550790; Sat, 21 Aug 2021 20:55:50 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 18/30] linux-user/i386: Use force_sig, force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:25 -0700 Message-Id: <20210822035537.283193-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Replace the local gen_signal with the generic functions that match how the kernel raises signals. Signed-off-by: Richard Henderson --- linux-user/i386/cpu_loop.c | 46 +++++++++++++------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 5866e98441..787d4ccfc0 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" /***********************************************************/ /* CPUX86 core interface */ @@ -81,17 +82,6 @@ static void set_idt(int n, unsigned int dpl) } #endif -static void gen_signal(CPUX86State *env, int sig, int code, abi_ptr addr) -{ - target_siginfo_t info = { - .si_signo = sig, - .si_code = code, - ._sifields._sigfault._addr = addr - }; - - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); -} - #ifdef TARGET_X86_64 static bool write_ok_or_segv(CPUX86State *env, abi_ptr addr, size_t len) { @@ -103,8 +93,7 @@ static bool write_ok_or_segv(CPUX86State *env, abi_ptr addr, size_t len) return true; } - env->error_code = PG_ERROR_W_MASK | PG_ERROR_U_MASK; - gen_signal(env, TARGET_SIGSEGV, TARGET_SEGV_MAPERR, addr); + force_sigsegv_for_addr(addr); return false; } @@ -190,8 +179,7 @@ static void emulate_vsyscall(CPUX86State *env) return; sigsegv: - /* Like force_sig(SIGSEGV). */ - gen_signal(env, TARGET_SIGSEGV, TARGET_SI_KERNEL, 0); + force_sig(TARGET_SIGSEGV); } #endif @@ -263,53 +251,51 @@ void cpu_loop(CPUX86State *env) #endif case EXCP0B_NOSEG: case EXCP0C_STACK: - gen_signal(env, TARGET_SIGBUS, TARGET_SI_KERNEL, 0); + force_sig(TARGET_SIGBUS); break; case EXCP0D_GPF: /* XXX: potential problem if ABI32 */ if (maybe_handle_vm86_trap(env, trapnr)) { break; } - gen_signal(env, TARGET_SIGSEGV, TARGET_SI_KERNEL, 0); + force_sig(TARGET_SIGSEGV); break; case EXCP0E_PAGE: - gen_signal(env, TARGET_SIGSEGV, - (env->error_code & 1 ? - TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR), - env->cr[2]); + force_sigsegv_for_addr(env->cr[2]); break; case EXCP00_DIVZ: if (maybe_handle_vm86_trap(env, trapnr)) { break; } - gen_signal(env, TARGET_SIGFPE, TARGET_FPE_INTDIV, env->eip); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->eip); break; case EXCP01_DB: + if (maybe_handle_vm86_trap(env, trapnr)) { + break; + } + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->eip); + break; case EXCP03_INT3: if (maybe_handle_vm86_trap(env, trapnr)) { break; } - if (trapnr == EXCP01_DB) { - gen_signal(env, TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->eip); - } else { - gen_signal(env, TARGET_SIGTRAP, TARGET_SI_KERNEL, 0); - } + force_sig(TARGET_SIGTRAP); break; case EXCP04_INTO: case EXCP05_BOUND: if (maybe_handle_vm86_trap(env, trapnr)) { break; } - gen_signal(env, TARGET_SIGSEGV, TARGET_SI_KERNEL, 0); + force_sig(TARGET_SIGSEGV); break; case EXCP06_ILLOP: - gen_signal(env, TARGET_SIGILL, TARGET_ILL_ILLOPN, env->eip); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->eip); break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; case EXCP_DEBUG: - gen_signal(env, TARGET_SIGTRAP, TARGET_TRAP_BRKPT, 0); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->eip); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501401 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1059100jab; Sat, 21 Aug 2021 20:58:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKh/qZCQiBzNIlg99BuBGv+Bpzg09/8AT/14+lmiz8DLvWdweAI1d+vhjZKnKBkAYXPEqR X-Received: by 2002:a25:1346:: with SMTP id 67mr35707872ybt.405.1629604726599; Sat, 21 Aug 2021 20:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604726; cv=none; d=google.com; s=arc-20160816; b=Bo06Wi+QetG2JGA8dqy5cJzl0ffZBIsatg9UGtkEst8CHZWE1jWQfvQRmBmTheTx60 qaaaFbkvuVB6x36/bpU7QXlMrhATXQGRsv+d+GwoQZxJ82A97kIGsVoJeeVOcy5nfX/J c4l+S91IyQdfKyqnATzRDOc9IDnkopVAa5YwvmJxh//L9iAzVaAXs+feY/FpT16FpK4O I/9GHVa+/q3bUh1+MeE8eSyBahiQFaox49aYVbyamiMiJCrwsxa0Qhe4ayyKtMo6as1t UAN3vTrzM8DL8xKNxNWP5lFBehxmKN+dJTdIOBBj3FnqUtGHKlKw29mg5KFqlKrB1Djg AJsQ== 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=RYjmBhcWv8W1mWgf+iyy6mrMx77vnB1Iku9AxHwG4eY=; b=cQ12eLiHX24Aq1yMU2KRK/IATp+NVkZeFG7LQRn7FObJZ78LAHFnOYAAEqwMXDWDoD 6sjin6gzKsCAUGrH1AXpLIoNSh5FoVwjFcff1Vl4u6B+EP1vaxLrR7J7Wi4COuoMT5lu 9hzwqh+bqy+RoUM61VOkmy95GhcSLpo1TbSFCrI30LhMrDuhQ6X4FL0RYtSsGTU6Fofw zM3QiWS5aYa8WJXVVQfcGEzR8Rw62epYyxSacntOFQqFxltEslPhtWEPzJKASq0uXl/D Xb4hrkJH1mzKDO0/sZ/r+YBEKaMSsnjir6l8XYAIR5v7BK3gxAVtcs6BkiHJoQ2/yy60 9S8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G6pOwZ/L"; 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=pass (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 s4si9680835ybm.143.2021.08.21.20.58.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 20:58:46 -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=pass header.i=@linaro.org header.s=google header.b="G6pOwZ/L"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHedC-0005ED-1O for patch@linaro.org; Sat, 21 Aug 2021 23:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaT-0007u5-EZ for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:40931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaO-0000jK-US for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:57 -0400 Received: by mail-pl1-x629.google.com with SMTP id c4so8203147plh.7 for ; Sat, 21 Aug 2021 20:55:52 -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=RYjmBhcWv8W1mWgf+iyy6mrMx77vnB1Iku9AxHwG4eY=; b=G6pOwZ/L4OJoJcA9EhSYMO4KGZADMKlqX0g0i7UPaWDKnJVQt43P33isawJ6KkRJCL iuoISLKFDkvRwwzNjFPJf4+n55Di1RnQPuka5iSUCmGuqDMr/ew5gvN7OUmq+yvJgckc qoFEev6wKnhoQmVgvohYteKyYnhphQAp6exEQS/77u7a7Xwh92N28I5eTXiDtHFk/k5N f+QXEf0xV8Jmgcorcjl9FRCZDFP8I+E64TJB2bzxbo71gHR5LAA7lJTqWUZPYkjTKLjs raArEil4QvCdBF8QWdhfAzdGNGz8tMZK15cN9hUoO1JQ6RRWvGMlvUmyDDbFvHax6GyW B8rA== 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:mime-version:content-transfer-encoding; bh=RYjmBhcWv8W1mWgf+iyy6mrMx77vnB1Iku9AxHwG4eY=; b=NjV37Z434CRwLygunDTMPUnO34ya5QiaqCzGwlc4BGkciwY5wlwaNJYR8K+KAydvRC HUKZ90EkTmQa6Evix8OMYCmZZCKIcb+e0YP+m5FHgUTk5CkOhIJ368jDuXWkWaCplXNl 3vdAHqVUw0GTWXw0rbUDHmfPRPX8bQfQs0Eft3315Cxh/cUbhxZLt58ZxJcZ62777Qfd CRoFuhNz1uLl1dBqUgqaTbWOjjfP+JD4lRvNd9MzizVlHaP9h9EI/6ETVMVcJ6h9jfd5 T+1YTmgBtHho8c4ycrVlklfMziXmz/J1V4qtgnvKQ45iYRL/gUtfcce7GIjkj6e/jA7S 89nQ== X-Gm-Message-State: AOAM531uFJzyHmqND2xwxho0bLq5to0R0Q3uy+Kqfs+KvUlHDC+Dh1kd y9D0s+r4h/57Q/ZItdeev8LGG5Dstv3apw== X-Received: by 2002:a17:90a:d181:: with SMTP id fu1mr10146545pjb.147.1629604551393; Sat, 21 Aug 2021 20:55:51 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 19/30] linux-user/m68k: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:26 -0700 Message-Id: <20210822035537.283193-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index c7a500b58c..aa46fdcc77 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -21,13 +21,14 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUM68KState *env) { CPUState *cs = env_cpu(env); int trapnr; unsigned int n; - target_siginfo_t info; for(;;) { cpu_exec_start(cs); @@ -44,25 +45,13 @@ void cpu_loop(CPUM68KState *env) case EXCP_ILLEGAL: case EXCP_LINEA: case EXCP_LINEF: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc); break; case EXCP_CHK: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_INTOVF; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->pc); break; case EXCP_DIV0: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_INTDIV; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc); break; case EXCP_TRAP0: { @@ -89,20 +78,10 @@ void cpu_loop(CPUM68KState *env) /* just indicate that signals should be handled asap */ break; case EXCP_ACCESS: - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->mmu.ar; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + force_sigsegv_for_addr(env->mmu.ar); break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501422 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1067490jab; Sat, 21 Aug 2021 21:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHGfPkUtjEDewE55QaZxjJqOOPqOXs5/3mGZ1r9roX7muMdNR64Blw/hjahPFDGt8UHSvp X-Received: by 2002:a25:af46:: with SMTP id c6mr38039197ybj.55.1629605860365; Sat, 21 Aug 2021 21:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605860; cv=none; d=google.com; s=arc-20160816; b=Mnnsqv3HwPiSlK/8D12wfCGO1ChLJaOF7E5wIp72WO2DiuH9XcT2oxuWivSRpuxWTA 7ZkgU+ZLD/dD7gSkHWeQybxmUE58oL6zBW0l3IQlkqYqczgWWQoe6WOntzjVq+rTE6wU 3puOXc7ae5I9zX+1IdjDj5qnv+ndbq8ZSRYTE+37avIDMQodTmSyFaMzBVN8cr8ANqcN IlQLjRuLXC2m74C3Uoi7dPI+OUteF86NnylstnEoJMUP3dZjnABHrFgkKATRt7n37ybP i2mnB94NjTz19AjGlk+5flc2QiOhEU0IiMJL7Wm3fc0yRdLKPA681qAa5yu6woGb/LAA jieQ== 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=dr8YFAi1pWZfR1DWEP4KGLo0RnLMDZepAc49PU2qFmg=; b=IddB1sTXa+pkErgkIMzl9eFzJuADFgM8nEkzN3uOzmbYAz7R6bqILA/cI4JFFAOGzv E4D30uf2pPYy+fq0COpwPc8t6OeJrDl09QpOKzboYggYJT8FsbFbpj2u/ALKbWfPAseK 93Gn+8u8V5B9FVpy6d748ZcMu+A2ThhfMH6PW5FqPTw58wCB2MF9kZ4WceaX9qAyksJm 1oRuztC1urzXIvgS3jAdc2JhJSS5jbRqumMbPTSOdwU9180jmCtwBJ/tHR66OhJe/T4i sJCYBPhAQv8cTS7iNpu1wyWsMEN2O9FwROz5Hl+7C/3nYSMAn6Z6kOEkkD8h3L3n5AhU KjoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vMuzBMlq; 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=pass (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 o204si9622742yba.386.2021.08.21.21.17.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:17:40 -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=pass header.i=@linaro.org header.s=google header.b=vMuzBMlq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHevT-0004LK-P9 for patch@linaro.org; Sun, 22 Aug 2021 00:17:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0007sY-5W for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:55 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:53107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaP-0000jP-95 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:54 -0400 Received: by mail-pj1-x102e.google.com with SMTP id h1so3973065pjs.2 for ; Sat, 21 Aug 2021 20:55:52 -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=dr8YFAi1pWZfR1DWEP4KGLo0RnLMDZepAc49PU2qFmg=; b=vMuzBMlqCx/9oLnvwIRAReqBvERb4fj/ZWZyQhS5wUecWJvNEku7suBaIlsm8al4aB JFhSdQBikOk0hAd/BgD0bwWxqNXyB40jORcX8k0uXhO4Qx+MlPZpWMFaJwKW4aqPGGrO ZZfkgd6X6jkGC65GiPKS5nZPyFhEZ92rVU5Yb6YEQ6GgfduBcFIupTIylUdb6j/nzlmR zk/yrcxNDobf2P4yeutaWs12v23fQ9+P5zjx0oKYuLZmIGciKyGRISP66b3ityVSZK8I pzunGrxBIIVY+6T1F99ClxzMENjmKWbp+/6pLa/BSqh02rvWa9NK/lzKOh6MSzDyuYoZ 2few== 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:mime-version:content-transfer-encoding; bh=dr8YFAi1pWZfR1DWEP4KGLo0RnLMDZepAc49PU2qFmg=; b=FptA7nxmPKgDRb+qL46CgRaoUTmmwXOl33QgGZbJoFCLAYmWoWhDBwTU4W5KhhhSuV VejwhosNwdzPdhwPBSTMkoionwAfvOS8BxfIMdCuws31qNEet0/FUy4Y0o5+r8M/ReEz aNMaguFAa0rd1jAlV65V/qbAxJNw1FZ6wsiHAdRMlwOKgTZ4VQ3Iih8bdq6mwxagfBvi PqvWvHtd8hhhflBEdCT2C/SEQhjlSdbfawb3QD1CSZMkGziYWMIj8R2hQcxjQTCuoiHP /DeoncqSy/loe/LAHi6RFp/qDjVdcrdivJ3EP4mS5TUUjKFfej8lC2eXakjsoa2dYfqG JcRg== X-Gm-Message-State: AOAM5339dLR1pTiQ7njk4x+xadgEnReEX5EPuBx8kVRjOx4ibQZfRX+C 7mQ2n+6xav7kwzhgFfdD/tLwsDYh7InObw== X-Received: by 2002:a17:902:e54e:b029:12d:76cd:6744 with SMTP id n14-20020a170902e54eb029012d76cd6744mr23023566plf.0.1629604552015; Sat, 21 Aug 2021 20:55:52 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 20/30] linux-user/microblaze: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:27 -0700 Message-Id: <20210822035537.283193-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 73 +++++++++++++------------------- 1 file changed, 29 insertions(+), 44 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index c3396a6e09..9e07e52573 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -21,13 +21,14 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUMBState *env) { CPUState *cs = env_cpu(env); - int trapnr, ret; - target_siginfo_t info; - + int trapnr, ret, si_code; + while (1) { cpu_exec_start(cs); trapnr = cpu_exec(cs); @@ -36,18 +37,12 @@ void cpu_loop(CPUMBState *env) switch (trapnr) { case 0xaa: - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + /* FIXME: save vaddr in tlb_fill */ + force_sigsegv_for_addr(0); break; case EXCP_INTERRUPT: - /* just indicate that signals should be handled asap */ - break; + /* just indicate that signals should be handled asap */ + break; case EXCP_SYSCALL: /* Return address is 4 bytes after the call. */ env->regs[14] += 4; @@ -75,6 +70,7 @@ void cpu_loop(CPUMBState *env) */ env->regs[14] = env->pc; break; + case EXCP_HW_EXCP: env->regs[17] = env->pc + 4; if (env->iflags & D_FLAG) { @@ -82,42 +78,31 @@ void cpu_loop(CPUMBState *env) env->pc -= 4; /* FIXME: if branch was immed, replay the imm as well. */ } - env->iflags &= ~(IMM_FLAG | D_FLAG); - switch (env->esr & 31) { - case ESR_EC_DIVZERO: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_FLTDIV; - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; - case ESR_EC_FPU: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - if (env->fsr & FSR_IO) { - info.si_code = TARGET_FPE_FLTINV; - } - if (env->fsr & FSR_DZ) { - info.si_code = TARGET_FPE_FLTDIV; - } - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; - default: - fprintf(stderr, "Unhandled hw-exception: 0x%x\n", - env->esr & ESR_EC_MASK); - cpu_dump_state(cs, stderr, 0); - exit(EXIT_FAILURE); - break; + case ESR_EC_DIVZERO: + si_code = TARGET_FPE_FLTDIV; + break; + case ESR_EC_FPU: + si_code = 0; + if (env->fsr & FSR_IO) { + si_code = TARGET_FPE_FLTINV; + } + if (env->fsr & FSR_DZ) { + si_code = TARGET_FPE_FLTDIV; + } + break; + default: + fprintf(stderr, "Unhandled hw-exception: 0x%x\n", + env->esr & ESR_EC_MASK); + cpu_dump_state(cs, stderr, 0); + exit(EXIT_FAILURE); } + force_sig_fault(TARGET_SIGFPE, si_code, env->pc); break; + case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501423 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1068407jab; Sat, 21 Aug 2021 21:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBs6Pq34iX0mPN3kfa16M03DMmKt5Vix6fN+zNBf0fHk9WLbdABktCPWydhUm4ru+Dral/ X-Received: by 2002:a25:37c7:: with SMTP id e190mr17234271yba.519.1629605987146; Sat, 21 Aug 2021 21:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605987; cv=none; d=google.com; s=arc-20160816; b=bGfmTrZkHAXvxt0uboEE2MnBVIV6HeNGpShQM+p24UMLcDWTYbfsjgFQqheCWcmGgL wUc5ecsf10yuL8lBk3Pz1lTb8IzrxNyvEq3pDqvk+/yhjUusCXxfy16H8II4G3jeQbvH 94hZ9jxh9715USjUziPFfE0Yk+ObdnX+wbck+cWTAdFvgDGmodu6zWsKT/mHh9LvDcvJ BdOp8HjjDTsgQqg51FXU9DHCzONBfLMbi6QEXnfP7SuHsgJuMgsWer8td+GeedSE5hpM yN0JmRpUqRWPvgHecZpef2W4k7AiNS0GQ+9G2lLSXENUJcoDZVzqP5T2vwe8J15lyJrU m5Uw== 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=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=RsdBbMigoW2FaUzoKLXwUSNlJj6DrS5OjiCOVazR4ogIwCDLWjbkvqhbvN2TB+P+KT YeEvZgwNRIqpDW+5+OXuMSWiVOudad0krnWmo8VQyYioasTGYFROo/QVRRE1k1q8W/Sd ef3ElGmsIAi4BGXTIv4qyGorisBa8lSRQKeYjJZcrpyhu3LSokKujnciFPS3CcdO8uYe hKXBrpX+c4Hy+zkdxWwCYd0cXCk/6fltMMxxbmpWldfU83vxosITStjAgzFPrf202+1x ABy53wkwpyddDZ8JwMRfRWVL4zRCFSclg4sKFxoGHLsueQSI0AQALGic8yjU3GMzHaVQ CPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kq8r5nzY; 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=pass (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 t15si8806074ybp.284.2021.08.21.21.19.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:19:47 -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=pass header.i=@linaro.org header.s=google header.b=Kq8r5nzY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHexW-0007GD-I6 for patch@linaro.org; Sun, 22 Aug 2021 00:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0007tQ-D5 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:35548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaP-0000jS-Q0 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:55 -0400 Received: by mail-pg1-x536.google.com with SMTP id e7so13334123pgk.2 for ; Sat, 21 Aug 2021 20:55:53 -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=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=Kq8r5nzYbdmfv1JWiEddnS4y948QncZZa9UzDyipdzH3flWX29k+/DkYMi/ufqYcSZ h/mLflqbN0ccYh+3S1AC/cg6NgXNcibmUZxldbtC+IJjhzN8YsPUkYIumy7NMrSd/WKS PJ9dqNzy6qEKGminyiVtOYLJYEM1mOpzvo2ZcoMUhg+mavWDOtpdUnNpVtkS5UQRxcXm nowufJUD83BUuGbY6Zn5KhWotuh0aIAKFyMR/jZWy2LDhPTwnOvIAvhtjIP90kvlFAJS 3Jx93QGJUuK9SZSUQL6pDhu6n7mjc1uq0gDYaCfYFr0qyhxLh9a5W5XDLqTFluFK2pvz 2MtQ== 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:mime-version:content-transfer-encoding; bh=V4ABiYbSFXZhLI78uqHDE/IKCat0vkJCalHfW7nxEF0=; b=JMr1KLEDFq9DGytkgO9LwxgrOnbrP3XXyf7ovkm6sFsz3ZgXimvrZTkHAVuYiWwYlI h6jKDXrA0T7NYt3daUhgGUzbPFxSOdg33S8HsYMdHURdKwgQVFszf9ea49UDXicnHbut JZmCwWhRcwnp729CQcj1AtPdarcDnJBwtsjvooteLnHi+AdCizfKzWeL1KvjAqc1gX43 Tdx71z/NJa+yRXNK2KlkPhJyV4HFLoxwV7cmKgIiQuqsQ4SFP32Uzpo0ODHlay6CXpGQ qX4xIoI3pSKCvKnnBGy4sqXk4XqYclCPPgxJ3TH6ZhF8DhnxbKxXWlgcDjwwtewDLi7S 71tg== X-Gm-Message-State: AOAM530YAymUcIE7wzpbI9+23/W54xEGnqW3WZkWNneNFvLL+yxVjxzt X4o3D3mSXW68BohiOmKncHQgfRZx7rAlEg== X-Received: by 2002:a65:4203:: with SMTP id c3mr25638480pgq.309.1629604552594; Sat, 21 Aug 2021 20:55:52 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 21/30] linux-user/microblaze: Fix SIGFPE si_codes Date: Sat, 21 Aug 2021 20:55:28 -0700 Message-Id: <20210822035537.283193-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Fix a typo for ESR_EC_DIVZERO, which is integral not floating-point. Fix the if ladder for decoding floating-point exceptions. Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 9e07e52573..4a75c853b2 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -81,15 +81,25 @@ void cpu_loop(CPUMBState *env) env->iflags &= ~(IMM_FLAG | D_FLAG); switch (env->esr & 31) { case ESR_EC_DIVZERO: - si_code = TARGET_FPE_FLTDIV; + si_code = TARGET_FPE_INTDIV; break; case ESR_EC_FPU: - si_code = 0; - if (env->fsr & FSR_IO) { + /* + * Note that the kernel passes along fsr as si_code + * if there's no recognized bit set. Possibly this + * implies that si_code is 0, but follow the structure. + */ + si_code = env->fsr; + if (si_code & FSR_IO) { si_code = TARGET_FPE_FLTINV; - } - if (env->fsr & FSR_DZ) { + } else if (si_code & FSR_OF) { + si_code = TARGET_FPE_FLTOVF; + } else if (si_code & FSR_UF) { + si_code = TARGET_FPE_FLTUND; + } else if (si_code & FSR_DZ) { si_code = TARGET_FPE_FLTDIV; + } else if (si_code & FSR_DO) { + si_code = TARGET_FPE_FLTRES; } break; default: From patchwork Sun Aug 22 03:55:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501416 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1064797jab; Sat, 21 Aug 2021 21:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOcM5Lzg18bxGTbzFb3xa6dY3AbGNPqpO8O2rmZGZJ/Dq5NYGfzAqkqb1sMjrKp5+EeArh X-Received: by 2002:a25:2007:: with SMTP id g7mr17403735ybg.434.1629605481103; Sat, 21 Aug 2021 21:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605481; cv=none; d=google.com; s=arc-20160816; b=KwUbVIr/L5wEK0txFOQnjOQ5gM73fE2lgBcex4OmnM79EIUKtwQ/BjpZ7vlF5usJEI ABth++Q7UqgNdJLC3CYLjh7ziRrx5It5xhuRu/nwISm9gc91uw1ysqfUS+6P1utMOxAT aF4/cZC8+P+rpzTpbhzbIbKfCD5BsI6e9U63QBuO7iwirR2zshkQ3nhl+LYPmAJieJZz 6D9/n8FX2yRR/vSS7khQwPpg0O1jrUAxfg3FV+JhgrrRWib/2/iwlfG/7XjN7SaHJBFt /ESK0iufzIy+2MfsRHiCRxXAXIK8cBIlHLk+rm/u0bUhb8Y/w6G53rX15P3+OA0nPu/c xbZQ== 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=nExu9rWHCS7f7+CKti5VQfpmql22KtPSQqzBYFW5vis=; b=uWoqy1M4d/T6bRYekBK+Lujb2mLWHNVamiXmrFJAhcuKj9IA+zs7gq5ueI2l6bJDM2 kGUZXtincKSOMvVSiqnotnvN1IzW1d6NyPXcWr2XBeAartTE/LxuRvlNf7PXqsO4TUN8 Ds5h7Vft0d4iDDSLyKnRAT5sVNa3nvNBHsKH61AhEcbe2PYVEkRnfhfLWVinLq7hmwS9 dFvow4P28/oMg9QhyStDl516zoYqUOUTam+bnB3EzGCtbEtE+fQ0z59x7kpKFSep9HLy LPshjm/pY8vHDtCvoLVxryXjy/HXyHQVqJc9RSOn6PnZyPib+9aswpKwbHkxWVSFGCfN /WqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vRlVtLkD; 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=pass (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 l32si5591676ybj.206.2021.08.21.21.11.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:11:21 -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=pass header.i=@linaro.org header.s=google header.b=vRlVtLkD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHepM-0002VX-HQ for patch@linaro.org; Sun, 22 Aug 2021 00:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0007u0-U0 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:56198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaQ-0000jz-DE for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:55 -0400 Received: by mail-pj1-x102a.google.com with SMTP id mq3so9789198pjb.5 for ; Sat, 21 Aug 2021 20:55:54 -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=nExu9rWHCS7f7+CKti5VQfpmql22KtPSQqzBYFW5vis=; b=vRlVtLkDQeuUGXNOwTJq9XxLxmc85rhdmXv+WPiq95+z9Iinopw2EkRLV/CudT6+Ak 8cb+LW7qJ2TNEogxyg6p+YA4+RUAw8QYaEZzwS4j7mNiBL0B0wzdSY+V/1FsS9G9w3JX 6fLb0O3a7rPwL7ST/O0ZyGpzeCEZ117+kGUNCncWxL+2CjTRWcXqv6Ya2Dcvqn3PWVat xBfbClHekNWiivLTrUFQQotIFNGlqjdvWalukBdZwAHnwR7qtab4tPml1VaIvQobnPUT DkodglcctHweytH5/U4lLbKnQkaF8bWadq5wIibjFrscaJlFl3GwND/lNgC1etc5mTrn xBMQ== 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:mime-version:content-transfer-encoding; bh=nExu9rWHCS7f7+CKti5VQfpmql22KtPSQqzBYFW5vis=; b=PKgtg/nlk+vCqWEEyzJP2qZLmVKHihgHQcdSrEVU9Id1ZQ1P9tsGhwrMr3JbbB4AaI rnIoyqRuoFxa6aWUzm5z65D+UBkfydVNivrtZwr9C2a53uW8LpyteNfAlMyQ541gKKSr ny3rhcWsYtpnzuM2dQmsjOapZU+bWtv+qC7J3AlDo9GT8x5VkAhT7tMjbfbFL2kGh93B JNAvGYCBCYf8s+wpRcdcKF6qONFJpbAEbXELB6UHtvLmwMdChvmpUoWmulRKdpgerk25 cX5TphQQu7G2tlxRtPQw4yrbAJB/ECX4V/ikZWZSbzqhIDBVxzGJT4XaR035Ca1uYgjw jbcw== X-Gm-Message-State: AOAM533v5PFz2a/8ECvBBhT4618cpYNFINRw77AIMOo2AQ9fTPaTODgY nqVeosHKkalnwV08l4h6zitzHD8pxfZgmQ== X-Received: by 2002:a17:90a:86cc:: with SMTP id y12mr1572317pjv.127.1629604553213; Sat, 21 Aug 2021 20:55:53 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 22/30] linux-user/mips: Improve do_break Date: Sat, 21 Aug 2021 20:55:29 -0700 Message-Id: <20210822035537.283193-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rename to do_tr_or_bp, as per the kernel function. Add a 'trap' argument, akin to the kernel's si_code, but clearer. The return value is always 0, so change the return value to void. Use force_sig and force_sig_fault. Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 9d813ece4e..797b6bf659 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "elf.h" #include "internal.h" #include "fpu_helper.h" @@ -38,29 +39,25 @@ enum { BRK_DIVZERO = 7 }; -static int do_break(CPUMIPSState *env, target_siginfo_t *info, - unsigned int code) +static void do_tr_or_bp(CPUMIPSState *env, unsigned int code, bool trap) { - int ret = -1; + target_ulong pc = env->active_tc.PC; switch (code) { case BRK_OVERFLOW: + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, pc); + break; case BRK_DIVZERO: - info->si_signo = TARGET_SIGFPE; - info->si_errno = 0; - info->si_code = (code == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; - queue_signal(env, info->si_signo, QEMU_SI_FAULT, &*info); - ret = 0; + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, pc); break; default: - info->si_signo = TARGET_SIGTRAP; - info->si_errno = 0; - queue_signal(env, info->si_signo, QEMU_SI_FAULT, &*info); - ret = 0; + if (trap) { + force_sig(TARGET_SIGTRAP); + } else { + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, pc); + } break; } - - return ret; } void cpu_loop(CPUMIPSState *env) @@ -214,6 +211,13 @@ done_syscall: abi_ulong trap_instr; unsigned int code; + /* + * FIXME: It would be better to decode the trap number + * during translate, and store it in error_code while + * raising the exception. We should not be re-reading + * the opcode here. + */ + if (env->hflags & MIPS_HFLAG_M16) { if (env->insn_flags & ASE_MICROMIPS) { /* microMIPS mode */ @@ -266,9 +270,7 @@ done_syscall: } } - if (do_break(env, &info, code) != 0) { - goto error; - } + do_tr_or_bp(env, code, false); } break; case EXCP_TRAP: @@ -276,6 +278,13 @@ done_syscall: abi_ulong trap_instr; unsigned int code = 0; + /* + * FIXME: It would be better to decode the trap number + * during translate, and store it in error_code while + * raising the exception. We should not be re-reading + * the opcode here. + */ + if (env->hflags & MIPS_HFLAG_M16) { /* microMIPS mode */ abi_ulong instr[2]; @@ -302,9 +311,7 @@ done_syscall: } } - if (do_break(env, &info, code) != 0) { - goto error; - } + do_tr_or_bp(env, code, true); } break; case EXCP_ATOMIC: From patchwork Sun Aug 22 03:55:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501418 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1066074jab; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ2kMaWkX7I4BV2EkNadKgl4ZymudCL8+rsNXP48Zh0ZVl+O+jFs9QqgdiOFd1yiQTq34S X-Received: by 2002:a25:26c3:: with SMTP id m186mr35555250ybm.293.1629605668064; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605668; cv=none; d=google.com; s=arc-20160816; b=NzCrtRkDSGGfp8HT67IKjcQ11+UifVndtPE6DFjLdqVw6i4DqsyEFNnkdLFedzAP72 FLBNeYuKITP5/xVExKl7LEI7cqMeWtoQWgyZShEA/bHyj4d7NkcuRgl5qG4h41NVCFki /Qb1UBvW7ZfPhSUnaYnVWYWVQuXb/v/FhBSJeBnTvI7VRWsmvk+x7o0jhq5+JNPuO25L C5AlwwRao4RtyRYOpQE82q+Jmn638gF5xZY5xQtitt3w7W7M7E5T4jiSRbDA5ybCmM3L kI/zCp0EUW9qg7MAGwhcIQEmURKdkKtifgafit7Ayso5gGiOCspClCeekJMtCm7B8lyz ROWA== 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=CM+P5kCp2bGplgCBuu0CKtvfrg+9JXuhdewm1jvsnkY=; b=QIz0qMTdi/UrgdxEGjrfaMbndRFwGBpM8vGgYZWw9IqspaBQLpdPEHAZSD4OC+Zvnm vVkKTyKBBBKhoTZneeH+FKuhed+p/maufptKvZIC8Du/XE8fxmnFoFEbN7oscltzRBuL kNeTHngjUytfXhKwwfTtcJc5bod5qTo+0GX6fAc77/5L4ygsR/YYSIajdnBpl1iI46A7 vd1JFPNYtKZVoStxRacg2TNtaJijdHrp1YJ4LoVh/DSxkmAs5ngkOafnFq2lWVrtbbR9 0iNeGpQjlN999hlTyOvKwLDyjK6CjLSh5LyBF0vZOO3ju3LBXqFWKrSC2kju6tQ0evgY 8VRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V9g94Eqc; 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=pass (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 x8si10155890ybn.214.2021.08.21.21.14.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:14:28 -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=pass header.i=@linaro.org header.s=google header.b=V9g94Eqc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHesN-0008GF-IY for patch@linaro.org; Sun, 22 Aug 2021 00:14:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0007u9-3F for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:44985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0000lU-2v for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:58 -0400 Received: by mail-pf1-x430.google.com with SMTP id k19so12312884pfc.11 for ; Sat, 21 Aug 2021 20:55:54 -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=CM+P5kCp2bGplgCBuu0CKtvfrg+9JXuhdewm1jvsnkY=; b=V9g94EqcSUn8LEzZ03ro9P4HJJ+fJIPDVR3TZuO+k28P/xpmgt/ynSW9A4vZubwBdf 6+QsmIX3NUbojH0P6hiPbfdV8KEo25vMicyYTcufwivieMl4SiHAwlAXCkOnrFiOjHHy Ii5MWUc+RJERJhdGoH/a7/bkESXzRrZ9gchJbQnaOljbOiqouAd4Kz4QdzsEzBkDu8m6 xh0vpXdbGVbKwzf+wpoqZt7zdR/PcCGB+06kKg1ak/q6qp5+Ldj0+qQWoBidcURV6S8Y fhzqjbn43zr7uRQrG31q3Rm1pHYVMrSLhfn1ul0y7ncDPA0UpM2Z4NEgfuRjlVDtK+AD MB3g== 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:mime-version:content-transfer-encoding; bh=CM+P5kCp2bGplgCBuu0CKtvfrg+9JXuhdewm1jvsnkY=; b=T685juau3cs25IjOG3dj9/hsJPqhra67qqJguH1/xCpPKRGYK6ndhhNEbIbxOUs1bt fLIQ4vMFXZl2DYhd846bc94U1NsaQP07owpBoXXJ7fV624eAVKiuJydryfQZmWeDLZcl cQudAJJ4zCl8T+q3CcdANwP6kRXJ3Dm6HFALbdEXaQJeU5pKyL8YAX0DY+rhilJlimAf nQc+i9tkdegXCqOntTeKgFYtzG3gupwgKz1L4lzdXMuUu399SoBGLn36i2xdl+W8ytGj ftvCL8oAzlj/RU90GvpYqyBtXxzIQwHAwz5uYMLmq78qI3+NsgOHHRQiYtgP7OkYMb6G bMNA== X-Gm-Message-State: AOAM530pM0glczNSuAArkVIp9Z9XVmMwX0UGG5HrD34qzx8eukklQ4kb 25hMgaNfGFi1kMgvPMsXh+9cIidpikApTw== X-Received: by 2002:a63:df49:: with SMTP id h9mr26139673pgj.228.1629604553824; Sat, 21 Aug 2021 20:55:53 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 23/30] linux-user/mips: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:30 -0700 Message-Id: <20210822035537.283193-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 45 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 797b6bf659..2350ac66e1 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -63,8 +63,7 @@ static void do_tr_or_bp(CPUMIPSState *env, unsigned int code, bool trap) void cpu_loop(CPUMIPSState *env) { CPUState *cs = env_cpu(env); - target_siginfo_t info; - int trapnr; + int trapnr, si_code; abi_long ret; # ifdef TARGET_ABI_MIPSO32 unsigned int syscall_num; @@ -157,52 +156,36 @@ done_syscall: case EXCP_TLBS: case EXCP_AdEL: case EXCP_AdES: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->CP0_BadVAddr; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->CP0_BadVAddr); break; case EXCP_CpU: case EXCP_RI: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = 0; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + case EXCP_DSPDIS: + force_sig(TARGET_SIGILL); break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; - case EXCP_DSPDIS: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, + env->active_tc.PC); break; case EXCP_FPE: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_FLTUNK; + si_code = TARGET_FPE_FLTUNK; if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INVALID) { - info.si_code = TARGET_FPE_FLTINV; + si_code = TARGET_FPE_FLTINV; } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_DIV0) { - info.si_code = TARGET_FPE_FLTDIV; + si_code = TARGET_FPE_FLTDIV; } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_OVERFLOW) { - info.si_code = TARGET_FPE_FLTOVF; + si_code = TARGET_FPE_FLTOVF; } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_UNDERFLOW) { - info.si_code = TARGET_FPE_FLTUND; + si_code = TARGET_FPE_FLTUND; } else if (GET_FP_CAUSE(env->active_fpu.fcr31) & FP_INEXACT) { - info.si_code = TARGET_FPE_FLTRES; + si_code = TARGET_FPE_FLTRES; } - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, si_code, env->active_tc.PC); break; + /* The code below was inspired by the MIPS Linux kernel trap * handling code in arch/mips/kernel/traps.c. */ From patchwork Sun Aug 22 03:55:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501405 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060224jab; Sat, 21 Aug 2021 21:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOkbVfktfaiYQ+Qpa7P978ahpV+V+SGN+XY9tL1y0JWLwLl5nb5zFv4LLPViBIat1nW6lG X-Received: by 2002:a02:7755:: with SMTP id g82mr23827993jac.45.1629604880605; Sat, 21 Aug 2021 21:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604880; cv=none; d=google.com; s=arc-20160816; b=Gq9pYJZxJCqfADR3GLpsdpiVP59gxPJs16IR6bsOMW2ZqIu5nYEVoRJmA1YhsmLrMr EuA3w4DanbR7w93JjUD6jwagc5w8FCNmwdmFbrr6BDFyxU2HzPsEHfh+TRy7UvigU4EY fXqqmnj7cpEjFq3nUfFeX1ryrv0Sps5ZpY3eWhIJd4AFjEfpbMbkwQPWlrllihOudnj+ SQnzAzI7J8DQ27iyYLxlC4qyxb5a/dMTN3HBawj1MFLfxipGiTpqIoOxpy+wwc3gfYLA yWJ703HTWfuT7Iu03gtFfctVxj609tI5FQ9o9JDvWT+bmb0DFoUkzjlzqdH0+2IVST3h zZXA== 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=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=QoJjHbPrLB8zgX+Y2NuXkZkNi0malO7v6/5nJEC8Gf1df+vVG01zkXMzy++kBwNEae QH+Z6Z0/4jzq+Il44K+iJ27eycpphWuFN6qn/FjxcNA6jyMVs60dcoGuuNCA+rqSjl7O 1erQMjT3ciWTiK3jzPAZ6JaGY86AXIKNQM5ymg6hftnLLDnjc6LgV3b6egZfeLz+TSEE W50fG8s7cW2AdgqvyJQ9Cjv42bfO79b3m8/KJy6E4DQQXbEJlWPr+c2Tt29b5D7k4I8i zfjyq8g6OjxJW1Jh2sjrZ9uUXDPWKsLYXkb3OCORUTsnsdu/B3vcUWuv8kZR+qECa4WP 2lCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bt3LwJ6v; 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=pass (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 k21si11615577jaq.73.2021.08.21.21.01.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:20 -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=pass header.i=@linaro.org header.s=google header.b=Bt3LwJ6v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefg-0002Rh-2D for patch@linaro.org; Sun, 22 Aug 2021 00:01:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaU-0007u7-It for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0000lk-P8 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:58 -0400 Received: by mail-pl1-x635.google.com with SMTP id j2so3795438pll.1 for ; Sat, 21 Aug 2021 20:55:55 -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=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=Bt3LwJ6vyI56XOGZ5kAZh2DV4rbLYWS1GM6Dxt9Qq4Qe5Qi/H0a6JzsmrxKq7zbJPm igHRtzx7uu2Jg26fbuaGoa/+5fa0AQ8oI76c3cY1xut2+LYhXHK/kFM2AtT3bCbhfAdr CseML3Ib2yMhb9fuM5z//5jQ0dHqnXAcgpZoxOBAzMXV090TGLwyMdMIjhrj/Vp45HWB v23gCdM+zRaEaAtlmyD2Kn+mN4yoAPJHUmXo0rqC6Mmf6wDVEwQEZXSX2QT5SLjJiN/d eP8dvwvl7IcFDcSN+z1qdf3sluPfy5hNX3w3vUC1o5iVGZXuEjFBtSo88pemyclK3IdU e93w== 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:mime-version:content-transfer-encoding; bh=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=dICZ1iQ2ImgiFkSAFaZ4ue1FRj30gj7McFAhG4n1ygdhMSRTOK3mE7KK4ZkLQ9azmn x6Bk27Wd9GcuISjJIck7TpQqhVHVmeFZWYFgYOsgu4DjP3Acizcndj7hVU9CSu4TGXTk 6o/wrp76z+UeQEzLwptBhciOyV5pInPO5ti5VsRnmTSyLRH06JeXeHu5kLhAlluGAV/6 0jnqeCy0eme62l5aQFEoPi2xQWwFoBu4hrLi50dzEJWvUvm3aPkmylorOEMpl6VQDFyF wzcJrNkq/v5GH7BWIRP58pvVhTprRt4UGdfU+8LBaE9lGxSO24sGCKXfOYOIAeKhudeG CjnQ== X-Gm-Message-State: AOAM530ahV3zi6rySGuXx7vjtpl8lmq7H56pR3aFmj0S8IX9dkP9TAxk EcKkI9oCdU7Lytpjnpf2McaiEHPsqg2y2A== X-Received: by 2002:a17:902:a710:b029:12b:9b9f:c461 with SMTP id w16-20020a170902a710b029012b9b9fc461mr22639734plq.59.1629604554442; Sat, 21 Aug 2021 20:55:54 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 24/30] linux-user/openrisc: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:31 -0700 Message-Id: <20210822035537.283193-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/openrisc/cpu_loop.c | 37 +++++++++------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) -- 2.25.1 diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index b33fa77718..d2632ce6a3 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -21,13 +21,14 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUOpenRISCState *env) { CPUState *cs = env_cpu(env); int trapnr; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -54,42 +55,24 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_DPF: case EXCP_IPF: + force_sigsegv_for_addr(env->eear); + break; case EXCP_RANGE: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + case EXCP_FPE: + /* ??? The kernel vectors both of these to unhandled_exception. */ + force_sig(TARGET_SIGSEGV); break; case EXCP_ALIGN: - info.si_signo = TARGET_SIGBUS; - info.si_errno = 0; - info.si_code = TARGET_BUS_ADRALN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->eear); break; case EXCP_ILLEGAL: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; - case EXCP_FPE: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = 0; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; case EXCP_INTERRUPT: /* We processed the pending cpu work above. */ break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501409 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1062250jab; Sat, 21 Aug 2021 21:05:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy76AkhtJuaPz/ORap29sQ+xknHL1Rjwe+767XVE0BgJAzWMfgqEu9zYqLzI8CzOpH7KJ9T X-Received: by 2002:a25:ba41:: with SMTP id z1mr34650297ybj.169.1629605116074; Sat, 21 Aug 2021 21:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605116; cv=none; d=google.com; s=arc-20160816; b=0bUm6nFVDKFo/XGH9wnjln53tZQjo5hur1z728EgJz+l5/ANGq47jiTPxbo3EtE6hZ 1Vh8LPhjtOASeSaYFrK7XYZ/2KLjqD+cg5oPvcvq46VXdygNgoX7BO+WKHFylLrLd4xw eyT/ZrvPSz5+LNEWx1jGX4tUfvFwlkUGb+hBb34QS+F9KynbAE4bUkhqEjwUAl4/ATq3 9WFEicVkqQmpCDoUZbjJx/JU6Id30ciyXb38ax4WT9Ne09B06A0GSfcZE55gnvaa4Z4B neSmKr4JZhLmMboy+/fjbk29AWe8iphnAY0eu7E2XuGoN/Xl8/X/cj1yFOUkiPXwxkN+ xtqA== 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=+v1YogFzFLNFD/zLNDkuHoAqiRV8XrYV0MsKRyjw4WM=; b=gMNn6Qxa4J/NV7K/IFe0B0PxRqFgHshG5ycXNFcLNh47JO+DZ424bH4cjuVqhdSEWd ieVfX2cSXsWsQlqroXTDmFW8PoQWWhsLka5Hs5zkfZQdivBH6qKIw0eUxY8r9jLNW2dI WvilLGOQx83d3uBrzC7blf4FJiOJXTw7UlyjcOs2lf43wClfO8Olc6zzXPn/UPywwdtE PgtUxlh49tGwOEYaGcEwlv+sYH4AiWQHPXXI3GtsUNSA7weHE58TWkDE65Gzkkn7yA/S dgBd/Qw1dMtKkR9DOHKuROCrplchVPu/C8w6CV2+ZywUKlWBEIeLnOPNTCuv2NqgwFEv BLrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jjwb8KG+; 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=pass (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 y137si5302211ybe.67.2021.08.21.21.05.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:05:16 -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=pass header.i=@linaro.org header.s=google header.b=jjwb8KG+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHejT-0008FX-Et for patch@linaro.org; Sun, 22 Aug 2021 00:05:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaW-0007vP-37 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:01 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:41703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaT-0000mb-5n for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: by mail-pf1-x429.google.com with SMTP id i21so12288367pfd.8 for ; Sat, 21 Aug 2021 20:55:56 -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=+v1YogFzFLNFD/zLNDkuHoAqiRV8XrYV0MsKRyjw4WM=; b=jjwb8KG+wTi5FZskcK3CLLa9etTJ5kMoYZp5tV4EPJ4FP3DdagOfd3UD4MMOVesJ60 /Ph8L48o9/Y9FBiXB6X6YYaLG75KRzdTf/m4iqw322nZHwUj0DPBMyuAi2e6H56fnrXW 37xjxtVSIXEeiqVedbcx3xUVZ7FSszAObnqW4mHAdV9rT3+L9jVYQ/bS3JWlLp5ZOVU3 F8IxEOVjD/nYI8XSUxR+wDQyfg7JA3h1f0AFm02hhOby5G+MFbqKqNggOyLkNVUAIjuF FDVDHvQrXwPErO4Qmwe+Zpcxbk2FqywqLPjiQVgj+bPuCdBfaLUc26VkyTwEWm/B4XLm uirg== 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:mime-version:content-transfer-encoding; bh=+v1YogFzFLNFD/zLNDkuHoAqiRV8XrYV0MsKRyjw4WM=; b=HvXYhvVF/c6I+yIb8zZuP2fF/eFkvGJzztdG7RKyye0TVJ13cBEvOe5AvbNwXKvI0D eSucH5H10kzDtzRAlFMbUUhnXITsHYu3HfsdWC3x/7bMuk5WZtv4Z/FnKhtoNDjw6L/l SwSUpirestT6oGiK8u1VmAOaP9l1NO2iTR42sUnpcoSO20z1kBW8JWqRThBn1gS5SDbC zxlMVpoIdfE/wP0RouQMiXzr8BoD1I8ePQ6Eu5yiCggov2O2yOP1iozwlN/W9MM5+KNo ix7MlgceycmQjxKodjXOdCr9M/uKsqM6z3js7DScTflSjI46tePxczoBzWNEm+3SzGto MQAA== X-Gm-Message-State: AOAM530DSrRK4Op7PBRvb0Lnegyku8X9GbJgRaHzzV+mR3C0r3J26PDZ QrEUbaHnT8FQhsW1x1qZS348Lu0t3i3q5A== X-Received: by 2002:a63:480a:: with SMTP id v10mr25791903pga.113.1629604555001; Sat, 21 Aug 2021 20:55:55 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 25/30] linux-user/ppc: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:32 -0700 Message-Id: <20210822035537.283193-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. The user-only version of ppc_cpu_tlb_fill does not distinguish between the various hw codes. Drop all of that and just use the new force_sigsegv_for_addr function. The fault address for POWERPC_EXCP_ISI is nip exactly, not nip - 4. Signed-off-by: Richard Henderson --- linux-user/ppc/cpu_loop.c | 142 ++++++++------------------------------ 1 file changed, 30 insertions(+), 112 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index fa91ea0eed..4893bbd021 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -21,6 +21,8 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env) { @@ -74,8 +76,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val) void cpu_loop(CPUPPCState *env) { CPUState *cs = env_cpu(env); - target_siginfo_t info; - int trapnr; + int trapnr, si_signo, si_code; target_ulong ret; for(;;) { @@ -100,61 +101,10 @@ void cpu_loop(CPUPPCState *env) "Aborting\n"); break; case POWERPC_EXCP_DSI: /* Data storage exception */ - /* XXX: check this. Seems bugged */ - switch (env->error_code & 0xFF000000) { - case 0x40000000: - case 0x42000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - case 0x04000000: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLADR; - break; - case 0x08000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - break; - default: - /* Let's send a regular segfault... */ - EXCP_DUMP(env, "Invalid segfault errno (%02x)\n", - env->error_code); - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - } - info._sifields._sigfault._addr = env->spr[SPR_DAR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->spr[SPR_DAR]); break; case POWERPC_EXCP_ISI: /* Instruction storage exception */ - /* XXX: check this */ - switch (env->error_code & 0xFF000000) { - case 0x40000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - case 0x10000000: - case 0x08000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - break; - default: - /* Let's send a regular segfault... */ - EXCP_DUMP(env, "Invalid segfault errno (%02x)\n", - env->error_code); - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - } - info._sifields._sigfault._addr = env->nip - 4; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->nip); break; case POWERPC_EXCP_EXTERNAL: /* External input */ cpu_abort(cs, "External interrupt while in user mode. " @@ -162,35 +112,30 @@ void cpu_loop(CPUPPCState *env) break; case POWERPC_EXCP_ALIGN: /* Alignment exception */ /* XXX: check this */ - info.si_signo = TARGET_SIGBUS; - info.si_errno = 0; - info.si_code = TARGET_BUS_ADRALN; - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->nip); break; case POWERPC_EXCP_PROGRAM: /* Program exception */ case POWERPC_EXCP_HV_EMU: /* HV emulation */ /* XXX: check this */ switch (env->error_code & ~0xF) { case POWERPC_EXCP_FP: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; + si_signo = TARGET_SIGFPE; switch (env->error_code & 0xF) { case POWERPC_EXCP_FP_OX: - info.si_code = TARGET_FPE_FLTOVF; + si_code = TARGET_FPE_FLTOVF; break; case POWERPC_EXCP_FP_UX: - info.si_code = TARGET_FPE_FLTUND; + si_code = TARGET_FPE_FLTUND; break; case POWERPC_EXCP_FP_ZX: case POWERPC_EXCP_FP_VXZDZ: - info.si_code = TARGET_FPE_FLTDIV; + si_code = TARGET_FPE_FLTDIV; break; case POWERPC_EXCP_FP_XX: - info.si_code = TARGET_FPE_FLTRES; + si_code = TARGET_FPE_FLTRES; break; case POWERPC_EXCP_FP_VXSOFT: - info.si_code = TARGET_FPE_FLTINV; + si_code = TARGET_FPE_FLTINV; break; case POWERPC_EXCP_FP_VXSNAN: case POWERPC_EXCP_FP_VXISI: @@ -199,51 +144,50 @@ void cpu_loop(CPUPPCState *env) case POWERPC_EXCP_FP_VXVC: case POWERPC_EXCP_FP_VXSQRT: case POWERPC_EXCP_FP_VXCVI: - info.si_code = TARGET_FPE_FLTSUB; + si_code = TARGET_FPE_FLTSUB; break; default: EXCP_DUMP(env, "Unknown floating point exception (%02x)\n", env->error_code); + si_code = 0; break; } break; case POWERPC_EXCP_INVAL: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; + si_signo = TARGET_SIGILL; switch (env->error_code & 0xF) { case POWERPC_EXCP_INVAL_INVAL: - info.si_code = TARGET_ILL_ILLOPC; + si_code = TARGET_ILL_ILLOPC; break; case POWERPC_EXCP_INVAL_LSWX: - info.si_code = TARGET_ILL_ILLOPN; + si_code = TARGET_ILL_ILLOPN; break; case POWERPC_EXCP_INVAL_SPR: - info.si_code = TARGET_ILL_PRVREG; + si_code = TARGET_ILL_PRVREG; break; case POWERPC_EXCP_INVAL_FP: - info.si_code = TARGET_ILL_COPROC; + si_code = TARGET_ILL_COPROC; break; default: EXCP_DUMP(env, "Unknown invalid operation (%02x)\n", env->error_code & 0xF); - info.si_code = TARGET_ILL_ILLADR; + si_code = TARGET_ILL_ILLADR; break; } break; case POWERPC_EXCP_PRIV: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; + si_signo = TARGET_SIGILL; switch (env->error_code & 0xF) { case POWERPC_EXCP_PRIV_OPC: - info.si_code = TARGET_ILL_PRVOPC; + si_code = TARGET_ILL_PRVOPC; break; case POWERPC_EXCP_PRIV_REG: - info.si_code = TARGET_ILL_PRVREG; + si_code = TARGET_ILL_PRVREG; break; default: EXCP_DUMP(env, "Unknown privilege violation (%02x)\n", env->error_code & 0xF); - info.si_code = TARGET_ILL_PRVOPC; + si_code = TARGET_ILL_PRVOPC; break; } break; @@ -256,28 +200,19 @@ void cpu_loop(CPUPPCState *env) env->error_code); break; } - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(si_signo, si_code, env->nip); break; case POWERPC_EXCP_FPU: /* Floating-point unavailable exception */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_COPROC; - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + case POWERPC_EXCP_APU: /* Auxiliary processor unavailable */ + case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavail. */ + case POWERPC_EXCP_VPU: /* Vector unavailable exception */ + force_sig_fault(TARGET_SIGILL, TARGET_ILL_COPROC, env->nip); break; case POWERPC_EXCP_SYSCALL: /* System call exception */ case POWERPC_EXCP_SYSCALL_VECTORED: cpu_abort(cs, "Syscall exception while in user mode. " "Aborting\n"); break; - case POWERPC_EXCP_APU: /* Auxiliary processor unavailable */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_COPROC; - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; case POWERPC_EXCP_DECR: /* Decrementer exception */ cpu_abort(cs, "Decrementer interrupt while in user mode. " "Aborting\n"); @@ -298,13 +233,6 @@ void cpu_loop(CPUPPCState *env) cpu_abort(cs, "Instruction TLB exception while in user mode. " "Aborting\n"); break; - case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavail. */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_COPROC; - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; case POWERPC_EXCP_EFPDI: /* Embedded floating-point data IRQ */ cpu_abort(cs, "Embedded floating-point data IRQ not handled\n"); break; @@ -361,13 +289,6 @@ void cpu_loop(CPUPPCState *env) cpu_abort(cs, "Hypervisor instruction segment exception " "while in user mode. Aborting\n"); break; - case POWERPC_EXCP_VPU: /* Vector unavailable exception */ - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_COPROC; - info._sifields._sigfault._addr = env->nip; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; case POWERPC_EXCP_PIT: /* Programmable interval timer IRQ */ cpu_abort(cs, "Programmable interval timer interrupt " "while in user mode. Aborting\n"); @@ -450,10 +371,7 @@ void cpu_loop(CPUPPCState *env) env->gpr[3] = ret; break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->nip); break; case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ From patchwork Sun Aug 22 03:55:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501419 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1066076jab; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt8WBihpSnZYijfaiUV4tlQQYj2Q7EZ+Xk/ePFEWI36iyHCceQ3IvSFTHowz3HXW4Z1L/w X-Received: by 2002:a25:53c8:: with SMTP id h191mr36251713ybb.71.1629605668375; Sat, 21 Aug 2021 21:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605668; cv=none; d=google.com; s=arc-20160816; b=ooMPyYNtq/vvznAAygHOInoVXhaa2rcdVXEeMGHp7ewie9p7PQ1JpT1vKCU2yUl1Qc IA72F7MMUzFXIwa/sQpo8h5K4IVXGTdonLz6ivZLPxbXR8rr+5wvBDQ3jeIp60f7fwSH Nr+5857r0HAp//7q4kInHlmnZ8/Tnv74uw1zWZrheE4U4Z6GljtG6wf09T20JoCKR5nr U+36UvRSi+GKeyHJA2ITsl7QhH6z4wFijyHoXpodTyMcKL/s87lOGfyqbn8TOHctEmlX ERP42OHdHWb8chpXBtnpCymCQlvkyilXrbSCVu5Qm2SemvGAdp7wHk8VlVziDXvxXZ2c 74jA== 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=9HGVPe/pQ5/XkIwVDPflmpNkSXdRjb5w/EgQJjUaxxk=; b=ywrzeCUPDJc9s0IRuVLqAGRKGOU7/aIjKk2s7saxHSVhbXpkLcuU37oeUO63/52ZPf h1cmBwtFdlaCLMJGXyxWSxCz62UHqYzRos20U6J6uM0Bq7B/jSARFN6tgQ626kzGK45I RiUOvah8X+kGcftmKT0dLMqmNRg3PonJ6tACeZZQC4Teho32jx26Tnq7VjV7uKdEvirJ qlURfIVS4BvZQrKFkkXyAGNADjjXA66FBkgfSK44nJzUQy1eGINscN5blfiN4aQ49L61 hY7ecYROoKTVwUnzwvLLUHiDl3kKN8Nyggu1mHA3Hrr7EvAPI2x0eVRDSL4B5bSx0DLM jCdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fJXbaeGV; 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=pass (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 y7si9404914ybr.408.2021.08.21.21.14.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:14:28 -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=pass header.i=@linaro.org header.s=google header.b=fJXbaeGV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHesN-0008HI-QU for patch@linaro.org; Sun, 22 Aug 2021 00:14:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaU-0007u8-Mh for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:43566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaT-0000mh-5M for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:58 -0400 Received: by mail-pj1-x102e.google.com with SMTP id qe12-20020a17090b4f8c00b00179321cbae7so9900784pjb.2 for ; Sat, 21 Aug 2021 20:55:56 -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=9HGVPe/pQ5/XkIwVDPflmpNkSXdRjb5w/EgQJjUaxxk=; b=fJXbaeGV3G6HRxu/+VHOLCNOhZK3QnUCDHFLA32KyCWYUinJGq7nbU2KzeNm7SzBA8 Nzc4zXsa8zzOuHMEag9n446bN3Xd1oiHx02MTepUzYD7oo1ph7SCdul41/+e+G1JgOPO 0XQ1tpNX09IaC+8n+p6ppZbsQQf1szDLop5bkQnsnFmz5A2cwVvUGtvVm8Z7dy+jF6Qq okPLQ98Uk99p/29dYc1niNVrj/gwzXVoJwDBv8fKQ+/JjseRfJRDmgDxgMDIN61h1zP5 0Abcnt71dRCtygCH0IQ0vWXQzY6tnyGDhj1T+CWqxdKoMbouCWIhXLxZqop6pM7odWxJ MkAg== 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:mime-version:content-transfer-encoding; bh=9HGVPe/pQ5/XkIwVDPflmpNkSXdRjb5w/EgQJjUaxxk=; b=l92Tnlut0CeeDQvMoi91fbR2kHz8SRNHj6IcNJIrP7HHeitEdHU0GnXe27Y4wh0grK f3HLdiAU6Lsz074W3NqfKymD/Nc5Rbp4fO8yCk68PE4oxf+U6wFsF3Hg0VKX4d/fXUe1 4Zs1Yr+VvrfLljz0BMUR+Vmxo9hNhQzSx3GpQBgHM6Vv3irqHxeZnoV+Dqj6VtKXtoXC kt25YhTU9t9O1jifmadCtM1NfgNMQIueXP2sYauoHkUFKg0I2eQk1rq3ndwlp/4Q0jZg S0jP866oT61n2p1vW6fXP3t7/FW0sMiKhzQQgW6TrO2GuF/mogwKrNzM17RQSwR/TzKA DULQ== X-Gm-Message-State: AOAM5316TddY7a2G9zsT9UaURyUuJ+zONWU1oSRY2f0/tCgdSTzq1A14 BQFYcjboRUBZ09/c8Vw/vcI+ojZvIo07ug== X-Received: by 2002:a17:902:b093:b029:12c:843:b55a with SMTP id p19-20020a170902b093b029012c0843b55amr23065852plr.83.1629604555642; Sat, 21 Aug 2021 20:55:55 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 26/30] linux-user/riscv: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:33 -0700 Message-Id: <20210822035537.283193-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/riscv/cpu_loop.c | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 74a9628dc9..32c440365c 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -22,14 +22,14 @@ #include "qemu/error-report.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #include "elf.h" #include "semihosting/common-semi.h" void cpu_loop(CPURISCVState *env) { CPUState *cs = env_cpu(env); - int trapnr, signum, sigcode; - target_ulong sigaddr; + int trapnr; target_ulong ret; for (;;) { @@ -38,10 +38,6 @@ void cpu_loop(CPURISCVState *env) cpu_exec_end(cs); process_queued_cpu_work(cs); - signum = 0; - sigcode = 0; - sigaddr = 0; - switch (trapnr) { case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ @@ -77,46 +73,28 @@ void cpu_loop(CPURISCVState *env) } break; case RISCV_EXCP_ILLEGAL_INST: - signum = TARGET_SIGILL; - sigcode = TARGET_ILL_ILLOPC; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; case RISCV_EXCP_BREAKPOINT: - signum = TARGET_SIGTRAP; - sigcode = TARGET_TRAP_BRKPT; - sigaddr = env->pc; + case EXCP_DEBUG: + gdbstep: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case RISCV_EXCP_INST_PAGE_FAULT: case RISCV_EXCP_LOAD_PAGE_FAULT: case RISCV_EXCP_STORE_PAGE_FAULT: - signum = TARGET_SIGSEGV; - sigcode = TARGET_SEGV_MAPERR; - sigaddr = env->badaddr; + force_sigsegv_for_addr(env->badaddr); break; case RISCV_EXCP_SEMIHOST: env->gpr[xA0] = do_common_semihosting(cs); env->pc += 4; break; - case EXCP_DEBUG: - gdbstep: - signum = TARGET_SIGTRAP; - sigcode = TARGET_TRAP_BRKPT; - break; default: EXCP_DUMP(env, "\nqemu: unhandled CPU exception %#x - aborting\n", trapnr); exit(EXIT_FAILURE); } - if (signum) { - target_siginfo_t info = { - .si_signo = signum, - .si_errno = 0, - .si_code = sigcode, - ._sifields._sigfault._addr = sigaddr - }; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } - process_pending_signals(env); } } From patchwork Sun Aug 22 03:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501424 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1069463jab; Sat, 21 Aug 2021 21:22:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT5r7rxmlQe0RWiT1NdTguTtMoObfgNFnoE7sMLUDKdiZ5ndvFa1tzoIgMYN9Le82pQl/+ X-Received: by 2002:a25:3108:: with SMTP id x8mr34646104ybx.386.1629606130946; Sat, 21 Aug 2021 21:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629606130; cv=none; d=google.com; s=arc-20160816; b=vt4hVlQi0js6NP5Ub5y2yZR2dJnlYatqFzic/DMqI8DyeqSKHSGleQvb+2dlovNraS hzwWnNvOaD4yrsPBk+tzS0Xdj/aVkjxIOEzGvg/63GNvM7qeaYsm+FEWhiiZl3LAVGQP LNGU77pf8yAkUnskbl4mR1ERMyQcr084z615AAu0rTg8l5D0Mt+eRi7+C7hrT7z5qvNV nRC2j2KXzfaivI7jgEbI+LnV2duZZlpP5TKbiv2wwGVw9bpjOnLJ5SJMaGzJOxhmpSZa E1DOGr5UZ2IxfzjZTad0dMxKm9ON5tFjH2S4/6IAHQQUk8BAS2k1rMM18Xssb9FznHDe hjPg== 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=3QatqUyjS7CHgCtyFONtgHEY/7FxQllE+nDg9ups7ko=; b=j/xlc4PvjYxuHXU0dC/jT6Wkdcin8OwUA3+oScDUkxAQNSruC6JhT4eCYZfYbS1rKF Smj0wjQGxfG7CsRoZekmTetcObflOk/+6rAJ1THzdZqnMoRNICFyNqug0/1o9lOVakTO 9tZy8sqKPwHc/iR5U+wNpk00QZfg545XXRL6YaAyuGwwbSPI7k3BUybgXHo5Nx2rrNqY MxyGFq54SqNJBP3MWJM1fuEVd2vO3jfSEiWsqj7ZcF5NQXE3uG8lw4HuJLbMM27UPyUC 7VCtHzMN3De7dsQmLkp4NtORMjrFSDVCu3FQG3mFXEZg8oE/j30PCT3q5h7yJh03rpsb eBvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iz8vs1+P; 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=pass (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 129si8499304yby.332.2021.08.21.21.22.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:22:10 -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=pass header.i=@linaro.org header.s=google header.b=iz8vs1+P; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHezq-0001o5-FM for patch@linaro.org; Sun, 22 Aug 2021 00:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0007vN-HB for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:01 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:37703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaT-0000ms-Qg for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: by mail-pf1-x429.google.com with SMTP id j187so12285048pfg.4 for ; Sat, 21 Aug 2021 20:55:57 -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=3QatqUyjS7CHgCtyFONtgHEY/7FxQllE+nDg9ups7ko=; b=iz8vs1+PcWM8L1AkElUcu+f1PNDJWq2iaAi+VwNiRvK5JNUUyFhQ7M1Dp8lZ0l5NdK lqZxN+jbc/h7x69ASlur86PmgiCJZRSEXtrAytkYR9oNtO8UvNZd1VZy6C7Q8wfjC1t6 deor9HdXZww/KRGt0o7PcaFs/rV2SWgCee2XGHWEW57YeJuc2MKilJXd8edUc8DhPXeJ GEv5r8aMaWjv3dMrmaPyMUDfQNwlESSNUAXEPXNOCciCDJB0fWudNZ6oqcn53RMtRYGY kk4gIy6bkd6syoLZF0m60b9R2oqjqv06o7P6T7B6lZvSw1RTMvVen5UzMTnYvtl5lJsO ME8g== 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:mime-version:content-transfer-encoding; bh=3QatqUyjS7CHgCtyFONtgHEY/7FxQllE+nDg9ups7ko=; b=DVEK7TbLsqOV3Aqp4sV/ftEo9Th7K66Sm+w64lvN5KlfrnuWlBwvJK3fkvd5Q/HVCm 9qvQQs1j3uZGiPlEYYL35WtavFY1wNlKPTCmKvN8DrQ3qt5asbW1YavdcUzgJYENEWVE wNd5aJXf/epE3dQxGUVUoFdLpOzmzcNuYz751ccDw58TKqXLkOBKVxRlt2qs6beNUMMI wimx38vpFkEhY3kR8SM+ztHmj5l3IfulkKjrW4m3WQ2Kzc4mhqau5Cn+E1AmlACjFfbC /SnwGozJw9upAzoJFyKa4mLvg/xqO1pDdDysv6ROouVwuXMzpwRRB9P1tPHpwHwfZjMQ 0+BA== X-Gm-Message-State: AOAM5337mm1NvLLMeND9EzFpfvDk6QMZWSNtsmoUul57xkPf30OULfJz 3FgRAlLylpGAEJdjmXDr2FCmYZ0ubLZshA== X-Received: by 2002:a63:6705:: with SMTP id b5mr26238575pgc.69.1629604556350; Sat, 21 Aug 2021 20:55:56 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 27/30] linux-user/s390x: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:34 -0700 Message-Id: <20210822035537.283193-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/s390x/cpu_loop.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 6a69a6dd26..8287d3dfe8 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -21,6 +21,8 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + /* s390x masks the fault address it reports in si_addr for SIGSEGV and SIGBUS */ #define S390X_FAIL_ADDR_MASK -4096LL @@ -58,7 +60,6 @@ void cpu_loop(CPUS390XState *env) { CPUState *cs = env_cpu(env); int trapnr, n, sig; - target_siginfo_t info; target_ulong addr; abi_long ret; @@ -110,11 +111,8 @@ void cpu_loop(CPUS390XState *env) goto do_signal_pc; case PGM_PROTECTION: case PGM_ADDRESSING: - sig = TARGET_SIGSEGV; - /* XXX: check env->error_code */ - n = TARGET_SEGV_MAPERR; - addr = env->__excp_addr & S390X_FAIL_ADDR_MASK; - goto do_signal; + force_sigsegv_for_addr(env->__excp_addr & S390X_FAIL_ADDR_MASK); + break; case PGM_EXECUTE: case PGM_SPECIFICATION: case PGM_SPECIAL_OP: @@ -157,11 +155,7 @@ void cpu_loop(CPUS390XState *env) */ env->psw.addr += env->int_pgm_ilen; do_signal: - info.si_signo = sig; - info.si_errno = 0; - info.si_code = n; - info._sifields._sigfault._addr = addr; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(sig, n, addr); break; case EXCP_ATOMIC: From patchwork Sun Aug 22 03:55:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501413 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1063627jab; Sat, 21 Aug 2021 21:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq/3OeLxINTBW5b22BCR2951NYQ+MIQNg1syCMV23rcXmSlLUgSlQ2uguBBPqi/qTwv8Lh X-Received: by 2002:a6b:d20c:: with SMTP id q12mr22376640iob.121.1629605300356; Sat, 21 Aug 2021 21:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605300; cv=none; d=google.com; s=arc-20160816; b=KXhO51dEJ2IcWyIY9lo2QoKCy7ifDDGtQB9IoJRxSDkNBEiCQonCW11k4hy9zKzvZ3 pTGPNW/YGNFs6ixhDcA6VZu917ma6PWcEdrELu/IY0xKKFOS8Ofw3zllq9lnqYgW9BHY jSLJcK2aL0e4ax5XKb0nRdauDC+WBAQiuUzx6F4RxITg+5dJcG+35CIpot51I75jZ5F2 mNqBvMVvQ4Tb7ZY41uzFtALx2OAx+PXF+X5SDiuNFKNi5lRVFjUhm9wOC2MKUXGrdyyl sqmdjWWubDxS6a2jY9NV0gR1/SNfAQ//1267n4gCze/q3EqQQp1IiPxmK5sEBhTaTfzu oL/Q== 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=XrQegvQ52g51iXxP1ir/2vDYcsxCC4+2/9p/CuuRamw=; b=nldbLzxrAGBC4rG2PPcD15KoDFX+F4Z1yye/CTiKnXMS2KoA4LT+JHVnLZt9kQ/vsJ 1tAK2xkmYHRXOvv1sNN0BKzQYxHZc8EL5EXyIPJ2afBHRqz8l1PK8BC5MLkrCDMUbEU6 t+yF4g3G6KahXVAxWoX1GLwTA949TSnU1L39Y5atH5j8aGIyxMF/ppgwrkyVju09RkCr boHj0Zy6rNZEkb7uUAcs2rYF7FouD9Eq0rLTbeblxGp+slNHhmmLHYX4iauwlyHGBnpT A30WGcTPmwOxDIan2KYKQdUbDs8BQS56DcZXVWnjWzUYR+iJrDKtLqT3+x400epKaOww 0l+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eYaXYCpd; 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=pass (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 e11si10551445iot.82.2021.08.21.21.08.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:08:20 -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=pass header.i=@linaro.org header.s=google header.b=eYaXYCpd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHemR-0005ej-RE for patch@linaro.org; Sun, 22 Aug 2021 00:08:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0007vO-QZ for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:01 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:43582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaU-0000od-BS for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: by mail-pl1-x630.google.com with SMTP id x1so5651601plg.10 for ; Sat, 21 Aug 2021 20:55:57 -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=XrQegvQ52g51iXxP1ir/2vDYcsxCC4+2/9p/CuuRamw=; b=eYaXYCpdmhTQzkbqpVAqtILN5KqU1JrfJYNZhTfR1lk9TQlIBqoPAslWSuyiavJQwD HjYO7bMXTiUVJzkfWyKeR6iWQPTwrj/PxEpjDHxjrmsA8tLRFUQv8VcAmEV98jjW0cue oMucg5rVDTGejNoIfBETnrtYiCOi/GfS4xO4U4syCUbkbwEWcZ8P2aKGsaaTRkDYl/RK W36Vo4q58MOJN3ZfyUmDiM1rjmbfSX4i9N4VrxgIBLN7SvHRxDgiW8SB70WjQ4uLhfOQ kSzqaw8EFbRbO8X9I5u4K05PFZexE5QjyDYTvSnRop61EOBEriLvLXH2APFx6NUxhoWn h/Kw== 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:mime-version:content-transfer-encoding; bh=XrQegvQ52g51iXxP1ir/2vDYcsxCC4+2/9p/CuuRamw=; b=Ux0vsZVa3ZyZvJGjzTZzAe4Mvq4yquzpEPn60ekZ434nrc9B/NQGY6DXd+wyYpX4CA bjT6Zzd+YNFc4wXBKM0UKh9QUiSFmPBYqEKiKjp2I1Sk/vwLC/FOCKMoRr8gDwb+kJAn +5LdEipVdDdmhYPR9Nhu6/059ooqiQaL21NrOcdyQd1//533zQ2BhXnCAc2vk7W2Q8r5 NJS8ocEjMVWikWWhHuo/xWUbaj6Ym73gbzNMnVKkea4e0gyPGGs2liuVJrlptgycS7dS dseGjALGamKiFDqgRCoNGCIy4+0PaiMT5R6nzABLItuTBy9lRNEgft9G7CMaKrdgogkO +41g== X-Gm-Message-State: AOAM533AJXOTBxyn9CpXu8aKFIfLhLKK0PvBEOd1kR619pArvhWQaZdo s0ETKhen8lzAGHxnX8GuS9P1Wq4/y9LqFA== X-Received: by 2002:a17:90a:8005:: with SMTP id b5mr637562pjn.190.1629604557070; Sat, 21 Aug 2021 20:55:57 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 28/30] linux-user/sh4: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:35 -0700 Message-Id: <20210822035537.283193-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/sh4/cpu_loop.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 222ed1c670..0c3ec908e7 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -21,12 +21,13 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUSH4State *env) { CPUState *cs = env_cpu(env); int trapnr, ret; - target_siginfo_t info; while (1) { bool arch_interrupt = true; @@ -58,18 +59,11 @@ void cpu_loop(CPUSH4State *env) /* just indicate that signals should be handled asap */ break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case 0xa0: case 0xc0: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->tea; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->tea); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501417 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1064848jab; Sat, 21 Aug 2021 21:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi6xPmCH6PgAD48MDW0Q6o4/TPtA4A1LTT2Z7rFH9Bl4l9XzMfLTdChOfUf2YOXsUSsT4c X-Received: by 2002:a25:ba0f:: with SMTP id t15mr34948505ybg.15.1629605489421; Sat, 21 Aug 2021 21:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605489; cv=none; d=google.com; s=arc-20160816; b=yi6xOUSDvhhJOllu7WjqlPmPUSQTZCcooZ/MSdkO7Q66LayI08vR1PCmvBec4c3kjt Kv5/jqDpY22U81rrNAcvlz8LMFB+yOwSwd0NOXLHPfZxHVw6sp0eacxf7DB2QTZPAgOh 9+iBORKam4SgVR7j052TIA9oOwm326AmGa4SHYNFW3aFMuHsBSERVpVnJP/vsD/+1cAW lLtDwmK091Q/29gH+Fn2RJ4MA2BiCGxbQ37qjM9yUEPQtptz0mo8sj2sjZ8FzdlXZyUF 2PDrNg/bDHyohKudZ8JDRyie58cccFuSBkEHQN+8/+jkk6EWR10niXxOUSrXpQ+IAQxP rmUA== 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=HZHOBf2F1kyrH2/d+/Nk4ZDYvJLaqXezPeFn7O5njyk=; b=pXBzpX6rokgxrbYQDWQ+5hfYVa2XDKVD1q8J9xieYUJA/znHPlGl1N57ZqzP77vAnJ warGi7ueIGM42fWUPsw+C/WzDQ59UFdqksS2lnxf0NVYlu6pnNr97kBMW4izGAPYA8wa +c+dMaMSOh6ADt89os5kVBbqhWnn8eD5+U0TU1MtM+Rb8B9Z+EFHx6KjfQcTiYMzlwbv gCWXRoRQAwvOLaZQqpBDCur23DkBCPMWfi7KjN837HduTYtjUzrMi0PwUk7MgLSPuzA9 6wGNyWyWVlgSoxFOJWVGliAEl6d5EQ96x7FEJ1P0jmUZBsdNioF9YUHnOFPDWfpC7QcI tUUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kLKHL56a; 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=pass (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 k77si1608521ybk.489.2021.08.21.21.11.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:11:29 -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=pass header.i=@linaro.org header.s=google header.b=kLKHL56a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHepU-0002vJ-TO for patch@linaro.org; Sun, 22 Aug 2021 00:11:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaW-0007vQ-Fh for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:01 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:36786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0000pE-0e for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:00 -0400 Received: by mail-pj1-x102d.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so16496065pjr.1 for ; Sat, 21 Aug 2021 20:55:58 -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=HZHOBf2F1kyrH2/d+/Nk4ZDYvJLaqXezPeFn7O5njyk=; b=kLKHL56ap+cW5BlPBR5VOML2MZOE9Unat0vb5GtGkta6Gy0oN6jM0MFj+iN+XvbCbu SHXbrIjrNcBHPj+0h44gTjGAq4aw5UeVoUe2LmBlMnuJDARtyMas5KF/VcgXy+X7mzbw Xa1eN8Q3UDq5MUfRoAZpUQL659CgaqxaSRnMgCzHMUqSHlzd0fHKpmg+Q2F2MvuGKuYA IKvAtAI6TNPMu97d13BTxAteDMklFGkn990z/wy1tGT6RbfntZiepOk+p3uGS2fsHeGX rlxoKlQedZhFwCgvMJ4mhexUXpcF14/J6uCwQDJO6EDYYc1zroiYRVWWmPnGQIkXysK4 j4MA== 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:mime-version:content-transfer-encoding; bh=HZHOBf2F1kyrH2/d+/Nk4ZDYvJLaqXezPeFn7O5njyk=; b=mZXt4Xtzu+lqTvc3YvPRR44iz5Gem8PUuiocopeAgzzJS3C38/TSQpya3CeK343n9+ +1OLMuKCcGbe8kdDRrTyyS28AtG/DR4lJXjuSbR7QHNqHUTW+L/cMHeC9cUQJD/ieZOg JDwedHAqehReuTzjrwpTHzooWcsecikUGMBjL30OgRVcGbewWgjx/YqnXVjhXk0BK5wf v+XNqTwIUMwQQVNCR8vtZ1QV7qwZ6ICidi1b21fK9VjuMT1zmRqhGxAd0Ig8OyVTXf3Y p5mXNmfUqBFtzSGO6bU4jryekqWcBtEl3RuKJN2wEnFwboI9U1E0n2vgxTBJIDeQgeGZ lqSw== X-Gm-Message-State: AOAM5312oXQ+PawWcsAE4jCr5yYccjXXTrmdnMMOIAC9GqMLJxRTqPSM Sv02etM/3EfKFk+Bh/8czMWsbjHbidv2Aw== X-Received: by 2002:a17:90b:14d5:: with SMTP id jz21mr2973552pjb.11.1629604557758; Sat, 21 Aug 2021 20:55:57 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 29/30] linux-user/sparc: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:36 -0700 Message-Id: <20210822035537.283193-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 38 +++++++------------------------------ 1 file changed, 7 insertions(+), 31 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 02532f198d..20fca9f9f3 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -21,6 +21,7 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" #define SPARC64_STACK_BIAS 2047 @@ -153,7 +154,6 @@ void cpu_loop (CPUSPARCState *env) CPUState *cs = env_cpu(env); int trapnr; abi_long ret; - target_siginfo_t info; while (1) { cpu_exec_start(cs); @@ -219,14 +219,7 @@ void cpu_loop (CPUSPARCState *env) break; case TT_TFAULT: case TT_DFAULT: - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->mmuregs[4]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + force_sigsegv_for_addr(env->mmuregs[4]); break; #else case TT_SPILL: /* window overflow */ @@ -236,18 +229,10 @@ void cpu_loop (CPUSPARCState *env) restore_window(env); break; case TT_TFAULT: + force_sigsegv_for_addr(cpu_tsptr(env)->tpc); + break; case TT_DFAULT: - { - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - if (trapnr == TT_DFAULT) - info._sifields._sigfault._addr = env->dmmu.mmuregs[4]; - else - info._sifields._sigfault._addr = cpu_tsptr(env)->tpc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + force_sigsegv_for_addr(env->dmmu.mmuregs[4]); break; #ifndef TARGET_ABI32 case 0x16e: @@ -264,19 +249,10 @@ void cpu_loop (CPUSPARCState *env) /* just indicate that signals should be handled asap */ break; case TT_ILL_INSN: - { - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - } + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Aug 22 03:55:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501421 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1067487jab; Sat, 21 Aug 2021 21:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd18nNw+xnY8EXNDk+5P8WmIpePnkmgyZn3Q34ZJeBV2+My0ZKyMB3SGSd4IAhPbI0/JYB X-Received: by 2002:a25:7806:: with SMTP id t6mr35816660ybc.132.1629605859805; Sat, 21 Aug 2021 21:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605859; cv=none; d=google.com; s=arc-20160816; b=b9AjY6I+QXjnmEokyG726kudD1Rr1jIJDd3JkLdAHfQyi/FeGfrKwLGif/1erxHorm KBt49VI3yaYg2gjXXfEZWRlYT8VqCMjJEJcj58BnGvuPcbnizMDYHALgg/d0zJozazGP 4j8x8ClauOYpGNoAwgPHfjFVsDcycYwKEKSnPrDr0Oiu/6FcA5ct8xffskf51ym4zLW2 RViXbYAEzyunKuxISFrEOGOr2HKnaI5sThI2OMw0Mc9fAmORFOcqEET0r1eisGbk1pRI vP8m/vpq7YI8KIrEkBCdj5F5ysTqLixYVBkRx5SHRWZx4ewdbd/KX1+Bm/w4OcaL+J5A Ogow== 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=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=VPMj3feCGZvoWop3Fd06h25v1NkprsKxK0EWUe0oNQmUBT7aSjrbFtLj73pdG8sJtA zJwz54gV3rR9uW7qGZpW5Mla3gZ1G4W+OKtkSrszB96bGsuCaMRdGOMbcK1agycgk3Zn BwhyGIoUpB9kIn3oHIkbu6sNV77nCwmn1gbcBe1D7Pvgr327sRUDqaWjPJq1ZxCwBALx Me0QqWJ0se4tOGjFXHX3erpvQK+xfK8Au5S9vtZlwdk2tm79y9oPGbhLHXgfvl2CaR8I 2dyvxHts8SCuGMnpn4ual1fQ2RqFO8KL21ZnMo8CONw8iSuahv30ehqKhEHSDAEVbm2m KrqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yw88Rh1d; 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=pass (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 q129si10994576ybc.242.2021.08.21.21.17.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:17:39 -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=pass header.i=@linaro.org header.s=google header.b=Yw88Rh1d; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHevT-0004Le-9Z for patch@linaro.org; Sun, 22 Aug 2021 00:17:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaX-0007vR-42 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:02 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:36712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0000pW-Kh for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:00 -0400 Received: by mail-pg1-x535.google.com with SMTP id t1so13339285pgv.3 for ; Sat, 21 Aug 2021 20:55:59 -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=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=Yw88Rh1dIc1WlEzidobtk/THqqQiOTwl6pdI2/Hfhmf6sVvIlJS2w8NeeUOmewmWnI iqRQ14ZziL96vLYn8T1pBHHtbd8ZbTuUykza+iPvG6k6DJzNjdCUkLZmWnlNPxNwltXm K5GcWrBdLSOZus93KGMn7erJFdJuVWFq7GFsgewvZe4euVVw1gtzLqwZ60bsXhBkIStX 081YEB/u6WJHauTMzUgN6nfhhHZvQAu1Tg0Q6o1xic/8EWdaDQKie0aIgwNAdED1GdGD a90Jq5tiZFpCjO4At0wRzOFJtegplsa00xxMdI3NkDZm8KWXdEUXt+VKkjx0JVrn0rou XZQg== 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:mime-version:content-transfer-encoding; bh=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=NTAHyL2h3IYFjjOEOM4OIhThLos2Kmdr3s8C8Ug00JynBQnPrgxAFbB2/nKhrY2Ywx FmGLtGIUTBiqIzd2+Hat606NASMNs7NyM3tBCJ3wF6Q38vucqv0mMzbnUayzzhaNoLGT yNkwRdilbnivq4ltDdbhdPJYEqlbdEv89xQFUmxhbqfLlFWv3P/Fy1Lb9vEVKJHY88HP uZG6ID/T0DBeRudic5bO7qoQ3fv3cuEnMvj/uYNiAXi5+bjdt6P3n03iiuDbM024KGfP UdP/jQ342BFXKVeK7ZFbddSSYFtCB7J0xGvDBRnDiyabk+/+FDB8gp43pH7bNd31Yhkk EFzg== X-Gm-Message-State: AOAM5305yuWKh5aAADJDLs6+QdXoqjhUD1mVaULZVxYD83nISXgw5kyJ Zhm7mwhFoO8ylJw/QkNEpzwXCjF3CYyCwg== X-Received: by 2002:a63:1a46:: with SMTP id a6mr25749522pgm.226.1629604558362; Sat, 21 Aug 2021 20:55:58 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 30/30] linux-user/xtensa: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:37 -0700 Message-Id: <20210822035537.283193-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/xtensa/cpu_loop.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 64831c9199..869a8501b8 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + static void xtensa_rfw(CPUXtensaState *env) { @@ -124,7 +126,6 @@ static void xtensa_underflow12(CPUXtensaState *env) void cpu_loop(CPUXtensaState *env) { CPUState *cs = env_cpu(env); - target_siginfo_t info; abi_ulong ret; int trapnr; @@ -161,14 +162,12 @@ void cpu_loop(CPUXtensaState *env) case EXC_USER: switch (env->sregs[EXCCAUSE]) { case ILLEGAL_INSTRUCTION_CAUSE: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, + env->sregs[EPC1]); + break; case PRIVILEGED_CAUSE: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = - env->sregs[EXCCAUSE] == ILLEGAL_INSTRUCTION_CAUSE ? - TARGET_ILL_ILLOPC : TARGET_ILL_PRVOPC; - info._sifields._sigfault._addr = env->sregs[EPC1]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, + env->sregs[EPC1]); break; case SYSCALL_CAUSE: @@ -217,20 +216,13 @@ void cpu_loop(CPUXtensaState *env) break; case INTEGER_DIVIDE_BY_ZERO_CAUSE: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_INTDIV; - info._sifields._sigfault._addr = env->sregs[EPC1]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, + env->sregs[EPC1]); break; case LOAD_PROHIBITED_CAUSE: case STORE_PROHIBITED_CAUSE: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - info._sifields._sigfault._addr = env->sregs[EXCVADDR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->sregs[EXCVADDR]); break; default: @@ -239,10 +231,8 @@ void cpu_loop(CPUXtensaState *env) } break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, + env->sregs[EPC1]); break; case EXC_DEBUG: default: