From patchwork Sun Sep 19 01:56:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514260 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp886159jao; Sat, 18 Sep 2021 18:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylGyFFifTRRh/chBDahg7WoHmT3Z4akS7u/RJ5CeShTbilEIuu8jaWi5IymMJtfvXaAh7o X-Received: by 2002:a05:620a:448a:: with SMTP id x10mr16912776qkp.375.1632016718525; Sat, 18 Sep 2021 18:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016718; cv=none; d=google.com; s=arc-20160816; b=Q8b47rPDi1YSlFjOlz/ZzVj8VtOBq+aDqcQ/fiDLRxyEWYoD4RKDJRT1MrcU09efBC gWhpxEs43XgQVbqXir85/rhqoVX0Fmow10WkRniR2Cc65TwNMGwFHnLlbqImH64Ung0t 2CGSvkWNmpQLw/Adj/E5xOZTjRgOkmEkPVolixefDaMxyGW8DeTl1YJRDSsGpB0otzlk WIuxh39iCySdo4DASvLFZ3ZZybNwhm8Y1XL1ngWIFexXe0GWs3VgAlLGBsbFcMztaA0l HEaqVfJVEB5VPzfYRTBjo9L0C/Yf/kod/juDatwOX7gshfrZCotHUq9X7u+z0rhFtp1Z L8hw== 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=o6Hf/IY/vJ35E8PiMJhFbXdGAn8scusvheKmrhVpZJ42P3wm2aXSWO+HZww3Et6dNL VbPMjc2EZ3KgXiahiTXRFPLe16b/P++0CuKcD7y+MJflg4Xx+ZMUHlRVJGTnZ1m7yCV/ eS+BlC087wM0xCNFlz75yC9IAxIMDTTQBjv+PtVocE7r+A71GHkrxCTHNwKmVV6XKlEh SE0PmCCU090qmOH4St70juBghiv0B86/wILcshDz0V3HWyrbT2WIzAfo5Jri3MXSH12p EAFUrTPQvm7Go91aSwC6YUlFRSD41xCpQ+e2Y5vKbbH6edSAQ8MWmM4ncb9pYwVp5iKL b2tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JZ23efcz; 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=fail (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 k13si3256343qvm.78.2021.09.18.18.58.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 18:58:38 -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=fail header.i=@linaro.org header.s=google header.b=JZ23efcz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm6H-0003Qy-Uk for patch@linaro.org; Sat, 18 Sep 2021 21:58:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm56-0003QQ-MA for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:24 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:38907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm54-00052E-4O for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:24 -0400 Received: by mail-pg1-x532.google.com with SMTP id w8so13741935pgf.5 for ; Sat, 18 Sep 2021 18:57:21 -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=JZ23efczLLbRsKzzdnBzenJ9BsCQxMkgims96ExMd9mCZ4hiw0+bsUAP+DhLeK0I4Y ULAKy9cuhRfNswr5yKiCPBZQaaE8dM8qz/u0lRiMe9rAF6b6lINg2M6CV//lwvKOsqzq j9GFcmPDEup7Ji4eSCtL6QHusnv5AvtiUZMGvmc0oYyvxR4wXFe7eRGvtPEM0CTUe/Te N2uOlZetBmaGPjZPD0zL9AXi02jM+KgaJAktMgDITDEFk0rutO/C+SKUkf/mXHBoxCmo 6C/GfU/0Mtd1rnV7MFcml6qxq8UYw1II74XAfd08p4ROurwuvDQIffoWPwNTNrTCzwEH OQpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=8Bo+JlEEAv6VDxeprikpkZH8+FgS3cl1NNvIOe+8TSaz08qMaVNBdbYlrVoWjSlls7 6ETeArl2+WnBNFf+Zk7sa7QZNL0qC2CqRTwNHX6Ks9MMg9wNMDIZgURWMNZV7mChDL54 eg/gej5RbabAQ9NMi/eu2BttN6JMe7iNeq5iUo5uFswFOYdpRTsMYHKeVKq850Mv917c Eq+Djh2qXfaoCmLC5ttxqRgXlNoUnGI8eMZnX9zUioeBOAqEFkQmmx1bJ3xj6UuEeRA/ dLCqMjI92ULe+JjWYkD7jUsVrydRw1iiYUuZ/pUgihznV8jOjaW/P/d6J5T/qBwrhnRe 6RHw== X-Gm-Message-State: AOAM5306u5lM2dwq85+WUqvSBKmmeKDjlxSnITBl90rBj7vx+6S4nFDm a1U/WCvsS44rdHgkDOAB1XRnrhBnTWUMNQ== X-Received: by 2002:a63:df06:: with SMTP id u6mr17430017pgg.148.1632016640747; Sat, 18 Sep 2021 18:57:20 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/25] linux-user/arm: Use force_sig_fault() Date: Sat, 18 Sep 2021 18:56:54 -0700 Message-Id: <20210919015718.466207-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: -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 , 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 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 Sep 19 01:56:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514259 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp886157jao; Sat, 18 Sep 2021 18:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqm+/z5fML2OgnM5GojOZ/8eFKTcph4PbJi6HyoETpF/DSn6XDyMM1OGLh/OpRvJafIYUq X-Received: by 2002:a05:6214:529:: with SMTP id x9mr18608787qvw.17.1632016718493; Sat, 18 Sep 2021 18:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016718; cv=none; d=google.com; s=arc-20160816; b=Xk39v9V200WZdVxZKjJsKLtwXNU8tBgbofQREsbS7dixnhaLeBm9FxPpxAddkH7AAQ 069o7SYp/czqLQfOtwgz2c+vFvBgqxgkCIR6FgwBMiA3lJVKjAZi8AtJOE2WYLYsxu1Z jCIR1Z2KhBzZW7Q3zp6JTK2yusMAjIDVkhP0o1SL+4NHboojya0t2DhPfdgwMVwozIYt Ww0DkNB+z4FgEtpZQy/oampidZadtb8kkUWinjdLl/6Fz98X5l4i+iNNlU5ILCfDAsX/ huFZlL9Bd3tcTs/mejsgK7p698l0j6s4ffgr8yErS8CuAp4JTKtOWQXVfDovULvttq6x zPsw== 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=Ae3mqa2fVVr4C8fWLBBtyNK6cdkG2au5JFIrriXLvBYCf2GO7ZZhXTotKDP0luBrB2 FvUIMnFJtGQgHoikt9vqg9k2nN5itW+wU3vAFQz3BrcLNW1SSZas+TNNMlzwnic8vqgT zbeqOV8+NJZE/PaMSwWtd/k37EfdQM9t58llKdm2DwLxV9aOu6m6hrHgzC8802JgoRmx fibvnwMiHggaPEtlgz1cHAucMumBvcrGLHFq+66QgYW6HX/LF5Vhck64ZWpm0M/0N/rA uE9O0UtPwXdLiHcZBAZwD6q/BahvblbIwC8NgPU1bl38xmPKZWJFI3bzDPMvbrXgI7TV FjyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kqoHgzX0; 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=fail (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 c3si3653633qtc.284.2021.09.18.18.58.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 18:58:38 -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=fail header.i=@linaro.org header.s=google header.b=kqoHgzX0; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm6H-0003VB-Vy for patch@linaro.org; Sat, 18 Sep 2021 21:58:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm57-0003QZ-56 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:25 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:37863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm54-00052u-OM for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:24 -0400 Received: by mail-pf1-x431.google.com with SMTP id j6so12892147pfa.4 for ; Sat, 18 Sep 2021 18:57:22 -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=kqoHgzX0duOzz7KHyxzN7sFE8ey2OCxJE1Cjbmvxsiu+vtU2SKr9sRuug+T5qwBLFJ 56qkKcWGLYvAEHqBn3cqsQk0Kpa5JgfxaSnNlVI2usuPZPk5HNQamyNKa9THejwObVCE ZYLE+HuuTFOOG+L+2BkrXtZZ5rJei9z2hqAQUr/NbrBmNA31BoPpYO/IsvJNZvzHZlxn 1UQ7Ue6LMbxaNS5dxO8pG0OY03ZNJJ8BhEguP7QURxffcFR8y+R6brfR73K4nlyxky32 9pW50G3DwU6NB8KF0QJaUowX0pVzAdyR0KJZQFgDB+Mrzn/M+EfttzZXm3yHg9Q6DCOY SVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=mdVOZM/ZqedGDynYgEOcV07oLuWDdymWXVtfAJnczE3ZvNMqRewS9B/elXHgTdGI8M nVCGlH03H/C5tqIMJyii5lxxcH+KNbjJ2A5te/JUDWyGoeWLCYRAs9EED0i5DMEHblrI A5e76o0oJE1EfJlwBKjOBBdXDdqppwXxHs10p2C3MWX7i6+zKKiXccxNyNghHPjdQi8E IY0VzbLEXbkSektYLqqFiAEQ4U54KNppJv5MV5hKY2J06HJBbbKH3ltnRBNdLmPq5Tmk 9KcqGMii3+G/sTsMf6lYBKrvoqkmgMhAzOaTk40wLsHwRqk5d3956hkIvD7WF7b69lU2 4uqg== X-Gm-Message-State: AOAM530HFB/iTclPsUnHHxXOaMQ+sSoZNZ3oO2MnyMcfH1Dq9E6DwApI DbYp2D2dcZ1gc3Vx1lYkUe7U6hy/fu6qjA== X-Received: by 2002:a63:d80c:: with SMTP id b12mr17121823pgh.331.1632016641460; Sat, 18 Sep 2021 18:57:21 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/25] linux-user/aarch64: Use force_sig_fault() Date: Sat, 18 Sep 2021 18:56:55 -0700 Message-Id: <20210919015718.466207-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 , 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 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 Sep 19 01:56:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514263 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp887301jao; Sat, 18 Sep 2021 19:00:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiCdm51f38h1KwAFHt8B+cdxHXpEPKea6xV17n8sPuUoYooD7EEl1Bx2wWGnaNBM0ExCib X-Received: by 2002:a25:b904:: with SMTP id x4mr21558152ybj.48.1632016852318; Sat, 18 Sep 2021 19:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016852; cv=none; d=google.com; s=arc-20160816; b=Qp+kfLxbvXrFO5azf+xwiju38l4LrT2PWREmPkQzNMZJvfegF0M7TJnx6p9B042VYd SMXi+1jdz2IQB3+5MSAwxmyBpzp69eGKUotlDvIZFjskjDi2juiquQYjoH+eGSFDMJrz n4ZiMui5pEhqY7RVSt/ZHFeTDcUuKdIyX1YL4F7kTw9qkYL935wHGcBJtnGHeCGG8G0W S1jC09xGxSRm6FWZnPX9D5edpTNgLJ7A3NLU/7dIY8/nCIsQPEZmMq373fs4l4NCAJNi UQR1fDFYoajAE2CCuzfjH7WU8TsLrvQaESdsg73xjPL21l992tJP/eB0An6b+C4Myfh6 2igQ== 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=foCZWrUsQHO9wt/Wun6aL9Kw7r/rWCCyU6/PbRx5aZE=; b=hxHG5Fvo2hWdD2o0/M34GphfIHQHgxU9VobG5ZZtPm2rha4Tq6NePlcTyZy/C/VVi+ bSKn+tAhLRZbA10j/h+ZQiVcMb5aGkdaOEfT3Wnq6mHMoF89PRZlXdZ2qvfPg9K8E/kI Rmt9CeYFNADg5TQnawVvmpTm3tFTBxpo2Pcs5qWxexn5FYChX+1/YxvGCEQTk7Oo9Sep orqUnvAXQdY1NPHXahsjPBWdhk0PkdMPIrLJfqAlPzWIyjCbsJBfBelSw4uGDjzI9z+H pWKsZJjQ6w+ezKjAltTZjdu2oZhuY/peZ8z9F/GgA2X20SuIku8uBCgZKxcu5jqsnhLb dfyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SLKfqUVj; 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 m126si14126133yba.154.2021.09.18.19.00.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:00: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=SLKfqUVj; 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]:40798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm8R-0000jp-P2 for patch@linaro.org; Sat, 18 Sep 2021 22:00:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm57-0003Qa-5J for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:25 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:33723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm55-00053Z-Fu for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:24 -0400 Received: by mail-pf1-x430.google.com with SMTP id s16so4622547pfk.0 for ; Sat, 18 Sep 2021 18:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=foCZWrUsQHO9wt/Wun6aL9Kw7r/rWCCyU6/PbRx5aZE=; b=SLKfqUVjJOrphPzYq2EzFXmSa0614OpsRzfpbn0wOmZd6R6qzvwYqxqd2eYyqXFjut D5z3/gfgn1pk425V1QxdZZvXUx1mScjIDothcLRzTdRNyxX70TmQea5rjsySQJ7Ulek8 OLvxBhzVajgVXT5S2Fhl5pDzAei7HcXVhDDgOntguJ/P9ET4Kk8xDKirWH+MoSq7vQXB tIeRxSv94UURLZG+p3NLfwyBIjndJ/mjzzqFL52H4FAtQyhxgYz6P6/vVb+LbOOeefy2 3sSMXzBBXG8ygOQfLn+ApctEpNZRrYcwM860JFtzzXCF1/bh69dOu9UjbREyLaLiIeHv bqrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=foCZWrUsQHO9wt/Wun6aL9Kw7r/rWCCyU6/PbRx5aZE=; b=Wrcx+MpgZ5BdE4eT6Bs4C3b3sY9IPwp8vyXqfvdzubzjVnBNPpK0ok/7fBIHqD2pvU 4IlKIIOIoicn1fdr3O9XAImXaxuxbG7jBy6+GVfv0KAE91AugXyIyBzRIrGYg/Jv/9Zk r/V4mUOncYD7Wd/5Zn4YSRQ5r0A8G3SrEJA7Po7YzTcciUGdKIH0TCAtYcsee5oilgtJ aLVRV7v7Ondm4TXdjHcdLhgmaxxCydXzvWdVJ1aDJTN/sIME13ZUaudb1ZXr/VPLOkOg fRw8mvGx4g43HW79uqp/UWbAn6RiiYcdvfDknSVMJHirZ/Y30XqJcatyC3N1xEBpPGAT G52Q== X-Gm-Message-State: AOAM533voRPqe/tLPvluXovUStVl8CnuYguTKd/tLjHD8yd5ed/Hgo0g vAg0jkWeAX1l8l+0qxHVYhjM9717AHhbgw== X-Received: by 2002:a63:4c1f:: with SMTP id z31mr17301752pga.50.1632016642148; Sat, 18 Sep 2021 18:57:22 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/25] linux-user/alpha: Set TRAP_UNK for bugchk and unknown gentrap Date: Sat, 18 Sep 2021 18:56:56 -0700 Message-Id: <20210919015718.466207-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: -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: 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 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 60b650a827..13ba9bc1d4 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -91,7 +91,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; @@ -160,7 +160,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 Sep 19 01:56:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514261 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp886164jao; Sat, 18 Sep 2021 18:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYMTtJytC7/IZ26PKi/fpO17UhUIVLPavBMWjZkz/B8QsiqaKGuOOizdbv/sicjk4DRqjk X-Received: by 2002:a0c:aa5c:: with SMTP id e28mr18984586qvb.2.1632016719163; Sat, 18 Sep 2021 18:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016719; cv=none; d=google.com; s=arc-20160816; b=ju3WC7l9syAx8d3w/4akqZTDkFI+cXCdnEZsYDdz6WlT9znQVSLMZsNDKbID7fiw+h jEPotAgYjeazYmleigYnY4QviHFqa7KF1CLK6IEUETc2u8dUjQnYXrvOTqqP+QIv5yae SiHUCfwf5o7agfksl+sAzg6ivV826q/l51gDDaaWPtKC7zQqAvwJMtKORUuaTAjfcY8e cTTAwFfUjEfcr1ewAbsmrJQVjkaYjYWM9cSeDH7tGeJgMPO0mrCdzGuUSK8+yudnoFZF g3TpbcAO7w7tdeATVdTxzwb3KC30ZEXLSK0bOnwuIeMzm42rOMJo9MqAKERYdVJhQ9DX hpow== 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=RYlmbWVY0FQ8woJIB4qREInhH/6MUM19Eu5tv5fgj0s=; b=va6zHrv9pp/VbqOuX8Oocb6ejplBnzKsSFZDCR+Td/p01+nnkj/2CDiewuUhvQ7kM6 3r+FPOhAne16B309V9Q0qGP5jJRiyB5wlWa/e0t8eXc49gHbD7/qgKJcoNVxn/BMrkeE ApW481P/2dBtnOV7i4gvt7FSLCBHrZOQYOc0Gz87iBI/yDt7ZdvLJtIbYw/1EkiyShH2 kBBfs6wEpUGjdgO1/XEAvIC8/FKuVj5P0GkUrmUZGIao7WTRbok1g8NyHzsRFxOZtTo4 tq3k0TCk0i3OSpQG2ACwZ/AZ2BuxiX34RyNQAnRhpsHkSU+iRQ/RP975CkM/5RQs2jLR OfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rvj0cGCp; 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 g10si3704719qko.380.2021.09.18.18.58.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 18:58: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=Rvj0cGCp; 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]:60460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm6I-0003Un-M5 for patch@linaro.org; Sat, 18 Sep 2021 21:58:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm58-0003Qr-0t for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:26 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:40683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm56-00054H-Aq for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:25 -0400 Received: by mail-pf1-x436.google.com with SMTP id y8so12842888pfa.7 for ; Sat, 18 Sep 2021 18:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RYlmbWVY0FQ8woJIB4qREInhH/6MUM19Eu5tv5fgj0s=; b=Rvj0cGCpV5kUfAmX4FzEIkonP3is5fEac7Z0WuAdN6cs8FdsY0isCPR5+nfa6Pez/W a9WMeYJYhAqXQSOuWDo4dU98lRmIq6f7cmDUYsMc/Uk5ohBhU3moSxZF1vSIwuWzokmx l0AcLuw+7cAZNLGlQiK5P1RSMRvp2ij6DYqWG2tjCeLR+/9POfTFYpqQeMF/UrXO7jVN 1bQhqIPAnj/II2QnK39Mg9hO8QKnevBVAeUtwgwAHxqKpp4BXQifuhQiPcmDqu87VKEA 4zR3QQase1ZHcOrwOAGIBlc12ac1mLPvzdqNtjtLLfW3wsJ8MCTJEpT0j3GpGilHHhwM VmLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RYlmbWVY0FQ8woJIB4qREInhH/6MUM19Eu5tv5fgj0s=; b=NdmKPmyLUZ2rMcSW+gBCy/p+g9hSUkNkeWFXcEjgQPH4rJb4bu2Cl3xcj/w0IdUA2k doQ3goc0q3URgD4FeNKy8Kk6udw+CrIgdjkNayD2XwOcyCR6CDQQrbpl9Hq7iUjLm9Ik +OPoD+crO1lTusJuLVaB7m2SGZJF8Nmws3QTZfhPF5kK0QeAa9Ta0UxX6SEMZWu7DIxS TWrpAKFQqcAoL32rZfUU6yrxq+YRj8EI9qfqhHPVwJbjGRWyBt78wphKpZc6F+5rnHwy x7xMziWlBZHLPHWpiliKOXqxEULQPVBJWNV7/VCQYAzRNlCWWHCMRDOcIYcggJyI/LbO 8/Gw== X-Gm-Message-State: AOAM531GXl5RM5k/FvUSfeTMYIeIgPk4Xc6waptp0qeLHMChIftE2T9Z UjIokoGtD6JSZ3LN6YKmV6yy315ugel6fQ== X-Received: by 2002:a65:508a:: with SMTP id r10mr17152551pgp.96.1632016643060; Sat, 18 Sep 2021 18:57:23 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/25] linux-user/alpha: Set FPE_FLTUNK for gentrap ROPRAND Date: Sat, 18 Sep 2021 18:56:57 -0700 Message-Id: <20210919015718.466207-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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 diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 13ba9bc1d4..18698d9515 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -156,7 +156,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 Sep 19 01:56:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514262 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp887295jao; Sat, 18 Sep 2021 19:00:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Bhnlr0j5pzl8elp/dvHtS0QnyXXsZSQXaV+UC4xR2aSdxww2iQO/YVeDdrBtIaUiblPt X-Received: by 2002:a5b:f43:: with SMTP id y3mr23162586ybr.45.1632016851798; Sat, 18 Sep 2021 19:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016851; cv=none; d=google.com; s=arc-20160816; b=WV6p19gRWCIuwb6Bx7J16S7j2v4yl6+YmARuubEnBDmXRSw0h2g/xjKpOuZnrenP0F 8sVmZRoijm794XL2P6fWAV2UpM89bFe/gFyWQbxRGYHPDccrDIMUiLklXwBXESJnEcpw v2hwNkR41WEkoZ2bpNyNKWwtjDU0iLp6SW0m2//FFBDZiO2JDIPE/5iH8w3aevqOSSbS E0y8HzNw59LIV8ekpjp/bVvXSEYTa8JWBWSFWLCCe2XYPQeQ74RPm5YcH1vxj6of8cwz Xvc2/wEYT6ltUzlMzlFhjglg0mLnznuwOsCk/geV0fB30D8LLzhhx07OZHxiVWM9zk3L y31w== 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=DP6CysYqyI4zUx+NQSroBUcZ3sHISL9BNa/2VuWYkc8=; b=eLY8qDElaqxR575s2/Y2m3OCrI3F4/6P9sZJJ1aA5lFCt59JtFJjTLk3muSgUA26JJ fRBsmWUcJTGyJGJD3doNUVakm5DfzgdPsq6HjOksBZFyN/QCgcMvFbP2B2jjEdRxkBIP /aS9u399sfU+CEyNROC/K+ZCA5R/rVIwu0+uKR8P1WJ0UQPGDZX+KJFW9SjwsNsVtM5Q Ouwrkm0urBczD1VK/1XvriM87K49vZzkfw6wL88F8OxdlAqFcZW/YuAQCe0U7vyuOeN9 08a4uqhZD4UUE6676nGSki9lfsliKnvQg0XVG1xUspBYg0a86W4uFYQ67Sy1cxVStRBd VfnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rku6lImT; 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 190si10003278ybe.29.2021.09.18.19.00.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:00:51 -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=rku6lImT; 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]:40762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm8R-0000iS-6l for patch@linaro.org; Sat, 18 Sep 2021 22:00:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm58-0003Tu-Rp for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:26 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:39731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm57-00054l-4q for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:26 -0400 Received: by mail-pl1-x631.google.com with SMTP id c4so8750919pls.6 for ; Sat, 18 Sep 2021 18:57:24 -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=DP6CysYqyI4zUx+NQSroBUcZ3sHISL9BNa/2VuWYkc8=; b=rku6lImTHyJwJ1DRxvU9aEPlmFxfeFgaxBlGADHI+FeW3/Rtlyfqu12jiBg2Uo6vp3 iBad4LzyBMdgB09u0rAT6yy9DLalsQ5nUk42s84O5+LJ9ChszaiKQeyjBzGt9cumrtDx K8sqgvqoUsRsaDCg6YAhMWQEqqEGcE2XooCQR4cGyzDdl1Pqx/+DinoT4UZ1vo4+hiAX cVOurimqyuRQuJT7W3Iw2rC3KY6J0EqlOIcnOlvZByfgq5MstA3qdpa3mEVF514Drt0D 9+RE2+xGYompwN+dnBavpdUTpcS57u0rLWAMRQW1vzAVqRHubQBrZuIRjCxfZLi0fPSQ SMDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DP6CysYqyI4zUx+NQSroBUcZ3sHISL9BNa/2VuWYkc8=; b=mm+WcV9IcdecQIYnQ1Ar6sMkeX2/yMtdhGT97fE3VA2EDck84BsjpghEvyX0eh8DyN Gzv9h0faKJk9ZlSakm250k0XwH74V8FOrpqXcnI/s/aPaVvjIx96plCHmeP3L+yh6foJ qA8A4Dkc/trwdpSctnq8EE5w2I/GFVUrRNkPMWSVpvFmNYS+mwmusHFwWSfGBHcSLSjv mdxHISasVkYAG3Dg5LnbjTwYqjDlUXPULQBrgE+kQtrb3fBeKMhUm5SArtQ210FeE6yu l07oUTWLDo0IONgncynkcrBTqT2eDKokGTjTScAU/sjvHKI0EaO/FxqmBYwQQr9nH4L9 5o3A== X-Gm-Message-State: AOAM533hNo/zUIhF0XTOX/9vckiGf5amNRgvP8E/Gln3vojEY7SonHRf RM9FTfAxmlcQMDW1b1aq3DspXXaqIrqaWg== X-Received: by 2002:a17:90a:5889:: with SMTP id j9mr29702057pji.91.1632016643852; Sat, 18 Sep 2021 18:57:23 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/25] linux-user/alpha: Use force_sig_fault Date: Sat, 18 Sep 2021 18:56:58 -0700 Message-Id: <20210919015718.466207-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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: 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. Signed-off-by: Richard Henderson --- linux-user/alpha/cpu_loop.c | 69 ++++++++++++------------------------- 1 file changed, 22 insertions(+), 47 deletions(-) -- 2.25.1 diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 18698d9515..09455eff2e 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,26 +54,14 @@ void cpu_loop(CPUAlphaState *env) exit(EXIT_FAILURE); 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. */ @@ -81,20 +70,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]; @@ -135,47 +114,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 Sep 19 01:56:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514269 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp890111jao; Sat, 18 Sep 2021 19:05:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5zjQC2LwR0tmAU0pODuHiCIxUz+hEdSduvi3BxkRrGEiHMf0GygbMN+eUbFOPWHraxAty X-Received: by 2002:a25:c006:: with SMTP id c6mr22989501ybf.480.1632017147020; Sat, 18 Sep 2021 19:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017147; cv=none; d=google.com; s=arc-20160816; b=QFir+/uMZwrUBdVJCofsC/oFXZrxlg1PFP5WaUAMXATgbOphKoZYA5ToEAZRChKqqw qGHleCzI3Su28JkZbH1MNG1/GKMndMXXG9EuGqYE0EqcSlZArpHIPdlSuM/Lx0dz1RhW dJvaykxH+QH0g4f6ZDiT0/s8PAqGW4bvdzyneMa9Z10YzGxuimTAWY2Dt3hKDWCv+s8D MOgue2X+g6VXi/q90fWpDdioeMDhpoTTdbXYwbqYCNY/QRnmRCOsst1lNJCJDUPenxjT JKhU3zyRJWKNCzyLSgthCzubjFcCjgEzdjm31pX8VI6gaZmQ2AW3+RPA6bbBYWtoLy6q rFEg== 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=3SZ58DDfHZ5NNXCzTxtVZbw/RUMu4SwftmLpbsv8pkQ=; b=h2Jx9+M8U2LVzrFj1MDBa40y3DK/iFidMxE1thGQAuEX/Go8XU4xRiQCbmu/tAxfxl jygIPr0M876SGxoDAmxGuSaA8QSIPBhuEdwiv/+G8efDW1m+eH67TKLhk8Iz5D51CWs8 3Shibdep2uXIwXJhBx34ki+P7TaKvcqv1vRdn+B1+DC3boUmt5cM9ew549QMNYbLu/PY td05A9hi+zEH+7E6Wkp1B9zKXo/R4ZB04eJBibVQ3xxU2nhOq8gxsIbq72ZCuEMIBP6s A6nTI+rZGm0o88LIyUoZ+Ys+rzqEY2a+J+pukNxibsXGch8dgooBJQzkxVSpp4/QhR1A EPiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aEuTfyci; 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 s81si11346942ybc.31.2021.09.18.19.05.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:05: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=aEuTfyci; 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]:52410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmDC-00007h-G3 for patch@linaro.org; Sat, 18 Sep 2021 22:05:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm59-0003Xt-Rw for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:27 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:37822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm58-000560-AP for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:27 -0400 Received: by mail-pl1-x635.google.com with SMTP id j14so1626709plx.4 for ; Sat, 18 Sep 2021 18:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3SZ58DDfHZ5NNXCzTxtVZbw/RUMu4SwftmLpbsv8pkQ=; b=aEuTfyci7/UoN7FPDosaXzSP6R1w/H9B7btpmUNwhyZGfYUOeqdK9n2cyKt34eLlFj xN3ANgRPUtm4e1SGqa/PqN6iVOfpxZBdzj2C2w3kMva13a41XxbsAHp4IgoZKJfDegsv MfktS+bUixfiZlUYsDDWRiVC8PNlsEFQQDH+1n2AsK5YkaPuedvGlLfILTQfmbkZnvaV qHZbiNCXCQfEv+OF8N17QdpF9dW6YB5xlecsrOQf2scXwF8eDPYcAgtjkTqBKjyqaB6w gEI2okdHysBHm/vY+EyG3so6eXE+pj3/bgY5Yrnb9XkFVs9CBUlGGU/jeebc+0LuwMRl helw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3SZ58DDfHZ5NNXCzTxtVZbw/RUMu4SwftmLpbsv8pkQ=; b=aySKzXctoAJqfIHRSgndmBsRitHVyvHSw9EN0m1a1xzS74/YkmJPKnDlpWOC4d0iQt eplj4WyTAQWUOLzTCDTSBNaPOYjDRhcHCVRORJ/oIVer0ZP8OFXWnQR9Y612zbLLe5xS jmMoOlRMob0Qmy5nGVwhupTQfdzi+pgv0rj2T2i6HB1w23jAerATDQYOuPiHhTR4y/J5 o4kNk0AY+x5Fn7AC/rlUnPpHW4MOr5/0XTKR0mGtYlXteUqAkhoz1F9gRMthbkh/RDYp DCHSIvngdzSUfV0dxGzz+L6ZDX6m0IQE79KmRvC9OfxQ1Qt8gMuxxgv//lkmm97hrH0F haGQ== X-Gm-Message-State: AOAM533m+aeQsRGCZUmtR1Z4DiCAOXYQ3iJG9/8HtJS9CAJHf8PhK7CZ XC8UNZXDpB4iI7+R4WDTdMoQNdCktk78ww== X-Received: by 2002:a17:90a:311:: with SMTP id 17mr29950310pje.121.1632016644687; Sat, 18 Sep 2021 18:57:24 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/25] linux-user/cris: Use force_sig_fault Date: Sat, 18 Sep 2021 18:56:59 -0700 Message-Id: <20210919015718.466207-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/cris/cpu_loop.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) -- 2.25.1 diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 0de941c0b4..2637c19a46 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,8 +36,8 @@ void cpu_loop(CPUCRISState *env) switch (trapnr) { 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], @@ -55,10 +55,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 Sep 19 01:57:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514273 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp891524jao; Sat, 18 Sep 2021 19:08:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEWIdZBfmmIHhLZMOfKIjnZ3UgPbe7q2nay1SSMXls7cq1bU2qqetdPNzyb+QHgHGFzPWS X-Received: by 2002:a37:d4f:: with SMTP id 76mr4367047qkn.385.1632017322300; Sat, 18 Sep 2021 19:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017322; cv=none; d=google.com; s=arc-20160816; b=KuxGLZzTL1xZdDrBSkMYYZVnMJggtlFQaNKgwurCdijHiXRot6VynhqRfzLWAQpArk W2StqqF1vPqAIdqMQtzltcF6kW9hbW1F6vu5SeZR+l1hn6kXAb7kyc21WxmCxsMrFnf5 PXw5u5KbDruEiy5HLAXh13e2sknhT8XmgHAQqBLl5MdhUbabXqeav03Iq43alwI2WwbI nmJBH6C8udD3F1bkOXuXmVf1+thtQA7x0RqMJkPtUWZ0Nas9SPObXUHntOoPsp9rXp9E uZCzwDYEqXeM9+KZJ70LiSxOwRk5KhPwi9VEHoNWUJkeB8NSzT128UCrNOETvdoeQ0qf upyA== 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=YhmimCfw8NlAnwYZtRGPVFLDovkTiGEy8ba0NCac4JA=; b=Qf4UWzidsx4leRG2CrTONR2Pkw5aGB9aZTcfCvjK19DoTZax6igS0aS1KOkNKeFxOI FuBCv7HXxAOVwhV3/aQ5ErKdQwahpKJEEN4/wGwIo6S/AT7ZTBQUdglQ2OAUhVRsWh+n W3tdrAZTjDg3eyStsd16Sy+aq2Ouxp1eQawiQioAfMaML6vch9okX8Iv9m0+C9bB9Tp0 4KO/9x8tz4DcSEARt5QZwXbOsbkRqh2Je8BoiBsAw9eU0/Gb4EO/5XYiW9jLbTGS4OZl 7k3185QZ2UR1ZrDHlZTEeApsJ3Ct6ECeKoxOZIDeEuXJ6BtuwTa5oHLC2cUxZcoTF2BX 22lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y0D6QoUB; 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 p1si6106165qkm.112.2021.09.18.19.08.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:08:42 -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=Y0D6QoUB; 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]:60922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmG1-0005oy-RG for patch@linaro.org; Sat, 18 Sep 2021 22:08:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5D-0003dZ-4C for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:31 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:45992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm59-00056k-78 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:29 -0400 Received: by mail-pf1-x42a.google.com with SMTP id w19so12794757pfn.12 for ; Sat, 18 Sep 2021 18:57:26 -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=YhmimCfw8NlAnwYZtRGPVFLDovkTiGEy8ba0NCac4JA=; b=Y0D6QoUBJHbJ5527LbcnNozIWEQenJAQLzZmNvPCTnnUN42RJ4K9lT4wp+VT6qYYWi QpfdGBuM2FNvvFzQFtOOFDb+wYO1EGcM7mJTsWYziMv/XckfbMV4jzDTdXLSo/M2cvs6 n21aQFHjwSfw5qFZbtjtCkPS5tgBm4zyNSNxyd2OiwVx6RKrtZzN22Sr/U6qoftvF6pY DBRs+96EY2A70x/NZVDfLLgXGwpeLVm1PVziszp9vgkf+GhTUhLwmG7f7hQAjPBxIsrZ 6g3dkIoIplBFsFSA+oqsvof+UzdxQW7g170473OdlLL16bNwQ8UHkG5kJLm9/Qm2eNqc R0+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YhmimCfw8NlAnwYZtRGPVFLDovkTiGEy8ba0NCac4JA=; b=kIm98j/KDITysRhAJJxzdbpLy5ycu0yoGuBKCEf7yO5SolV8bv9TZ24DUyNTgYa6z3 F/1LlVcr+TMbTdFNIxClLQ0qHqNkp8QW5TqT1IIMAQAgNs3xA+eEK5Xs4mklUZbNSNIv zYSWvxUCAh+a00nqbphDrVVmRheEZ8/g7+EB/jrDNxG8wA7DR/aGU/H3M/fCXGL9fQAG EOMRcz/E8qSke44ZIVk+xhgCGeMFue5MmKz2QH/wqVyn1J8wtKHV2qBS5SPx3ER9Pzhd MN9RSIZ1lh/rn/GQoUWOsGdqY+KPvE6LxLMiQKJFK3qGEDUb4w0fgfIVyz8OxHaJLDUc mXTA== X-Gm-Message-State: AOAM5339E1bC7zz6D8tVGnl9x4Ar+Sc42q8MJqv2qcXT5TPGT1a5G+Dp 6xToGgXf0iCM5VfeXRWOJzFO9KdRBgPnww== X-Received: by 2002:a62:b515:0:b0:438:42ab:2742 with SMTP id y21-20020a62b515000000b0043842ab2742mr18722679pfe.77.1632016645894; Sat, 18 Sep 2021 18:57:25 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/25] linux-user/hppa: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:00 -0700 Message-Id: <20210919015718.466207-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/hppa/cpu_loop.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index a6122b3594..c01ccbbdc0 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; @@ -143,35 +144,20 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_b = env->gr[31] + 4; 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 Sep 19 01:57:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514264 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp887324jao; Sat, 18 Sep 2021 19:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsmTLRMxhKNKby12Vi36N7lsoV0dUGEkCLMjeE8WUvMBWvk0RXHRYOzDnNLIfLND95gZE0 X-Received: by 2002:a25:67c5:: with SMTP id b188mr6364578ybc.465.1632016853881; Sat, 18 Sep 2021 19:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016853; cv=none; d=google.com; s=arc-20160816; b=Eh/HP/ZP0KFlOta/1+s1BB2IXDsM3d37lavhAZJHKjwbGaqik5n89p9p4cFJ6dYc15 BNxHnoeXrBf4nQmy1S/xVKWBeAeV7Xqxl0yh3ipy4d9wGKqzpv0i6V4ntxohKm6hdzS6 6rj/+MJ6bvWRuIZh2xkxbVd4HWdAavJmiwI4i/ZINJv5gkVt6S8uPK6bI5T3FKd5OAGS 2F6eoAt7bvNRQ/dX9I3HvyTLC0JCvmpV0SXsVS22M4XikrVI7xV8RnTjswuDTu4xV9Ft ekHtHK2LMzBk5v2JzvfgHp4s8GqVvJ60MTXbD0vDSWpfIe7n19Y3rZxMLjx2jLvmqKxZ wCxQ== 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=knwCTwHt8Z3taSHUyiLNVvta8fjC+vg+aD5RA0fP+2w=; b=l/a+bcOiF5MLU1rZTLuuEhpVqt50inbg/ny3RN5Y/MsqyKp3aZ3IX3xmMBwknhuBSL xeWbtWdQCq4Yt2NzjvQAYj1+1wXPYkrlODfz93bgM9ND7YoooK4fwAkg978MWulKq7qL LmhZQUzMIlockAYDoEjxwFCjkDz5kQC5ZIdjWFlWzEUg3z8CBEjGZMWMoAJ3/STW4cyK 20d09Ua+A2vFmQHRC2BkPXI4se0RVlTsv4PLVL0+VahYrX8zHF1pFzy495NXaAgwJBTk FcNs2w1ZyQgE89IsK70rowqyQIyD0UCxkDkphHwxL0NW5Vh4znVrQwI+0zdZWKnk0EIk CkiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gln/hRix"; 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 z2si10595996ybj.69.2021.09.18.19.00.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:00: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="gln/hRix"; 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]:40854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm8T-0000ll-Au for patch@linaro.org; Sat, 18 Sep 2021 22:00:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5D-0003hF-R8 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:31 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:33727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5A-00058C-4s for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:31 -0400 Received: by mail-pf1-x434.google.com with SMTP id s16so4622632pfk.0 for ; Sat, 18 Sep 2021 18:57:27 -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=knwCTwHt8Z3taSHUyiLNVvta8fjC+vg+aD5RA0fP+2w=; b=gln/hRixji2EHSHMm1D1vYlQrqytONndTwuAABs8OCKaFVpEZL+s3fYDrwq3gN/sqC +ggsmL1WvVeLW0fhEU9Cg+plD6h6aryFHHyDfnvdaCv8/kPM05Zd90Uf/Is06POyLWyJ RYUFC2kfZ0zAojr1Edb1VinHyJZaFMgNIoEEu9bdwMHM5tpEzgPcvGPWpgpwG2AkPEi0 rBePpE6UaQVMImsZHp2TnGzePV0DmEz14IscZ3lHZPUrIbxpQdMtxnfCScCbSugF3OtX zCtSTFX8JGj+6VVau7k/3b/biIWNRB1UND2geGTXTQFvv0yOQWiMjAyLtJHcylU+D61C nxVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=knwCTwHt8Z3taSHUyiLNVvta8fjC+vg+aD5RA0fP+2w=; b=ptoL/MFdPCZYv04inXgdgeZQv8FbIry4Fz3i3G1+B1X2JStXFBq0oOuP2fKvU8rxqe ebrgpXNnUTLS4fMhVBJyiOgYqgoQjVMDolMvk8RGOzmnIWNE9HPozcgvKJWfMqmJKwsZ Yy18xQCI0c91s5wpsTxDv0B1RD2SznO6z6TfxZk5KHY4inKgeJzfMaqcFsC70r6y7Ivj Oh0lZCaCgrYm+5N6rK+O7A3CapSn17+cETj61ksHlzdXU8P0f0G7Vn5cJKULfYn3zXwH 03Q3EUFItPcR6hlT8paP9TI1MY97XtimiK1yR9KYn6SMCn1Gglyna/ZbRF/+beZIn6El QVjQ== X-Gm-Message-State: AOAM531krJssK1lTBC5VqWrRXNvRgHHcNgmRzisFTR0zICBWLZJkYY0f 2aM/9ln7uRSft1rc5t2ACfP33ZuJBaROeA== X-Received: by 2002:a63:d456:: with SMTP id i22mr17026444pgj.421.1632016646757; Sat, 18 Sep 2021 18:57:26 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/25] linux-user/hppa: Use the proper si_code for PRIV_OPR, PRIV_REG, OVERFLOW Date: Sat, 18 Sep 2021 18:57:01 -0700 Message-Id: <20210919015718.466207-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: 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 diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index c01ccbbdc0..10487df88c 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -147,11 +147,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 Sep 19 01:57:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514268 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp889624jao; Sat, 18 Sep 2021 19:04:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGl90zUmvvX02Lue2Cf18938xBau3nmov0OMNc7gaGT9OT0mM9gbBrPGu3ksfP1kYblZFC X-Received: by 2002:a5b:43:: with SMTP id e3mr24563982ybp.469.1632017093409; Sat, 18 Sep 2021 19:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017093; cv=none; d=google.com; s=arc-20160816; b=qPILrIzRS8++HDqzhUvs7c5pLpQEXXL0nQT1hbD/i4lfWVmn/+ifVw98irXO9Dldxq czeaIStbqjMQ43utIqJOFT/eSI5ZOnlWeRJbFvpgLlNfy2v051yih0C8sk7pMoleB6N1 Dku/do0JgzbOjYFMw0BuGEXTZYObgy/nJJJHc2wRFJGUmtRbh1l8j84XL5eXdNy3dyxO 7jglcXuVekfmDoiISmCEUD3Tjlg77xCjX6LpZHb9wrh7ERsun4ZoMmCtbq/V1DW3Mirf J7b7ZAhmv58FqorBt+SRhmorK1UVuOP0Ziz5/bevf0xalvHoMW3Ww2RC64GwQ1bPacjw ToQA== 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=lBh6JcQcK8YNqf7QKyfjXqmHzipOIrGfiM0/NJ1jpt4=; b=ikyhwsKT4HvmXISbi2W9/7YPPuNS165HRX5ehrZAOcUJdhu5X9NGjB11kXwtGFS6Yn tc8Lc4xOtqBjpNaa/+kq2pVHKYih63m2SYXno9jtirkHXZfd9uDcI/p6lQeGnw63ZiyR FF4sWF0HubrMHycjBcf4Qxf1yAWntpNL6N/E3Eyew9GG5STUODPIuF2RN1Gd0nvwBRwl BmL5kCO2K/HxtHaODEtCfJGKVIkyAScIjVYYj8Hw+TVWknEC64qiSR+6EfEV3fMRrFF6 3pqsA2TQWPe0fS8AFW3QtdQ3T+R18NnelxCT3Qyl1kOx+ugM4O3aKk3aNsOAl7bxJMXU aSxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZhjRJUYi; 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 r2si10507774ybg.461.2021.09.18.19.04.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:04: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=ZhjRJUYi; 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]:49598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmCK-0006gp-Rg for patch@linaro.org; Sat, 18 Sep 2021 22:04:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5G-0003tK-RL for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:34 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:37838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5B-00058x-TK for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:34 -0400 Received: by mail-pg1-x534.google.com with SMTP id 17so13750166pgp.4 for ; Sat, 18 Sep 2021 18:57:28 -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=lBh6JcQcK8YNqf7QKyfjXqmHzipOIrGfiM0/NJ1jpt4=; b=ZhjRJUYisDODW2KNACVP+JdEhj+jmD8Mr7+MM2UBT/zCgTVA5Rx7cvJMREbCJ0YbFt 4PqRerzFOhRRb0kpomlwj+IP8dTibNNG/AVtowkzEQEp/1HRLQCuV11DztM4dtjCM8lV slqZ35eljBn4uQ3uXCn9R1rLtii7CNDuTGxZTYnywnvfKq41bp+QGs4DcTej4ayY76KC uVtK3QT5EQJiFj/cSZJn3sXWQpzKD4zd4y4OKvllx6JQNghSkKu6kLaQ1UHigXcNz9o9 OhzJl+OJecA6abPakugzWXjK5aRdHf703fa1MfqHQle1cahV0Na5pyVAF1OJtGbVPkUo AuTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lBh6JcQcK8YNqf7QKyfjXqmHzipOIrGfiM0/NJ1jpt4=; b=Rq7Xt2wLnUE3R8KDmKJoIXNpAPx/U8/V+bNUN7jtz4Yahy4TkeGhEnGH1J8HtqRng6 oNPOAqWn/MWQah6ND2GS0gIVBIcPOT3bbP8WIXNXF8c+1+ERh0tXDgC3+GhdZc6sk7Pp 8XSDweDKHwYoaR1vrYdYNspBSOEEY1tluU8LNspUsvQ5AEJriGu81rUXe51cQTl8NdxI RxdLvOhj0s3WuhBvrB2W7pb4eGzlZ1VJPaneZ7aHu89RLgpznDbePoAlHxQvrxNwu1Qv PIYN69FytFVqRB8nby5tARK/U1a2sg4rZtHmV4tGPK9QYq6jbr1u8uEw6Bh3lcILEDUw Ki+g== X-Gm-Message-State: AOAM533lseZGzNAlwV7W6awzgV3IxIqdaB3XRqGu+HRlfbmE/bp9pIbd 7mWwWshfBbRC6TZJ4lnDjzit4ODly2l9Rg== X-Received: by 2002:a63:595:: with SMTP id 143mr17476095pgf.33.1632016647545; Sat, 18 Sep 2021 18:57:27 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 09/25] linux-user/hppa: Set FPE_CONDTRAP for COND Date: Sat, 18 Sep 2021 18:57:02 -0700 Message-Id: <20210919015718.466207-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 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 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 10487df88c..a7177ab54e 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -159,6 +159,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 Sep 19 01:57:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514265 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp887352jao; Sat, 18 Sep 2021 19:00:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYuxXGBziPx8zUf2sIzE4ANlupcdB4jevou5OgEOkB1MTVk881U2KbmNhuCDAwJuQtZoRX X-Received: by 2002:a25:c0c1:: with SMTP id c184mr21650313ybf.382.1632016856072; Sat, 18 Sep 2021 19:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632016856; cv=none; d=google.com; s=arc-20160816; b=bCSRA1B7HC68goYLlSb8A8PQ6KAg/FaGqTpeUOkvp6ZnDTpKXCnlsU/5Cewl41j6Hd 91fuiF8CN+z3o1keL9Tbfe5hVGLh0EazscY4mieydAt3PI3JWs6P/tp21bCZ0hvjT2Yz shx8h20F9O3j8FeblWoShmlykxR3ue7lJk7lhR6yw3/QoveT9sjecBGMGSVnqAb8ZUao 9M77H+VpI1avm9EbBAxFOakfu8+ZuZkHFXLPBitx50fxc1h2dkNFJzijThdBHXH2rfZ6 mI8Dwr4VqAJg4SYwKCVTOfbAJPoUvjjQnbnFKm4Rrd8CMQK+jhkJKTRICjB1D+RAO707 N6eQ== 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=eR/V5kQWNACd19g8jZ1QGUapKI41LQ/gs0dSnKkd30sHhKr74J2rlFC+3sCY8uAj1z aAgfAsPxlHyJWLHJMr7cra+M56OtmmnJ4DAsI71kpG8zaVLx8nflhExM29n5lS6cBmN0 q+LQI4ZvtwxE5XDjKnnlMl+w7G7+37tgUetho31VRx6Jr0v3N+rLFcn7x9rJO1mDe8og dYRztDi3DsEbCzYpwv0ba4ZXTxopu6IVibQpmC5spbKdgga107qEV05rFPTOk5bWEc9N ZsyvJdJjW9Iy5R2/uPSDerufgDFBdt+HojfndFrY/Gpqml8Zo54FXNAB9jv1MAveDeOJ q9tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vuKBItTl; 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 m63si2074104ybf.431.2021.09.18.19.00.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:00:56 -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=vuKBItTl; 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]:40940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRm8U-0000pC-2r for patch@linaro.org; Sat, 18 Sep 2021 22:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5E-0003k1-Fv for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:32 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:46980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5C-00059V-Ux for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:32 -0400 Received: by mail-pg1-x52e.google.com with SMTP id m21so4540596pgu.13 for ; Sat, 18 Sep 2021 18:57:30 -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=vuKBItTl5fRtZomJl4ONFqne/3MYooY0LVMul61wrsf11dGSb+btqHv+pgFrA1dY4M UTi8vLHQzJFmOGtp5twaIqH4dizPIhAMFuDSJHPUWuDHEVeUok5b/VCX/9P/G+juMrIx u10UD9dMfxCxZpUGrxyQ7h02h9Fj4IMVRc+/4DLue6Kf/9urho4Z3KRHPQzzjUQUKIwO Ev213cqrcExpHq7sWhDm6cYnJkJTTJ0XzJ3c0Vw4J8F3ELKRIv6UKPea1a58mM59L9HQ zq2ZnybH7I5D0MjV5r2vRQS56e4sfEAgNCfUDeGD6jhjWuN8tGnFcHLfVJG6ZFXcvEZs vQQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=uG0emNVSMz1aCni/0OLYaVy1mFEwY/LCl+o3hC/rtCmpyRNjwvIFdAFfDfGbIPvWTk SCHX832z0i8l/DCeC8toTjvo6fFmOBRngK5ELYUqS+GTar00aN2T9fG9yyYj6Hen1vut JPu0cH8xkD9EGmkZfKxLXsn46QmDYHj7bBIoQ+zhfgS7mqfsmKMnq0q1TEMQSNaob6Jl yELS3ErSetnEFez7xqdS6GmWK0vZXKnFLrI1SzkGIOpHIaDIzxEB9hFLtUxJkafkjosw lZIZRcKDkv4gIAoLMDOjNYTvI8sgT8AV9oT1zaeb+6gXSujrZzNDDjjGsRWzFWf7xgeB n5cg== X-Gm-Message-State: AOAM5309GrfJNoo4dgpikHib5BWN0odoN6h5iXCEHmNb/8nOjM6yEZUa h5Eek38fK7z0pmGamcO/lWhFEZBgV45AQA== X-Received: by 2002:a62:7f01:0:b0:43c:ecef:98dd with SMTP id a1-20020a627f01000000b0043cecef98ddmr18708951pfd.50.1632016648159; Sat, 18 Sep 2021 18:57:28 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 10/25] linux-user/i386: Split out maybe_handle_vm86_trap Date: Sat, 18 Sep 2021 18:57:03 -0700 Message-Id: <20210919015718.466207-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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: 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 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 Sep 19 01:57:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514267 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp889605jao; Sat, 18 Sep 2021 19:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9yqkAb5MC3o+zecEO40lfKD0JqfTgtCskK6v35T2IQyiykDyi8R6iAdR4/Ekw8LAZhVdR X-Received: by 2002:a25:5556:: with SMTP id j83mr22510369ybb.309.1632017091047; Sat, 18 Sep 2021 19:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017091; cv=none; d=google.com; s=arc-20160816; b=boCDvxQuaRkGL9hFPtfEz8rGLvd1rW0f0FJsiSYJ89FFkZRjh+mL2B6GC44Tkb/L29 AjlP5gaEkZ6yUNXkUQ1/m6KUINT5cJyeHbpequie/TAhF+YMHxuCUefaK35asJevcAbP 4ugNW5RMe9SIGuxol1jkgZdC8MoyCV2nK5seZryCFMnMF2ZF+xnmO1pH+Mhbbe5OVvNL fiHDIbV9D92lNmb9H9N/VP3j+ZOGJbcKmg6Aba5OGjUQEGDNll/x8DAXBIzPvDCcWYRF Gom+Lv9RQLy6FyWQlOFbBmRJ9ipcZa4oW7325ffB3oEGlACeyhZAmr5zvHJvzhFQjQYZ F0UQ== 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=yKwU/najjPLz/Qvjmwc10h7jN4lkN7q52Z9b9OScyO8=; b=pIGoNX2NbBOhOto8b0qZHIYscC6gicax6In1eJ/BTlc6PYGOJ+Jl+JYzG/0WFqtkup DRTdbaSbGMeBwtNm1y6jsAbA3/S239qcbFgZj4BgPEH40JuF6XtWm97RiqKE+F0PWQMk w+IfMEOSFhf+OpuNAnys58DTkUYeaAIaZCdc4B70ZaNQCTek+2k0F+0P3lFtWIysw2c9 eJFcDKHwgL2u6WHLs8DwhcetHH2/Ovp+la1vYGiJvQ9qEzg7W1pKb6U0b5WmPTKGmXj8 3+ucdlnX6V5BvSRTVH+n76qLviZoug/Xi1IxWI4VjhmxCt3Qmkao3fS4peosij+lS5wA xkOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EcgpzpNq; 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 k144si11305862ybf.34.2021.09.18.19.04.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:04:51 -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=EcgpzpNq; 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]:49404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmCI-0006ZE-Fh for patch@linaro.org; Sat, 18 Sep 2021 22:04:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5E-0003ky-O7 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:32 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:35431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5D-0005A5-2c for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:32 -0400 Received: by mail-pg1-x535.google.com with SMTP id e7so13753826pgk.2 for ; Sat, 18 Sep 2021 18:57:30 -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=yKwU/najjPLz/Qvjmwc10h7jN4lkN7q52Z9b9OScyO8=; b=EcgpzpNqNxynH+n4BW0bNwk5LKZY2uP+L12UHowlt7JkG9D8pYM7VkE2A4hSsm38og Rcab7wWhdZ8PtI9RE9M5HRgZiOont4OEhTyQeDYHk4Py1e2xvCD6X+cr/gkmWJTcaV9a c7zA3gdLoPPhMdVjodjsmYwBP/n0g64nq626UIiVeF+hdP2WcLemoQXXgYN713YVo1mP Dix72tVEr2hpP380Uyq7Ws4/AaA0W72BWBPCrFzEvzptwI7obLJGn1S/8jAfX1p7iVs2 EfK6ZLAJPVXBOz4OjkBX14p1TPXR9sjBOHU2WjhyKHRYYGW8XgfoZww/LpiS3UBiGy+h xfEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yKwU/najjPLz/Qvjmwc10h7jN4lkN7q52Z9b9OScyO8=; b=INPUefGcJlFsTcBkBgC32g+yY/XGyVPSHBRAt437GblEP47kpnFBfrn/Ow0XkImQ2U T+O5L/lXd4NElSelDa/vXK0ahKuKkioVS5gf9buEuTK5mgBf5tYzjRFicgQduoQTQdi1 DX9wyTI2J8UrjvbU5uMkyLNM9/jYg2ZyXZgVevFrQVwP0ddDU0UOgzZQVsvOshN+gMbI CpaiVt1KflJkK10ndol57MTCzZyCMDQ+VdkbkKkVqFDUpM8lFEAQnG3cNUfFXPRnEETH okOdTyt9RFvc1pfynYSDFTunPuIef3vljSdCkpGInjXFTagiPCxZb5QJTamzcZJiUStf nROg== X-Gm-Message-State: AOAM531X+XekPaWC4mqxkaDmfqLaZMFqokAd6bY7Cw0rOvn166Pt4mwd sfR8uuN9rgn2V4Rk3SiXCtIULUtznd2jKg== X-Received: by 2002:a63:7211:: with SMTP id n17mr17079586pgc.456.1632016648786; Sat, 18 Sep 2021 18:57:28 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/25] linux-user/i386: Use force_sig, force_sig_fault Date: Sat, 18 Sep 2021 18:57:04 -0700 Message-Id: <20210919015718.466207-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/i386/cpu_loop.c | 48 +++++++++++++++----------------------- 1 file changed, 19 insertions(+), 29 deletions(-) -- 2.25.1 diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 5866e98441..cd6c2b032d 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) { @@ -104,7 +94,7 @@ static bool write_ok_or_segv(CPUX86State *env, abi_ptr addr, size_t len) } env->error_code = PG_ERROR_W_MASK | PG_ERROR_U_MASK; - gen_signal(env, TARGET_SIGSEGV, TARGET_SEGV_MAPERR, addr); + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, addr); return false; } @@ -190,8 +180,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 +252,54 @@ 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_sig_fault(TARGET_SIGSEGV, + (env->error_code & PG_ERROR_P_MASK ? + TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR), + 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 Sep 19 01:57:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514266 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp889587jao; Sat, 18 Sep 2021 19:04:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXhYSvaM/KLZIH2mFgtpzzw+fEXhAKUF/VgO+k0ORqtvasuEKCRpgjc/KA2xa0GpMKlPVx X-Received: by 2002:a05:6902:1543:: with SMTP id r3mr23623316ybu.409.1632017090058; Sat, 18 Sep 2021 19:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017090; cv=none; d=google.com; s=arc-20160816; b=X47tB5XcyUpZyEtynAuD3FBToprlxaAvGW4r9m82LGwdUwhn45zAffJSnx/beE7Wx5 hmP88OEKi0MwDHJ043G/kD4qXXmaR1EtGro0EDQt/vKWLL616RUxwLkGTko6rVzCtvIT V9Tloc0Y8IsMj5tHdB0bjHy6tsBEJ47gC6ftyovuNFgBiDNP/RXNB9eT7a3pIJ6KiAUL Eeq3f5zLp+mD4AHUT58LHz1kUracIVb2Jfn6mcKM4mlCktqs5wn29pfWMrbu4/x1QhQh +ir9oruGlZCGl/bg33GwfRy9EZyQQD27vE+X/lVUgkItqKv7yhVygeK9LF1ZCLzjA5Od 8fEg== 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=cTnSUy3sozc2mrt87w0e44ZRvgLTpypGGVhRf1mPH3Q=; b=NZrzZXnvPMo7aAsrCmhab6TqxccLzRCmek4X8qAj+JDYZwQ5fM3G0PtTrmpdHlHqa6 P8cRq/OpUHIVUsA8yhm6WmKIPHpsrv81CImC+85YUEEKh6V4W1YHw6Xe7w9U6nMMTLpC HF/JgwvPmTyeMR+iv3tNq9DCEDryCHmm2pOV+pTDZRGrfZYzEBcr6A4bmyDhjZmemPrb 3QleqdVasJyUiwUfgZFo5WGOl0ZK9tvuFJeXL73HPwkp+ITOawOyMUO/kZjL9NzLnncu +q1hdXSp9bUguyHmItJKECR7j1ssL0epehKCjhFRbqeahhynVRi1js4dRD4rphg092KU G/wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cropjl5U; 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 o5si11532907ybm.401.2021.09.18.19.04.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:04:50 -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=Cropjl5U; 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]:49190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmCH-0006Qz-G9 for patch@linaro.org; Sat, 18 Sep 2021 22:04:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5F-0003pP-Te for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:33 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:37428) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5D-0005AG-2m for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:33 -0400 Received: by mail-pj1-x1035.google.com with SMTP id me5-20020a17090b17c500b0019af76b7bb4so12050691pjb.2 for ; Sat, 18 Sep 2021 18:57:30 -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=cTnSUy3sozc2mrt87w0e44ZRvgLTpypGGVhRf1mPH3Q=; b=Cropjl5UZYwxNZ/LNy6aKuP6ivtc+G/ncGZXx90wBIw/xmVZ0RXrZ4l1zPVJBJ9fqG 8TvIXrnoYY/5ePtBr3bnAzBJvd6B7bweeuhU4g1oul++QKPukvsOlM5klmUjXR0U1k6r GWF9do5ITjkvbMAe/1dxOO3xjFkjkvZkNXeubMfVjePg7UL8gl4NsLTJYtw+R8cwFCb6 JzuChVmwmSy4rP4GETTf4Dfc/Qpy/VSi18AKPOA3a+DT1Xc/BMEwROkAZhVga+/UJJlt hMw1+qv5NA4xeWsS98BujlBWCqaJt2IDSd52+F+gsXFen6Lfwh4WUdA0ZrWR8UP8YWBg jguQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cTnSUy3sozc2mrt87w0e44ZRvgLTpypGGVhRf1mPH3Q=; b=H781jg3EJXezpWkabg+IYrKdsB25i0rev+//2M1JkoYiasMoqAZqUBSnekh0a3UgiK +XR9qSOOyPZsPjtcj9Vw7wGGIR+xjTOkq38XhjD2dsH/4UqPrmomgZTBzt5G8eG/iaia rAn5tl7u8owUaD1lVVZ3IhM+BVnTxISejirJVXj9Htq52aNwgAYhMmyqdurYMMw2DERa Rv4NMiDnq/RkIgjPjvZGJVw/DMQ4KG+y3n7ENuJCXz3TRJg8yvWVOGw3x0WjFlofHDDA Fgx8EIc4SigyHpb0xcMFQZUMhmc8Gva4xCs6FaqSC2P/EItYYCCj4xukLtr0bZCbfw9l WGRA== X-Gm-Message-State: AOAM532ndvvrdO00Xik7ZFypK5FfSoE4d/oh4jVaxG7U78tvxrNRtWrw Q+8oFcEp4alB2yVf692ujDwGjGH2WFjOVA== X-Received: by 2002:a17:902:8ec5:b0:13a:2789:cbb0 with SMTP id x5-20020a1709028ec500b0013a2789cbb0mr16527374plo.60.1632016649662; Sat, 18 Sep 2021 18:57:29 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 12/25] linux-user/m68k: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:05 -0700 Message-Id: <20210919015718.466207-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 7d106aa86e..cf79a17f93 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,10 +78,7 @@ void cpu_loop(CPUM68KState *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 EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Sep 19 01:57:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514270 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp890936jao; Sat, 18 Sep 2021 19:07:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1SIdaRtLyI1/YMhFhyIujZQMGVZfzIMkkRwO/sqkqYgso1R9Y9FAZBb3jmQad+g3jvhVu X-Received: by 2002:a25:a408:: with SMTP id f8mr24210481ybi.155.1632017248693; Sat, 18 Sep 2021 19:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017248; cv=none; d=google.com; s=arc-20160816; b=yyvOfRZ4MZJ50xiHPL+aIyAF4XlkKE1Kwv0k+x3WRmI/ygHmfUERHxIfepAc52XwAh 49FWgwr4le4whn+jUvsR22kYnTkloXNDLnMtp+/D9TRkn5TR+fKmIWk62oz8AG9qWG0s TY6XE7wojtUeT+/ZlCWN/oCvHajf0c+/6/qCM+sKGFNgQlD1EGNwECWymoI1CoC/4xST 5B2/bBI/kgHfTWpRGjlendBVSUXWVZhc3IEqqJpxuseAeH+miAAtAPAzdX8CKrrtV9Vn O0xbe/LxFGHq2O65MKr+C2Kq6bLhzqy3ajLkSXX0NIewyP3QAiFaM/gJTpJtF8sHvyLO DRSg== 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=d24uau7hAvhoR31DfETZUAFtZ6VzNOXKXU3xmJHN0Yo=; b=Or4BiQKT49BXgayQxBDbIDW47vfMGHuTPMAbiWRlZKN5xwvJmZqvDLtF4Xfz6ZyONo CG/JyExBYZiOTBaY7R4tDuuR3Lc/+RgB+bT+9gsmmKTWKm7Z+iSLPUgl2t0+4zLOJjWs ZkstXI5xqTw2ZOvzkt/ftwNT+Hr3Qe26jUoG0P9M/m9fGt4fNNbY2bzR5PXHBBwqBhH6 F54FA9lc/0ma5EQSa5Z85Tnlp/K31BoQ5ux2lM0MhktLDJA9qna9r0WDs7bWqxuHDsqd erl3v/39C6SREqWprrvinumxWeXKMgvFVlnguGTG6IaA4X/cr3t+pxkZmBr7gFPDgON5 H1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M0+L3boM; 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 z2si10340834ybm.113.2021.09.18.19.07.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:07: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=M0+L3boM; 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]:57730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmEo-0003jE-SB for patch@linaro.org; Sat, 18 Sep 2021 22:07:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5G-0003sc-M1 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:34 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:46983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5D-0005AP-Og for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:34 -0400 Received: by mail-pg1-x531.google.com with SMTP id m21so4540638pgu.13 for ; Sat, 18 Sep 2021 18:57:31 -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=d24uau7hAvhoR31DfETZUAFtZ6VzNOXKXU3xmJHN0Yo=; b=M0+L3boMqUJsFaR8Z5BUbs/NeXNMGiXh39aJqgiFGJzamV4O/SOLlw8hbzqUx+ZRBF Byz/QJ1SghZ7VyX2zzJjLDlzssROuw3oRE2QuRqtjQD2zWcR/OPKH5xL6E6dk/J6jg81 3lZpUZLC5pe4PhgByIwnAZSn0vxnFb46i/eG/UGtDxvEDDeC5et3IvOKZv3mU/ivlqgu y3B8ENkEeh2+3cD+YKkgXZrqvnhnvvoXDf5jx7gk3MeY7+4HsaJUri+D14CFL8i86AL/ FG2JwP49ju+9+5eCSQT5bbRFNXGPF5PgxUy2Cr0YlwqZhaHPxEMQw7xSwx/rr1A/+pnR iEtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d24uau7hAvhoR31DfETZUAFtZ6VzNOXKXU3xmJHN0Yo=; b=uPJMJV4f2qSqf75Ih8Y9zns9umzM8KFsl1LdF4GHLBXinXujNNmGxdYOLmzzpMUCot sUvABNJ86hPPDVGGRB1GgQgY2VJlGS6N8GvsDhcoB7GZMGZAwQB2KDpI364rDruj/Qa+ 29pzUSGWzs1oNo3mxqayK7ipFVauqX2TwM4A3dU3cSHGLPLe6ldN0GpjPTQef0beZD/T CtWK+Yq3rh/MHiqeXOTL8BiUEG1ixAWP/4ngbBCSxvnozwhypiW1N6W/t3MUMD3yWUNH ZP8959Ct3TyubrjKq899BKavgJj5ORaBLzroaSBusJZETvHpzbnnD5PbsSIW+pP9OOuk hDUA== X-Gm-Message-State: AOAM532hqixfauiQlKc31LG0PDDmsebaTGHaUJ2Qkmx4eA1ibWSl4IUn s5okNbN44a7DrmJgOg3ocBIxXLxW/Bm1Pw== X-Received: by 2002:a63:ac43:: with SMTP id z3mr17086857pgn.402.1632016650434; Sat, 18 Sep 2021 18:57:30 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 13/25] linux-user/microblaze: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:06 -0700 Message-Id: <20210919015718.466207-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 63 ++++++++++++++------------------ 1 file changed, 27 insertions(+), 36 deletions(-) -- 2.25.1 diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 0b889a04a7..c527d21889 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,8 +37,8 @@ void cpu_loop(CPUMBState *env) switch (trapnr) { 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; @@ -65,6 +66,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) { @@ -72,42 +74,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 Sep 19 01:57:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514277 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp893146jao; Sat, 18 Sep 2021 19:12:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFZif/K3pW9frH9kexv44VFh4Lz3olirLTx98G5O9DiWe1yZI3gm4sfFCxYOcuVZCYtInq X-Received: by 2002:ae9:ef8c:: with SMTP id d134mr5726572qkg.290.1632017528557; Sat, 18 Sep 2021 19:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017528; cv=none; d=google.com; s=arc-20160816; b=SxKa3OGF2dKO/gWIkTC6eNAd5Bp2hgEokGcJVcBWqw7OH7eu1goqF+/YBkttz0kQY4 wJJZGqyoRQJQWZqTyS1imej+H8S6govuqOBeU6j7yFAQhM/s5CUrnC67yL+WwgXZuZGC TKF+fehRB5iubih4ACi+TQ+um6/VKTJcfhfNN9eI3Sj0Jg9yoLqb0LBQBAse+DNuJ7YT A/V4sZh36krgF3nwbYjigOy1uzX0ROR+xoOv6cpmFRM1s1dkcgFAA+s5QNYBnl9ixlCh UbZ4oobWJFUfhzha3wI1+rh+pqT47Bvquu7QTVkEgKfe4Hy1J6BkGRTRdiu6/csroqfW 4BJw== 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=qbTX6X3ZiaT/yz+580OpvnsMVLtbZ8O1xHLPy0wb8Rs=; b=xIWDetwIlWjNZx8ddfQ9n7nGx/VfNPkf+Txiqgli9h2snHqaDy2oGwYoL18861fjt6 f9t3B02fXfoORsr0ex8Giq85tWJvEwdZpbi/t26cK6FSR94f/LqX753Zjh0vOULWlnN6 tOeRxvDpzJyqJiXM/LMhPX6+U4p9fr8kYQDXik/l7GE21LFVVnklMiZjDExCVBbBam0b 6fF/BuO02KZmUvnMgaAo/SlbVGP835JEzm8wn3W0fb2r0BLJdcT+E5xnQ5NikAqa1Jhy hb6vDVqv7Wtv5R0VGBjaff8u3rCJZvM/l6WxGfz0JT2XI+6z4iL0TXDkNnTFSOcTWfZb yXQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NeHewr+J; 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 v22si1429830qtw.177.2021.09.18.19.12.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:12: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=NeHewr+J; 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]:41254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmJM-00039i-2U for patch@linaro.org; Sat, 18 Sep 2021 22:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5G-0003q2-3L for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:34 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:45663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5E-0005Bh-HA for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:33 -0400 Received: by mail-pl1-x62e.google.com with SMTP id n2so6151568plk.12 for ; Sat, 18 Sep 2021 18:57:32 -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=qbTX6X3ZiaT/yz+580OpvnsMVLtbZ8O1xHLPy0wb8Rs=; b=NeHewr+JamXRqPJvzk9BBKgsg4ah7N0Wz4Ilgu8WEIDeQD/mBhVQgphpQppYyNSQfD JuRf1jQEF/hHslR4QKjFBEi4t2ewZF4HsJctPnnLYr8t+y2GgrwsTFuhd4aX3+iLesbg 6dhnxjqjMsy3uLZ+j4zMeSOcZ94slhi2Shw5mIoYPF49LsNUF9h22u0WiVBTGz8lCYol TQSzQdChyMgfj+ExKkxCAxvAtr4+W9EoibeKyPpReDrbnhDkwDAkTEx4WTChK7UM8xkt cg//74K0Sj9UIxZfrsM+HtxUsmIio0KEmI9i5dt4HW1SUIF6DiQy/8duwafPClwrn3/f 5JAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qbTX6X3ZiaT/yz+580OpvnsMVLtbZ8O1xHLPy0wb8Rs=; b=6k0d8oPlZGt+TvdJHhFHOPQKtT0qBoU/D4G8pei4Mtn+jMj+mvx3CUk3VAS3cmalBR k3uehNASId/qHiMB80qJ+3HYBk00hu9zv3NA+WSIfj0S393Fb2wZCEQ6LFWqIBwa8Zf5 VM4iAQ6v5aLHtwU9A78tcMzq4BKdX2NFNx8KI3n7S8/z+BqgWRDJxvS2r/EWiGTPPVFQ jpG3Rw2WN/gnovxNHNjSYE7xAOxj/8QQxWsW2+mzBrIJX73d7DbmxUNLPUF++GziOJP1 +PTNxLvXlEYtDDfh3snnBT4PWaUNAnXmyXS7lXuJCGbE0dAbLUTRF6b2QuMOg5sS4Jzd BVmQ== X-Gm-Message-State: AOAM532Ook2VEpJqJY10JNUshgyhMe/TCwvC5vJVtMlaRGY8PP0IamCA M0Mg90+AonVCkvZJiexz3/gruzjcVaTdSg== X-Received: by 2002:a17:902:8647:b0:139:edc9:ed43 with SMTP id y7-20020a170902864700b00139edc9ed43mr16489194plt.23.1632016651247; Sat, 18 Sep 2021 18:57:31 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/25] linux-user/microblaze: Fix SIGFPE si_codes Date: Sat, 18 Sep 2021 18:57:07 -0700 Message-Id: <20210919015718.466207-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: 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 diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index c527d21889..74b2a9fc43 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -77,15 +77,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 Sep 19 01:57: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: 514271 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp890990jao; Sat, 18 Sep 2021 19:07:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8KfDvXanPMLZKFHyGX/Qw/I0nOkXgigXvxTsyQQ4E9AmJ+wzt1+2JT5GlSg7z/rkj/gis X-Received: by 2002:a92:ce05:: with SMTP id b5mr13444682ilo.194.1632017255262; Sat, 18 Sep 2021 19:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017255; cv=none; d=google.com; s=arc-20160816; b=Vq3BJWCekevnsDHRFgGNDxqOveIQOPF/FzLSopovARFJNEWPh1/1W/3AOvz6hNxJEj hqPpIiXjmmqZwBVoFuNtUo3RXefyU8SDbjA8/7Q+wMedgkUwyo920pFScZNDNVPaZw6k ms9efPpTrpHZ0PCyEdtHjfS3Y3545BclduZesxC6iCVRoLXevWaknGN5ZKCiQuLXOPQO HUQvNWGcqQHRKigkix8QCuP2hNoEZdvqQeD50VGob+OfZWUnkazLbWffqJsj087ihUlj botqgXMLpd4BMa70tl7Oj4xrH3AATZz432hny1eIe+73vIOLTLRHdv/lQRIY/JHz0Rlh 0H9g== 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=o9vTFC0WOoEyqai3QW/OmyfUcnLrZGOVemPhfUbAQrw=; b=hXiEICEI5QLJGP94uENHCTEw0ElckRDVrC6AFJlAjOro2cQmu/dlpSxuVrPN9kn+H1 7rNqBG8JXY9h/ff/FLe+vf9rbz0C6S611vu38LVhbx6Gd7PTLVUqcIl9xkceADtlF4VE ZNaSkDP6mxXO4BGUOlD277ZGYcJ+LqN5uUT50IEQh9wyUOZcmMbtHm9Z+1iO7dTDEaO7 D9Fs+pS7wW2zFU6zZ4Nx3FzERXidhW/vFqRApYGNM18OLxo47RFI+KW24bahBZJJ2WMO VUSECXhcswODRk8gszDrQcRj/TMdASeX6x1n9Gb0Xe04YON1uCb9KHeRqJfo3JnyrA9I Hs5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZheWIfXk; 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 y7si10523679jap.59.2021.09.18.19.07.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:07:35 -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=ZheWIfXk; 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]:57884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmEw-0003r2-H5 for patch@linaro.org; Sat, 18 Sep 2021 22:07:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5H-0003vT-Ct for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:35 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:44842) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5F-0005CX-M1 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:35 -0400 Received: by mail-pf1-x42d.google.com with SMTP id b7so12832439pfo.11 for ; Sat, 18 Sep 2021 18:57:33 -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=o9vTFC0WOoEyqai3QW/OmyfUcnLrZGOVemPhfUbAQrw=; b=ZheWIfXkb1P9AHRdTg0Ch1xOT4vgpDnw9Wwmk+hB4zv9ItDd5FsToEb8PzPoreNNxk lXBboybK7BA+DhSVaVOBV/1l6f00IzqzycS9sbJNmEhZgQ+JrzqJeLfVyJrwfT6wz2GH 8ZBe73U/CaLrcI+tPFf8ShjLqyHERQ0YZd1Bjn1TzjVgVt5m8TCcmwo2fs19UWvpwmCZ 0O6HXes/OQPwotsS7hdcwst/G7iFitt5ZmjPpFQoS29pFs49NG3VRFDJ/K+MkBcj4z9P 2pc6ztgCd455Og5/Ef7uKl5Ov8HJ+Vinbblzant97ur4pvouPU0B0bc0iVL7JzPCSWOM 9Lag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o9vTFC0WOoEyqai3QW/OmyfUcnLrZGOVemPhfUbAQrw=; b=Es3OhjKIDXfmGUbcUXsVhdeROBgZBM2NwmRXXgwOSA3tfO2kZPe7VraGcmqx+rKToy mf5E+jugqcevpgHXh7pVSM+++YOG7Ceyya1eT4Qm86hOKt3CI/POiz3oRsTdW81qEEFD 2h8PmZVh6fYIl4XItOdG7AXyAGPu2M+wOSIk7F981NPzehIorqErE3FVtgHo3hu8Xz0d CajS26d6ubMcoGQSq27j9/kh/TGZLKXoe6zGJCDt2hgudXJNe3U7j4wBVJb5XhomNykx iLOkg8dWQbzPo+zpAYqcP2SNnQsepHTm7YJ+DZvRdaBovJd2QkiMD0ZLmcG2GsBQhcTN I37Q== X-Gm-Message-State: AOAM530nWxOW1jeNQHwgt1mjmym+QFuGVLBbFW7vE9roN6A8JYSN8JbT /GD2apChaHyKWhz/1LDn5tghFCfqyBDdZA== X-Received: by 2002:a65:5cc3:: with SMTP id b3mr17099641pgt.97.1632016652339; Sat, 18 Sep 2021 18:57:32 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 15/25] linux-user/mips: Improve do_break Date: Sat, 18 Sep 2021 18:57:08 -0700 Message-Id: <20210919015718.466207-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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: 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 diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 40825ca566..a330dc03db 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) @@ -203,6 +200,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 */ @@ -255,9 +259,7 @@ done_syscall: } } - if (do_break(env, &info, code) != 0) { - goto error; - } + do_tr_or_bp(env, code, false); } break; case EXCP_TRAP: @@ -265,6 +267,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]; @@ -291,9 +300,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 Sep 19 01:57: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: 514274 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp892755jao; Sat, 18 Sep 2021 19:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkSnEwIamw2YgC+9jKNjtQOTOSRXgDLlG7X/W+uqHKhI2Bfs9/OD4yNpIHRTEZhLLvTAi+ X-Received: by 2002:ac8:4b41:: with SMTP id e1mr8627354qts.383.1632017479594; Sat, 18 Sep 2021 19:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017479; cv=none; d=google.com; s=arc-20160816; b=himCpZEWulS/+Dn+Fc5fwLR+8/w8v8/eZQyBQrP+qwVILPDAkvtsqARC60bSgNh2bg 37LP53VYuXi4IbFUwn8bwGgmxkRJeHEw8tsdW6L4xMrNhoaKe5GqlJyMQxqRbEF2Uinx ami+rGWYP5yKsOSZY0/TLCPGn0SavrLwkLHrCUM0AkPAsknUu7fBGrFn89u4ilqBvnrJ rkOAZUFwi4VT+K6Lpg+gl7H77fFk7dyDR+ZLj/4KHD6hjO1TPjA1gJQiRaVIuYjDlbRR 0XjmVpdkBMNuamXHgY9ULVs3S5mHG2Iezl+rU1oroxv8TPsqux+KfGDBFD3duSnwFnXT qSLg== 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=pBhs/Q7ExZmqkuTooPQxpUl415pPIM7JuuK+7DyUZc8=; b=Qn3GvCHfr9kDUjMYbbb9vm7eHDkLqqTYwTMWk/CMcaBBEXx0BURKpLRRr/8KVvuYjS V5ictRIGs7A2vNiVajS799H7Em9P5nAkjvIQx6THvGFOq9iwSo7+pJlkyD9WGJMktizM 9+jzSYqmqPKK4ibUY6O/r5Josz8EMKuXahy6UdkTtM3/CgUwjS/VpY72Cdxw688X6Nu5 Y1qgagDsJZn2p9i6tDIlS7OctWnX1O33gxfrKt3mxaVXkUvgeShskSReDrOUxw4gj6Cu 4MmLdmIbwFujAqHTnVvWN7cyuyLgAFg6pYVDzv0LHQzYfJ9wbhIjZ8o0pNUA4PZ3C4Oo i4jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=isX8uJ8B; 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 p14si406084qkp.19.2021.09.18.19.11.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:11:19 -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=isX8uJ8B; 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]:37920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmIZ-0000qq-49 for patch@linaro.org; Sat, 18 Sep 2021 22:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5I-0003xQ-86 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:36 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:43697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5G-0005Cf-K6 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:36 -0400 Received: by mail-pj1-x1036.google.com with SMTP id k23-20020a17090a591700b001976d2db364so10169716pji.2 for ; Sat, 18 Sep 2021 18:57:34 -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=pBhs/Q7ExZmqkuTooPQxpUl415pPIM7JuuK+7DyUZc8=; b=isX8uJ8B8R+0QpLtLK0bfWBOMLWLaIgsR3z7z04nzxr0Mrsw0B7ZZFzotXI7nhenbQ WGEg9llajuGpUZd2pamdDSJC7Jm4977xqXMRlh6+eYmUhQ2XkzQDkHl8v+oPE8iFZxf5 W9Y21+Xcs/CZJcS0tY7boCMhgsIlIoNABETGTQmV5wYMOw8FOz8dYkZquV0/4ShMvkpT efCtNpzWfsrbZyai+oHNhWICTXljJZwozo1st1GLDNIDcKNfG+p3CEO+7DtIfJ1Xz+RE +iqZXoJ7vD7WTF3eQpzRin/pVzOYMmN8P7xbmwWGQE8aKJsmQ9wQLUGvZs1qTc6c55cR 5s6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBhs/Q7ExZmqkuTooPQxpUl415pPIM7JuuK+7DyUZc8=; b=1W8JBRud3w8uEH9QA1uBSIEM7FadYFt1i1ufeuL1LfZrNCXyWJaPFGEejal6MQ1yzF A9nFSJxhGe0NwdRex6kR2t6GLlkVl/MWPT2fF7QcqVFFWzwPJp7CYJm1CU/kecGJ52th UIZ+V7HQWPrbth3muJDKwnV1t0YtQoFHuJBQ52ptw+arR67HHA1uMdqXA7OqLiCYWubL hP0LYGl7iGIoWrI9TlbyS9rk9cBfkQuy3aiduFBGNeEHzkLj2VaRznWQqYCzoS8MrCdT MzbPY79hPeLFXbvw30VJTFwONEIUEGwSr0SKmRbbFWuKrmGyT8dS2kvyLd95poyG2AHj OVxg== X-Gm-Message-State: AOAM530Q6ss+Z9OkH23vGxk89iEUWjOL9RQfKC1+H1RE7oYAMRE/wqQv kmSbSun8jflnBJBMP2byuOLTASaOkeBPrQ== X-Received: by 2002:a17:902:ab16:b0:13b:9892:4df2 with SMTP id ik22-20020a170902ab1600b0013b98924df2mr16599982plb.67.1632016653314; Sat, 18 Sep 2021 18:57:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 16/25] linux-user/mips: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:09 -0700 Message-Id: <20210919015718.466207-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) -- 2.25.1 diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index a330dc03db..e9d9208e83 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; @@ -155,43 +154,32 @@ done_syscall: 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 Sep 19 01:57: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: 514275 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp892760jao; Sat, 18 Sep 2021 19:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxObCHOnK0Q5YOx3Z0XeNnebqJPyDWvczDdS73txEsNsNPtvid0aynULwsYwN112CCsQIOQ X-Received: by 2002:a05:622a:254:: with SMTP id c20mr17338600qtx.213.1632017480967; Sat, 18 Sep 2021 19:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017480; cv=none; d=google.com; s=arc-20160816; b=1C8kHpqHWJlnyJVu2V4MiGXgUqswe9wmFnL1Q/j0QjEvW2bLhfnRLSRSmM/orZSybi XSpyvox10CjKx0HjZGTcDunkgFg7ZAM5XWLd9Kqd9ZCexr7wm3yGfEh6JBT4dl6iPstX IzGolarXvhnYiPrY20iET8kwImVO6XwJTbjtxM0Ba0/2qKxMl7Ks5UhXQaSx+Bx6x6iM efM7Tr1EYl/rl9f3Ids/jvpowI3Q6t4vc1hC4b2/TwQ2yaRelDGLInedLdTSCLq1L7n1 wAB4P6RVpl6Ms/3PXhptewVbFi0WXfGt18ZgzYnCC1JV3Nvj23LMUZ+3nL2gTSPJ2W6+ VZUg== 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=O9vg5roFylqoQkGnKileOtFvxG1CN8IesL9g9MIkxpY=; b=uurgzIeyQQ0xpC9WBxzzR9PYNENYKLL7/NrRQFk14cQJntREg6GVbRR8YtaFg253BC io5mDotqX2vdY88vobjK29qg+Orl457eGuTzXXEo8DnI7a5s+C4RVAJIXgV7rKb1CtJ4 +zgM3frrHMgO/kyntt2nxhHOrmxL3R7DEpf9ZiecH5S6iEEH8Xk18+BBNNThFDel2ebM RH38SapgMBpeixjzkXrJ6357KA+/TczqySAnDhY6ndxN79mYUND1f+sSvyMfz13AmTV1 4lxPTW2smoX0naIYcjv66fKYNUL+lspXeDo754kwMi9TCfhb/bDSimN5Wa7JPlzm8UL4 aUdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qfEADOXF; 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 z9si5538247qts.104.2021.09.18.19.11.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19: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=qfEADOXF; 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]:38148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmIa-00011T-FO for patch@linaro.org; Sat, 18 Sep 2021 22:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5J-0003yT-3I for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:37 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:39736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5H-0005Cw-BP for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:36 -0400 Received: by mail-pl1-x636.google.com with SMTP id c4so8751054pls.6 for ; Sat, 18 Sep 2021 18:57:34 -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=O9vg5roFylqoQkGnKileOtFvxG1CN8IesL9g9MIkxpY=; b=qfEADOXFNDKRC7tt8/YQJ3HwpaiVtr/o13VpiYVlzTevZ/LtgCftxq2pHp64sOh6QR ctWCHVnIeJuRQAaKBGPscX4SRYPEXTaVuNXNsTKaMdARHX0Bf34s/bpJgucaQJxkSETh YPStFLHsPHoi0dWT82gtwdkJ90rtC567kEE7cUj3yccbG0I1f3yjlXUG6yoS26mvU5Qw Ue3vf1lTAoGjtRa/fIMGCBdmniRK/fLYoBx3GwipQZg0c9CFFKrnkjRQj+zjBBkjue20 McXIDnO777nH2t/0uDYiSe7dlZPkkeWxeLZWoLtSnsD9CXQ2sV49HNyIKw2Fe9OhppFH O15g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O9vg5roFylqoQkGnKileOtFvxG1CN8IesL9g9MIkxpY=; b=pR1Hdti+d3g+cPObZdXWJXLop7k/MXR8qL1WYuX3stv/heNiOGaCOpxX3IDKL9qmls stcfrfvwSW4eVedWvCvj2SjkD79fev/gZrqV0kRWr+mIbg7lVtE0pJeGKZY73ruQbGSs p48AmntUZHiUWb6QLc2LYqbHoZJNmdFUoDrz2Ca7B0R4Oi424nFXCqgJa0HpoM9G9UhP dC3xBPGoc1zxovFD9qMvBQnsyMWeiUJ1swSbdF1WhK6ooqpYTcnDqHdttkuCCMNq5ftL HEBY4zz7wP6K/0hy3BTDmzgVNCTZvANAxQeodf3KjxBEM+ET5/GK4m8RoIgAzbHhyVka kxaQ== X-Gm-Message-State: AOAM532eKG2F7dqING3+Tz311NkiAIzSLrpX9gav2bKtNIx08tT37Vut D1Ei8jiyUFy1iu8IG2rdr6TKOyb9oNa+zQ== X-Received: by 2002:a17:90a:1d6:: with SMTP id 22mr21348103pjd.214.1632016653934; Sat, 18 Sep 2021 18:57:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 17/25] target/mips: Extract break code into env->error_code Date: Sat, 18 Sep 2021 18:57:10 -0700 Message-Id: <20210919015718.466207-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Simplify cpu_loop by doing all of the decode in translate. This fixes a bug in that cpu_loop was not handling the different layout of the R6 version of break16. This fixes a bug in that cpu_loop extracted the wrong bits for the mips16e break16 instruction. Signed-off-by: Richard Henderson --- target/mips/tcg/translate.h | 1 + linux-user/mips/cpu_loop.c | 73 +++-------------------- target/mips/tcg/translate.c | 12 +++- target/mips/tcg/micromips_translate.c.inc | 6 +- target/mips/tcg/mips16e_translate.c.inc | 2 +- 5 files changed, 25 insertions(+), 69 deletions(-) -- 2.25.1 diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index 6111493651..ae01515efe 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -129,6 +129,7 @@ enum { void generate_exception(DisasContext *ctx, int excp); void generate_exception_err(DisasContext *ctx, int excp, int err); void generate_exception_end(DisasContext *ctx, int excp); +void generate_exception_break(DisasContext *ctx, int code); void gen_reserved_instruction(DisasContext *ctx); void check_insn(DisasContext *ctx, uint64_t flags); diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index e9d9208e83..c105b00eac 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -64,6 +64,7 @@ void cpu_loop(CPUMIPSState *env) { CPUState *cs = env_cpu(env); int trapnr, si_code; + unsigned int code; abi_long ret; # ifdef TARGET_ABI_MIPSO32 unsigned int syscall_num; @@ -184,71 +185,15 @@ done_syscall: * handling code in arch/mips/kernel/traps.c. */ case EXCP_BREAK: - { - 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 */ - ret = get_user_u16(trap_instr, env->active_tc.PC); - if (ret != 0) { - goto error; - } - - if ((trap_instr >> 10) == 0x11) { - /* 16-bit instruction */ - code = trap_instr & 0xf; - } else { - /* 32-bit instruction */ - abi_ulong instr_lo; - - ret = get_user_u16(instr_lo, - env->active_tc.PC + 2); - if (ret != 0) { - goto error; - } - trap_instr = (trap_instr << 16) | instr_lo; - code = ((trap_instr >> 6) & ((1 << 20) - 1)); - /* Unfortunately, microMIPS also suffers from - the old assembler bug... */ - if (code >= (1 << 10)) { - code >>= 10; - } - } - } else { - /* MIPS16e mode */ - ret = get_user_u16(trap_instr, env->active_tc.PC); - if (ret != 0) { - goto error; - } - code = (trap_instr >> 6) & 0x3f; - } - } else { - ret = get_user_u32(trap_instr, env->active_tc.PC); - if (ret != 0) { - goto error; - } - - /* As described in the original Linux kernel code, the - * below checks on 'code' are to work around an old - * assembly bug. - */ - code = ((trap_instr >> 6) & ((1 << 20) - 1)); - if (code >= (1 << 10)) { - code >>= 10; - } - } - - do_tr_or_bp(env, code, false); + /* + * As described in the original Linux kernel code, the below + * checks on 'code' are to work around an old assembly bug. + */ + code = env->error_code; + if (code >= (1 << 10)) { + code >>= 10; } + do_tr_or_bp(env, code, false); break; case EXCP_TRAP: { diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 148afec9dc..e17bcd24db 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -1367,6 +1367,16 @@ void generate_exception_end(DisasContext *ctx, int excp) generate_exception_err(ctx, excp, 0); } +void generate_exception_break(DisasContext *ctx, int code) +{ +#ifdef CONFIG_USER_ONLY + /* Pass the break code along to cpu_loop. */ + tcg_gen_st_i32(tcg_constant_i32(code), cpu_env, + offsetof(CPUMIPSState, error_code)); +#endif + generate_exception_end(ctx, EXCP_BREAK); +} + void gen_reserved_instruction(DisasContext *ctx) { generate_exception_end(ctx, EXCP_RI); @@ -14176,7 +14186,7 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx) generate_exception_end(ctx, EXCP_SYSCALL); break; case OPC_BREAK: - generate_exception_end(ctx, EXCP_BREAK); + generate_exception_break(ctx, extract32(ctx->opcode, 6, 20)); break; case OPC_SYNC: check_insn(ctx, ISA_MIPS2); diff --git a/target/mips/tcg/micromips_translate.c.inc b/target/mips/tcg/micromips_translate.c.inc index 0da4c802a3..f91f7a96cd 100644 --- a/target/mips/tcg/micromips_translate.c.inc +++ b/target/mips/tcg/micromips_translate.c.inc @@ -822,7 +822,7 @@ static void gen_pool16c_insn(DisasContext *ctx) gen_HILO(ctx, OPC_MFLO, 0, uMIPS_RS5(ctx->opcode)); break; case BREAK16: - generate_exception_end(ctx, EXCP_BREAK); + generate_exception_break(ctx, extract32(ctx->opcode, 0, 4)); break; case SDBBP16: if (is_uhi(extract32(ctx->opcode, 0, 4))) { @@ -937,7 +937,7 @@ static void gen_pool16c_r6_insn(DisasContext *ctx) break; case R6_BREAK16: /* BREAK16 */ - generate_exception(ctx, EXCP_BREAK); + generate_exception_break(ctx, extract32(ctx->opcode, 6, 4)); break; case R6_SDBBP16: /* SDBBP16 */ @@ -1812,7 +1812,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx) gen_pool32axf(env, ctx, rt, rs); break; case BREAK32: - generate_exception_end(ctx, EXCP_BREAK); + generate_exception_break(ctx, extract32(ctx->opcode, 6, 20)); break; case SIGRIE: check_insn(ctx, ISA_MIPS_R6); diff --git a/target/mips/tcg/mips16e_translate.c.inc b/target/mips/tcg/mips16e_translate.c.inc index 84d816603a..f57e0a5f2a 100644 --- a/target/mips/tcg/mips16e_translate.c.inc +++ b/target/mips/tcg/mips16e_translate.c.inc @@ -969,7 +969,7 @@ static int decode_ase_mips16e(CPUMIPSState *env, DisasContext *ctx) gen_slt(ctx, OPC_SLTU, 24, rx, ry); break; case RR_BREAK: - generate_exception_end(ctx, EXCP_BREAK); + generate_exception_break(ctx, extract32(ctx->opcode, 5, 6)); break; case RR_SLLV: gen_shift(ctx, OPC_SLLV, ry, rx, ry); From patchwork Sun Sep 19 01:57:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514276 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp892782jao; Sat, 18 Sep 2021 19:11:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeuLG7CDNjMH99xSFhyGt42DjSmkD7uxnrv6R7vuDpuGMmzLte7X4wEAtmQsu2nMTFHcvi X-Received: by 2002:a37:8044:: with SMTP id b65mr17812497qkd.295.1632017483171; Sat, 18 Sep 2021 19:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017483; cv=none; d=google.com; s=arc-20160816; b=vaeg1zByZMZnvOEIKp7et4oUDh/6jvjEsXkEKlZztgyO6IYwsQcKw3mRvnBzh3tBhw 3Rlclc5iRJNEHxW8acycLb3v/Hwt8IsLEoZeqZJXEf4sxxck56Ejoia4C8xKWCy2jvOd Qg718NAU8C4j3yaBN1P4CwrSvt6Y5vp2Ubd/YgEBuLj9VtQwMuZ9eEtojXdvdaKS4f+M Ms0A/aFhhiOO37er8/y2fP31RUivNMHQWZa+L53EAjbtcrnJwZ7u6nSQce9FCW1v6Tf7 AA+k++dglxkOv8R/bJQOJka9r3IxIO3Tbduh1ZTdzuq+bRsEIiugz6CEqEmUSeGIq4sk wVqQ== 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=oYSYypY0CHRzBDmdIq9KLoLQWZgGM49DHWDL0hjemFE=; b=naBmxCwyuQdaEam41wturwOs9UcSqpMZIelDPUbP7FavEQMAds1s/RZQtS+28B6HZe 6enWOdG8wRrnNIG7gtcqlLnHILLDEtJfcRPwk2gX99dBHTUqwWDAh8cB4vUMOIy1zo5e Kxt+iiTHmij1wRPcOmSboyGovrN7hmXQYuL4biKCuixTbsKRc2vhLy5xNHa5C9S9ZbQS bg5ulhxriL4EJiUgimKgB7qEftKnMSv1iy8jvfrEq+bCjm6xDj+oNrE2IdjDtfEtY8RA iRV3r/ggCHCiuGglhpqy92UqCk8K/+BcsG2Cq9ieJvSA9A+93yScfcoCVlr+jzFEsoyI l14g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JUGovj3m; 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 c19si6437417qtm.69.2021.09.18.19.11.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:11:23 -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=JUGovj3m; 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]:38406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmIc-0001BM-KE for patch@linaro.org; Sat, 18 Sep 2021 22:11:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5K-00042G-4t for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:40 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:46681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5I-0005EC-8g for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:37 -0400 Received: by mail-pl1-x62b.google.com with SMTP id bg1so8717541plb.13 for ; Sat, 18 Sep 2021 18:57:35 -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=oYSYypY0CHRzBDmdIq9KLoLQWZgGM49DHWDL0hjemFE=; b=JUGovj3m7VsVxSm+KI+tAJPOhuyQ3XjJvpe8WFAr7nwOwXu/tNYMIH4aQMiRKVPxQ0 SU+0pGXsHCbuGBD27hF4xGXL1/SdupeXKC4jM3vwybReWXZxEpzUMvvOPBvjR70N0eJ1 wveCE0BA42U71tmDyGNzmyEdn8leN+ALYpZC3merK6IwkbQ9LGLHejWjflJAHSzSUO5g ydCIfWs+QiH7a3oMl3jfJVUOC3zgKP7EwBsnxs/e1ccQ0q3UP0FYUgGn1GknlE1Mr9gC i+SUP4ZDyraylA0d54H8JbAkl+/zOm4a3FF37LWjUjPvUKOxEqsd92Kn7fe/KOk7fRsZ OlzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oYSYypY0CHRzBDmdIq9KLoLQWZgGM49DHWDL0hjemFE=; b=DIGLZUXSC/a87MJLKuptaVYt0EysBALgdWX2U5hwYzRhiX8HcXAiKOcIT424io9N6R Zdc3hfWmkVPIvtjCbhM62rp/HgJiw7o4F8tvNDT6yK4p9+vH6PGMX/8JaO9dzJhlc1JT 7THHe3zzVwJN0crsQqIub56Hv0eDBcC/RauZk/KJY5GscMAa39JqyrZe2PE9BG8Z2FtJ fux6xxfbDDulYYSfp/0sltboA63fYcyqau9YxwrnXFERtwtsudPAaJDeI8qmkjO9C5Qh EgiMvyKphfQigleNB1lAs6uOLclhzZ9+2uagt8RjpbYb7HtdJxYJY51hZRK/4FnSmLbZ RxYg== X-Gm-Message-State: AOAM531tZ4pcASY1s46EUGZnxlPVyWH0JF51dGPiMBt4MfSVBPtNGQvZ 8swgwPD3O9qysGz8kzBjNvN/RiazNSkRBw== X-Received: by 2002:a17:90b:f02:: with SMTP id br2mr29500855pjb.125.1632016654975; Sat, 18 Sep 2021 18:57:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 18/25] target/mips: Extract trap code into env->error_code Date: Sat, 18 Sep 2021 18:57:11 -0700 Message-Id: <20210919015718.466207-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Simplify cpu_loop by doing all of the decode in translate. Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 41 +---------------------- target/mips/tcg/translate.c | 24 ++++++++++--- target/mips/tcg/micromips_translate.c.inc | 4 +-- target/mips/tcg/nanomips_translate.c.inc | 4 +-- 4 files changed, 25 insertions(+), 48 deletions(-) -- 2.25.1 diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index c105b00eac..c02403d8f6 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -196,51 +196,12 @@ done_syscall: do_tr_or_bp(env, code, false); break; case EXCP_TRAP: - { - 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]; - - ret = get_user_u16(instr[0], env->active_tc.PC) || - get_user_u16(instr[1], env->active_tc.PC + 2); - - trap_instr = (instr[0] << 16) | instr[1]; - } else { - ret = get_user_u32(trap_instr, env->active_tc.PC); - } - - if (ret != 0) { - goto error; - } - - /* The immediate versions don't provide a code. */ - if (!(trap_instr & 0xFC000000)) { - if (env->hflags & MIPS_HFLAG_M16) { - /* microMIPS mode */ - code = ((trap_instr >> 12) & ((1 << 4) - 1)); - } else { - code = ((trap_instr >> 6) & ((1 << 10) - 1)); - } - } - - do_tr_or_bp(env, code, true); - } + do_tr_or_bp(env, env->error_code, true); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; default: -error: EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n", trapnr); abort(); } diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index e17bcd24db..6bb631e74a 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -4733,7 +4733,7 @@ static void gen_loongson_lsdc2(DisasContext *ctx, int rt, /* Traps */ static void gen_trap(DisasContext *ctx, uint32_t opc, - int rs, int rt, int16_t imm) + int rs, int rt, int16_t imm, int code) { int cond; TCGv t0 = tcg_temp_new(); @@ -4778,6 +4778,11 @@ static void gen_trap(DisasContext *ctx, uint32_t opc, case OPC_TGEU: /* rs >= rs unsigned */ case OPC_TGEIU: /* r0 >= 0 unsigned */ /* Always trap */ +#ifdef CONFIG_USER_ONLY + /* Pass the break code along to cpu_loop. */ + tcg_gen_st_i32(tcg_constant_i32(code), cpu_env, + offsetof(CPUMIPSState, error_code)); +#endif generate_exception_end(ctx, EXCP_TRAP); break; case OPC_TLT: /* rs < rs */ @@ -4818,6 +4823,18 @@ static void gen_trap(DisasContext *ctx, uint32_t opc, tcg_gen_brcond_tl(TCG_COND_EQ, t0, t1, l1); break; } +#ifdef CONFIG_USER_ONLY + /* Pass the break code along to cpu_loop. */ + tcg_gen_st_i32(tcg_constant_i32(code), cpu_env, + offsetof(CPUMIPSState, error_code)); +#endif + /* Like save_cpu_state, only don't update saved values. */ + if (ctx->base.pc_next != ctx->saved_pc) { + gen_save_pc(ctx->base.pc_next); + } + if (ctx->hflags != ctx->saved_hflags) { + tcg_gen_movi_i32(hflags, ctx->hflags); + } generate_exception(ctx, EXCP_TRAP); gen_set_label(l1); } @@ -14171,7 +14188,7 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx) case OPC_TEQ: case OPC_TNE: check_insn(ctx, ISA_MIPS2); - gen_trap(ctx, op1, rs, rt, -1); + gen_trap(ctx, op1, rs, rt, -1, extract32(ctx->opcode, 6, 10)); break; case OPC_PMON: /* Pmon entry point, also R4010 selsl */ @@ -15305,11 +15322,10 @@ static bool decode_opc_legacy(CPUMIPSState *env, DisasContext *ctx) case OPC_TLTI: case OPC_TLTIU: case OPC_TEQI: - case OPC_TNEI: check_insn(ctx, ISA_MIPS2); check_insn_opc_removed(ctx, ISA_MIPS_R6); - gen_trap(ctx, op1, rs, -1, imm); + gen_trap(ctx, op1, rs, -1, imm, 0); break; case OPC_SIGRIE: check_insn(ctx, ISA_MIPS_R6); diff --git a/target/mips/tcg/micromips_translate.c.inc b/target/mips/tcg/micromips_translate.c.inc index f91f7a96cd..7e7d26a91b 100644 --- a/target/mips/tcg/micromips_translate.c.inc +++ b/target/mips/tcg/micromips_translate.c.inc @@ -1047,7 +1047,7 @@ static void gen_pool32axf(CPUMIPSState *env, DisasContext *ctx, int rt, int rs) case TNE: mips32_op = OPC_TNE; do_trap: - gen_trap(ctx, mips32_op, rs, rt, -1); + gen_trap(ctx, mips32_op, rs, rt, -1, extract32(ctx->opcode, 12, 4)); break; #ifndef CONFIG_USER_ONLY case MFC0: @@ -2439,7 +2439,7 @@ static void decode_micromips32_opc(CPUMIPSState *env, DisasContext *ctx) check_insn_opc_removed(ctx, ISA_MIPS_R6); mips32_op = OPC_TEQI; do_trapi: - gen_trap(ctx, mips32_op, rs, -1, imm); + gen_trap(ctx, mips32_op, rs, -1, imm, 0); break; case BNEZC: diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/tcg/nanomips_translate.c.inc index ccbcecad09..2432c747df 100644 --- a/target/mips/tcg/nanomips_translate.c.inc +++ b/target/mips/tcg/nanomips_translate.c.inc @@ -1268,11 +1268,11 @@ static void gen_pool32a0_nanomips_insn(CPUMIPSState *env, DisasContext *ctx) switch (extract32(ctx->opcode, 10, 1)) { case NM_TEQ: check_nms(ctx); - gen_trap(ctx, OPC_TEQ, rs, rt, -1); + gen_trap(ctx, OPC_TEQ, rs, rt, -1, rd); break; case NM_TNE: check_nms(ctx); - gen_trap(ctx, OPC_TNE, rs, rt, -1); + gen_trap(ctx, OPC_TNE, rs, rt, -1, rd); break; } break; From patchwork Sun Sep 19 01:57:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514272 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp891109jao; Sat, 18 Sep 2021 19:07:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn/7U2uXSaX2YjUZG07XsL7c5tCHwTkrAFXGo51IjRPlgzOSL/n8yNKqXe8sp3WXi5zHD4 X-Received: by 2002:a5b:603:: with SMTP id d3mr22938784ybq.421.1632017269200; Sat, 18 Sep 2021 19:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017269; cv=none; d=google.com; s=arc-20160816; b=FsGNNXfNdiJN0HwgbS989eXYjdkjrwRE6rH418RzK3n0hZYheaeDFbIlV25k/48WkW KvRZPY69UoXndR910FPbQSDUOJLwlSh7zHxi3CbeDyn4885SFppikOlYCyhnGf6x8JOp o/ijVy8DOZlL6Dyi7SyZin/5QUQV3nv7Nd5VSvtrubTxOIgmtrF1vDNpdhVVc7vNnEfF AOpsTQGqxOnzldnC10P0db2bEQBJMu2SJs5pCSeH9KacbOmYq3ob2YqlrrjA8G/5WFU1 xxfA6N8Gw07KCPZ4IYL52vlt5+XE25a6KvA0wKFzKup5JnGWOS8HifYgXwTzfZxep6bA bMQw== 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=uagdci1N1+7PPBzUsN0twzD+fJNph41iqYW8v+b0TiA=; b=QUIlgkM01mczvY4ZELEYkdNYlukcKnYMlmDMLk7z7RBkec8efzyEI9lEDvkwVrfQRK hORihmw3rg61Z6VEI1iU6MpgD9GXxw5egkNMf27JkT9Qz27XS9F3tesvW9Jx4Zivm8kE nGv2sldIRj22OBKcUign0GczlgsKMWbjCMmIqIQIBI9yFK8w1Dhqp5JCxchTgV8RobRi ORP+OOxDRDTsE9FyjRhzsgNayTC9JMh8IwjetuIfkdMcUt/TWdcoufGhL3v24D8/uvTP 7O/SI9hdl3XwkrwhxQulEmcRH/B6L6zLSjZ8+0MNz+5uB8aIm/UQe8Rmb3x8QUvh62KA WokQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uGzRtUPi; 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 m11si10804337ybp.438.2021.09.18.19.07.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:07:49 -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=uGzRtUPi; 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]:58124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmFA-00040X-KY for patch@linaro.org; Sat, 18 Sep 2021 22:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5K-00042j-Kf for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:40 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:36856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5J-0005F3-2q for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:38 -0400 Received: by mail-pf1-x429.google.com with SMTP id m26so12899702pff.3 for ; Sat, 18 Sep 2021 18:57:36 -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=uagdci1N1+7PPBzUsN0twzD+fJNph41iqYW8v+b0TiA=; b=uGzRtUPidbNDZvsyY5KOPOXGIuZBIOq0wAcLFGquDGbRoZagGvtChqB1ilhfdi+kCg //VmteJkATboUoHsXfbca99VrlC9CDzKuRMEDTXcD3Lz1EaRbkde3DlV5Z6z5/NqpF4i /W+Lhiv4KnlxVTh0/FU5HuZAyeF4DjmvJd0fKDwQ6ER2xCABDoBNR9h0UfyzKEZfMg5f 09hm677wP8huGF2UYzj6+APFMPb5EQE6l/mJlhOb8+6hPokcfYw+j4DN0Rpx3ViDmTGU Db84mLKs2OVJ4rcEoLfneBxCKtpSUFNAxdIE6arX3UvbAPG/+bTZ8EF3cBho/xVsnMQ/ y9iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uagdci1N1+7PPBzUsN0twzD+fJNph41iqYW8v+b0TiA=; b=b5D3moGfVvky8Kydb6oXNdcmT2iL3u3kSoNgeqiJ0wPj7bFkdlYKW9FsTPmBNxBpqX 16h3NKFlefL3Y2+KijtHsuQym+tRdJY7vXPm/1ciEHzssyjiwNe1MbIMI5IH2c1UxeBv B7ObgR6QXqsSP7TK8a9iA+nYuAOTWtzDuNQP/lJRuRjWn0K3DPRsUta78bcVe50RWhFM g7Isw8+RENJL2I2mIDiMEVmft5cN3dyQZYIeWdkQRv0ohqTLSc+MSxJj2XrGf9VIKv67 CauvO9SUG3Py5dBnYE8zlCmKq34QIVhvaAFkIOcX7zauTeP1NiTiTOXgbYT4cAE67zvt rfuw== X-Gm-Message-State: AOAM532+MTQ2hPaUyU17mpF6QBsv1OgIDbrjXogyOyf0h4z7hKQG7UTj J5J2bsrWEKrjMdmwkgTvjIApZ4obKsSEjg== X-Received: by 2002:a62:d41e:0:b0:447:53ac:9e39 with SMTP id a30-20020a62d41e000000b0044753ac9e39mr3410910pfh.72.1632016655746; Sat, 18 Sep 2021 18:57:35 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 19/25] linux-user/openrisc: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:12 -0700 Message-Id: <20210919015718.466207-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/openrisc/cpu_loop.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 5e50c0d743..9f8dd0afd6 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -28,7 +28,6 @@ void cpu_loop(CPUOpenRISCState *env) CPUState *cs = env_cpu(env); int trapnr; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -59,27 +58,16 @@ void cpu_loop(CPUOpenRISCState *env) 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); + 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 Sep 19 01:57: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: 514279 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp894436jao; Sat, 18 Sep 2021 19:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOpPwbP4FU9syZ7FgVceoXgeUIeO8u+P2fpeCbS7SbFheIU7hGA8mMARdk8DBo01HM2Spk X-Received: by 2002:a5b:43:: with SMTP id e3mr24597812ybp.469.1632017666961; Sat, 18 Sep 2021 19:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017666; cv=none; d=google.com; s=arc-20160816; b=ocJXui6dQthUcAGT0FaWdAGiAmSBUuz7s740BUTxXoM103lyq375murIoVgx17AHVD c/I6kNngIQ4XH5DXX+Fzgp4GKG9eGQntljA/nlQhSW4wnqbjEnKOAfSfeusRx/xnuzBt HrNd7W+udiJZ18fa4nFYxsNtK1KQeaxgloT316a9mntggwixtkGLh37bn8RmGjn2fW9E anPZhfL3OG7IIwZ+1dOB9CQkPVtdCcz3JjaUgIEbbHy16OsRdRlKQ01NI3SGSHbxRbKe D8y7ESCweAxGnp8hDEQcIh6JDxA7PorwUNFys6eu9q4onNAfF/oS4UI0d1W/v7QSA8Uv Q6tw== 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=36jggM214+fTAW9gTlMHtMxsJLBpH7zUDMElwE1JXsw=; b=owQIUvR3u7SVAf7Z38+b2Iuch06RBMrcByG8hmJdMp/thr+RQcDin6IdSzj4+sdmJI rg17C2dSCn+mhU+XZx6z3uhK8ryEk+X+UnXWh7e+N97V2hAKhEU63eRvZCjR96DyZbWv OYAVmqd7FOdaqIcsARQvTxR6Gqd6HtMm/3xyfjtlydILU3+GrfQPBsIX2xSLXkmbp+zt d3Ig8l44FPW82363yfocHIDawAalQV+0xTh5hTQCVn23jaRXGG+jeLZZ0BWuVGGLexg7 pyUiNm497rmTpMHVFq+mwlGOzaqHznAjI2s2xbIGMpWSdZb7JOR1tduQvXwIO56Kr48i nk7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fiZrd9cZ; 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 u14si12346225ybp.265.2021.09.18.19.14.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:14:26 -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=fiZrd9cZ; 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]:46580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmLa-0006db-Da for patch@linaro.org; Sat, 18 Sep 2021 22:14:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5M-00044G-C4 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:41 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:44563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5K-0005FE-0D for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:40 -0400 Received: by mail-pl1-x631.google.com with SMTP id d18so8724453pll.11 for ; Sat, 18 Sep 2021 18:57:37 -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=36jggM214+fTAW9gTlMHtMxsJLBpH7zUDMElwE1JXsw=; b=fiZrd9cZmhwZFY+lcF1AxDRZclxH3Y+u9Ujy7ySqP7BT6VqdyDbCJ+9ajh6pxEx7vf Vw6A3ZtxvMT6m91XMxBMYkhQc1IcG+xxn6l+5DIYeR1y7aZ9XH9Q2omtLWg+zRCaefU4 sGRh+FhB2sY36DSnzaZe+0JWI6bR99FoFfnsVtzhtcWasSdHlyjAlE9K5vJ6wiK1VFva GxshGeR2LtQ6dJOOpaWMR7DCnT7PvVhOey4+tavFVThf8wGaStodByCp0UOwNwl0j3kX i9zr3rgTn0LXza1RwvgEHlRAlfdJT1cloctMWBDug0Qi4ps1Zw/VsnZWtQRPZJpWUw3h pTJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=36jggM214+fTAW9gTlMHtMxsJLBpH7zUDMElwE1JXsw=; b=AoNTqJ1FoWm5MovEaWZki2TnB/0qBZOyoLD3jQbkdNuFj57ODaoPyckQXw75lPFv7t SFgJYRfk81aP6yqSmXN9AG9P6aayZUy1Atg/b5ZrjovvQNH3wrbBdto+nLMQZbHLegyB XLpOXkan/IhDuFNByEfFYFjeWTbRv1UQQA3AYVFcJ9Al83tdF6k69dr0KhWhdZ0vDfCh yTrQ9r1VehNXArX+llWvpAppA2GDkJ158a/PIaJ8rXz+KOrjpUqbBMD6UmnI4JCOfcpz +QaBqxV3zZAZRemwNeS5+iWNjhzZhfPQJuB14zFIf0ohkJZ+NLpyW+MopbcQhYAOhUh9 CZ5g== X-Gm-Message-State: AOAM530jxV4nDcryJL5HhaMNDhLd9K9ecm52Hb2slZZE9gZQsxYJ1xVZ 9WEMoPfwg80Iz5H4AIHyiDll6SLASg449A== X-Received: by 2002:a17:90b:3e88:: with SMTP id rj8mr30359357pjb.86.1632016656602; Sat, 18 Sep 2021 18:57:36 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 20/25] linux-user/ppc: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:13 -0700 Message-Id: <20210919015718.466207-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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: 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. Fill in the missing PC for SIGTRAP. The fault address for POWERPC_EXCP_ISI is nip exactly, not nip - 4. Signed-off-by: Richard Henderson --- linux-user/ppc/cpu_loop.c | 146 +++++++++----------------------------- 1 file changed, 34 insertions(+), 112 deletions(-) -- 2.25.1 diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index fa91ea0eed..2b006317ba 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,14 @@ 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); + /* FIXME: handle maperr in ppc_cpu_record_sigsegv. */ + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + 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); + /* FIXME: handle maperr in ppc_cpu_record_sigsegv. */ + force_sig_fault(TARGET_SIGSEGV, TARGET_SEGV_MAPERR, + env->spr[SPR_DAR]); break; case POWERPC_EXCP_EXTERNAL: /* External input */ cpu_abort(cs, "External interrupt while in user mode. " @@ -162,35 +116,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 +148,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 +204,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 +237,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 +293,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 +375,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 Sep 19 01:57:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514280 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp894495jao; Sat, 18 Sep 2021 19:14:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoBA2/h3AIhmOPXGZHoD7EU4t8iU0GLlB5r+leZNiib53jwIvdJn3npgJeRYOWam1sV6yP X-Received: by 2002:a25:ca54:: with SMTP id a81mr21922614ybg.349.1632017673585; Sat, 18 Sep 2021 19:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017673; cv=none; d=google.com; s=arc-20160816; b=kPmkS6YyD7G7lB5he4T2iGDNSisyZL+JtBdHJs973+vwM1v9lFZh1dMVxdV1dqZADa FtClUAj6xDKOhDFqzJX55C0g78enalNwj9XjZzI1vYecolshD3AToitTQuN1WiWgQjKt Y6OoFo4bRg3ku7pmjPs5BY6FkHhwiAd3pIz3c5Ra/Ss9Gzo/Zbr4FB+W3Wakb068RujT rPVxvhRI72LAiBfkYDCk4plqbHAhv5pT9f3rEiEDy8E0R9Rj1J0G/jYfOfy6+9hbxgl7 6xoF1v4hjyDU4x6FkxBI9kIjOU9kLfPAW4lbH6sYTh82kVAWiOK8FWay/ONjIviGyye1 HBBw== 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=T1XRhqsnyLvkQPB9MYeH1KY/Vip5aHodZw4fWmIOwYc=; b=tpfAQj/MBmHrLDhs3CBSF7khb1S+xRrphvekYfqN2acVIKRsWR87syoJ/oqzL+J156 UrbUhbN1SuWhcVnBffPJE8f64selwYB1zCsW30ik1KCO8qWuTFu26i4DQsw4QBZM4kbg 11EVxnsfAi8MLSal58EImcXIZiQhlOFwQvelMAew65MoK3EigETVvAHOkDsVA9gPQJDE j2JKlZR7gfsg063IU4IjhF+ZdMqElXe7aOtmg1XWXSYM0fGeLd1rlee69K1Jc2Tng32Q HrTgP1MJHG3lZwg7pIuZs+u319wQHJ1C59wEkn7cIB6oJ+yLwmN8iIk3b7RHVc6agOWd 6qow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Js7NMZX5; 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 i62si12974197yba.23.2021.09.18.19.14.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:14:33 -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=Js7NMZX5; 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]:46906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmLh-0006rf-1F for patch@linaro.org; Sat, 18 Sep 2021 22:14:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5O-00045Q-3E for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:43 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:46683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5K-0005Ft-N7 for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:41 -0400 Received: by mail-pl1-x62d.google.com with SMTP id bg1so8717582plb.13 for ; Sat, 18 Sep 2021 18:57:38 -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=T1XRhqsnyLvkQPB9MYeH1KY/Vip5aHodZw4fWmIOwYc=; b=Js7NMZX5iiEe3EcOS3n565oKM0PQ+UaNNSbIA1Vxu2bIZXOCP5Ew/05tuMQnjsP22B /2ei7kpTHV6rB799hGyTWi+nF7rw0gyji1htuuItECV3CmaTN6V53IZvePoUDv5Ts4uD fbd2lePDleW5vBGLpQie+E71vPAY0YfzJFITL1v33D1vkQpWo9R85laj4YoxLWyOGFy0 Kl9SvofuDL7qgYHFo6DtZSE8U1XHHO5J2jDhOSn9sOfxHtARAhIQZEGPp9VcBju1dwAT GSFpDuZGvvApwepBoVodElyp6zG9eZ4grXJ0hXF8CeezvC8JcLQ88tt2LbwzzdFRPBl+ xJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T1XRhqsnyLvkQPB9MYeH1KY/Vip5aHodZw4fWmIOwYc=; b=dNye2kbP02MP2Hr1lMhTY5pxuTmGeaUJS6iMhXUGsMp8UwJBD7w56KsZAMFk8NsgjO XWje/eeSSmuTU3nZYlay6VvpHO8cCl30k8dAVJO7fD/vO3foABwH4JnYj9v7RKbZCxgG 8+ICLUFkIdXATvcTCulePQx5LRkhUfpYqbTKA0mXvXgWWVdPW8qpasvW6EHd1HtKaDS9 cuJtya+a1ugefApDvLoAqd/0fqlTXA6B3SutMhEdih4upKO93l9MhPhC26Srgg1HvQsr gm8JmF+kCJlqgANPV2V0FiBXTMSRlyuPRgUEc9fThTUbXhdMtkuUa4SlnCgPh0tWNNv2 TG6w== X-Gm-Message-State: AOAM531/I8VhUHnuqwIoowUouahQFc4/aZZXVKJh7HDBvqsaB7x7qxBX qit2omrklXKI5R27UVTUb5xzJUtnkykqYw== X-Received: by 2002:a17:90a:7185:: with SMTP id i5mr21235178pjk.236.1632016657379; Sat, 18 Sep 2021 18:57:37 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 21/25] linux-user/riscv: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:14 -0700 Message-Id: <20210919015718.466207-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 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. Signed-off-by: Richard Henderson --- linux-user/riscv/cpu_loop.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) -- 2.25.1 diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 49fa2209a7..9912796ebf 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,39 +73,23 @@ 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_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 Sep 19 01:57:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514281 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp895375jao; Sat, 18 Sep 2021 19:16:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw85KXgHCqGrhbZXp7u7eQjetCweYM6l+DQMjbzamYkFEqJrNFpKZ+HR2n+njWs7Z7HB3sR X-Received: by 2002:a25:c011:: with SMTP id c17mr21948508ybf.291.1632017787826; Sat, 18 Sep 2021 19:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017787; cv=none; d=google.com; s=arc-20160816; b=V/tEK2PcuVYlP7gcSqX2Ani4Buon8hw/OEBZDCbHG/7zBQZEeSUo3VDdlKpHDzcOxw gD5YaggP7DYjBC1bB7X9VaV+u/gjs6dOwO6ei7WnedsxqQ8pMs9X/YKQoYLu4pFx3pob jBAkNo/5faKu3E+gbvL71f+V/86UCYHEJ4Hfn1+gn4R761Rgh0diUDKmdA0or3p1I+mh HFRNejtx+P8930S8ZrAEBZTg0Vp43Xpt40+XHtX9MvhcL42pTbOF0Ag7IlG9hFoeVPfy TlVSaBXFYkmCUkqcvplMJCwbhRsEvNWt6KOwg6nG4eYo6YXRLmdAC55WpXXsEbVZvnJr 00pw== 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=M+LdqSLTC/toL0xqBBht+5qqnjjIGLiPFr2liaHYD1A=; b=yubBlYGDBgXmwOZ+ewjTFyR6GpnAPHgYrRRioW5jLXq0e1w/CQjKZu8PdvoXmIvHJc j9r/CYpvMzq199YL++kB/4d2Uq0T5oX9i47J2qBxTFeTJ4lS6KhU1CracoLXXBjcZn8J w99dI2ipuBQEzDEFxuyNEB13Q6QBo52DWMlAK05B+L7O747cYeRb4kuePG3B3An4wjAw nDkR9nOHzfRzx/n6zVSwi0nqY7oJfizqOzGXVWWvgvmE1IJuaMwkhhduL+wlnbtCHJzk YAf1RTMx7fyHJITGAJ3Yp1+RgRHlWcJysxtFu/tmHHmoLi4pJD8MRtedgNiXh7tHe1AF gHpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n970EApo; 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 u13si9669245ybc.94.2021.09.18.19.16.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:16:27 -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=n970EApo; 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]:49602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmNX-0000DY-87 for patch@linaro.org; Sat, 18 Sep 2021 22:16:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5N-00044k-FD for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:41 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:38746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5M-0005Gw-0Q for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:41 -0400 Received: by mail-pf1-x429.google.com with SMTP id y4so11344441pfe.5 for ; Sat, 18 Sep 2021 18:57:39 -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=M+LdqSLTC/toL0xqBBht+5qqnjjIGLiPFr2liaHYD1A=; b=n970EApoHmNzjtUSEdhXHLazswV1cVOO/pPVyTWTf2RPM2KUjg8OHT6iPLDiJZZGC1 hBhnGYmATnzODxA688git9OqngctEQNohwNCeSkjMYcowzGU9+3n9kg36yLnqv388Ps0 f6wFluYAK98PynstFW6ji7rtRo8RV/8UQBFxDDZ6tTyTglcL4tROmoXXsFApKX5bUXCt jw+/n2yFLa9VP1F8ebrCRc+ubcWw0+AkhNHSfbI3ezDrSNAa3T5z6a6bFnpLBnFAKkxy 5DdIBY0ctLVi7PF2xFo4U/WCZbeQbUfBS7dIcvMrpspe0+XevVRCpHQpuDm+vPjycNd3 4Ycw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M+LdqSLTC/toL0xqBBht+5qqnjjIGLiPFr2liaHYD1A=; b=1DLNGZB6vKjME9tCVzOb9FdlIeb7WOpKZ5GBJnZWsxDF6yzTuD5J95VSvDvCqmH7c9 JNsQMbvG/5wXBrqqLIPyI35R+DXeaoHgDW0qArh6tbGbqy7aiTzoYpHspD3ybjybSjck fIuC3lp4prRVxAhnFbD0QxfkobmsODg3iub+COKEO9PkksWvAll4Qu2f35Ajym5BtVH0 2Zxn543KVj0v92uOgvH/MUPdfCcn753FjtozD/F0ipVLwnFTKgm4QcRQL2fX6FxM/3Fq l5iMMNaOsZdfilG3mziZ4WfVAhIgQL9n4mA+eCBj/bQEI0zKbcOK1Z0an/50QH1VspLF HEJQ== X-Gm-Message-State: AOAM532yW6YZ+Y3l8lDDgnLtWrU9fHZgczAQGBTQBOENTxadYzegIudu sBJ3tMDmwzjZCa/Yw7yrnh49WHf6mdr3kQ== X-Received: by 2002:a62:6246:0:b0:443:852a:2a2e with SMTP id w67-20020a626246000000b00443852a2a2emr14475941pfb.14.1632016658184; Sat, 18 Sep 2021 18:57:38 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 22/25] linux-user/s390x: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:15 -0700 Message-Id: <20210919015718.466207-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Signed-off-by: Richard Henderson --- linux-user/s390x/cpu_loop.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.25.1 diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 7a1d032227..cc034b860e 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -57,7 +57,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; @@ -157,11 +156,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 Sep 19 01:57: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: 514283 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp896709jao; Sat, 18 Sep 2021 19:19:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym0DnQzz0Gb/87dgvD8ipLuBo43MONTF4M4FepWrZfYcqHGA7AR9VgWU4Clj++KtU8gp66 X-Received: by 2002:a25:9847:: with SMTP id k7mr22907110ybo.170.1632017953253; Sat, 18 Sep 2021 19:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017953; cv=none; d=google.com; s=arc-20160816; b=yHRFvLsaJbtUjfzpdQmWj8EkUfFi656oLqPS1nSiPfBPCKGsgew6vVNAeG3fBOx/Vx fTlF6BJoJwRteEyWvJBJtacDj16Ahpx8fG0jDrsel4Np0HO/AilwBLzVWGVpIL5XgE5t bm/5ofohYFpYev9wUSIk5MmM6IMH2+1T2GNF2QPEKeFLFei4usd3AMCCakYJEUtwHok7 gqD4mTm//0L6SVs+OxvokvLSTKvB+a0BGhnZtJBi4n8qd3cuHmCq3f+GdRWKkzJMyCCG kUkdERyXwagy7npdKJoTkS6M7bi82BAGelFyLj1NSOQVXtvt38AVtjAfyM7VtKeHykmG S0TA== 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=56XZ3RwQ/YCK3yV+LJbUGYXQPwjh6Dg9hx9o+/5eyfM=; b=JjMRNaMz60EZNOzeohoOkh9y8FjuPLhrHzW2glC/swktmw/PAZJh/iNEzLsdKQPNEX mHqW8XXWidkCr0vfg3Mtj/Y4EtUczqNqBj0gnEw9sIgnXATv1H4x3OuH8BONxLnbJTvp dPMolgIuUEgfZjjQM7SftEHniEZUqlCfyQn24SVii6F8OwXYPqx2a8NIGvdLyB4if/83 VsKkXO9VUPj+N6l4jCibvP9ZajGh/vt2CrLRMliH/wvOr+iGrTkF1Yud5udGIfewSfSL sHSIT67NAuR/8ijf8qNcpd07aShQhvFuTb6u8xJ3mheqPCdmL4zh3QkQ7JCh1UHsx4Vp D7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kw3nvOJ2; 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 a3si11302789yba.370.2021.09.18.19.19.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:19:13 -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=kw3nvOJ2; 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]:59170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmQC-0006fh-PC for patch@linaro.org; Sat, 18 Sep 2021 22:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5P-00045o-Oh for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:43 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:44849) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5M-0005HO-8n for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:43 -0400 Received: by mail-pf1-x434.google.com with SMTP id b7so12832540pfo.11 for ; Sat, 18 Sep 2021 18:57:39 -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=56XZ3RwQ/YCK3yV+LJbUGYXQPwjh6Dg9hx9o+/5eyfM=; b=kw3nvOJ20zIcHjeFQkjElNoKNm55ipCFPYJ2EY0Yvrjh9Eu9HCjazkoFYABUiwxgKj HrSOGgHBOU26/qcIW22RgajvesEc70M6SYhzxxy/hxsKHX0m0I0NnslY3PqFYkG7lkSq ANEogJjn+YLt84BuZaG/YIt8rigwjuiBF5JxihDacAHk+GG8jP/MvZ9G2qDUqSUSJ+ck iSI86lAXku8SsG/7nNULCMa2kwJyUPpALBvoQYVa4+Xs4v+wxdi4eDy+Q0unI2iVqneP byhjTSaXnxmEdye31vN0Nd8e240K/q9aqXIBNzcd3mf/6quMIjYoruBBdbxYoqqWu7C7 qwHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=56XZ3RwQ/YCK3yV+LJbUGYXQPwjh6Dg9hx9o+/5eyfM=; b=K7biC4T/4c3I2xBrz6bIKG7xwd4HXc/PAa3Z0yFpgSzMaNeWm2jGjJgIVtx1DJJM3K beru7ya80kfvcsbWPzjMOGgIgqpCCbndLbNcUJkNqlc1w1fTfVQ5leLzC37XEm/eYETq h5/tc+Cid4R+XhX3UdHJ6G4cN2x0CX+LnoIBWZ0v4zaj35YJFusKFZspLZ7a70O7U/sK E2dIV3s+Vjag8BqLLbu7b+R0gEoMqg+iNgZGULuEaAgPoK9kCYlxvfnHJGlMpg4pz7j9 nlRrXuLRQ9RnAy33iGTLof+Sxw0Cl7t/AaiSDLowYFrlR+9OsCWkaZ3vT4Z9ZC4SRmtG 9Jyg== X-Gm-Message-State: AOAM530QFfyq2sHBCvSl+x9d61NBF53OHMK3tcYYviAjqAaJRgyyo8k6 GI5ya/kooGvOdXgMTmuefMD1heod3tl4ow== X-Received: by 2002:a62:3287:0:b0:439:bfec:8374 with SMTP id y129-20020a623287000000b00439bfec8374mr18555242pfy.15.1632016659015; Sat, 18 Sep 2021 18:57:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 23/25] linux-user/sh4: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:16 -0700 Message-Id: <20210919015718.466207-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/sh4/cpu_loop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 8408d0c42d..3d0dd6d34e 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,10 +59,7 @@ 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 EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Sun Sep 19 01:57: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: 514282 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp896227jao; Sat, 18 Sep 2021 19:18:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbapp0T0wn6vfAum/qbFTVmwgM59QspGW/N3UtDgIracUmhIIE1XI6oVasv30YQOFrYpn3 X-Received: by 2002:a5b:4ca:: with SMTP id u10mr20612508ybp.344.1632017890841; Sat, 18 Sep 2021 19:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017890; cv=none; d=google.com; s=arc-20160816; b=x+tWSVj77Z8b5Rb0ylxZo0zBvkeGpZvb8OWIcQbxXUS+u/JqyU6FH3Bq+gWypoH9iL grfNkk0KMv+WuN0+Wb+0ZlbrPOy5OpUOYK+wGvnf4ctsXkz3cdw86So/yWBE0fQe5GlN kppLX9BL/F1pVT56EYP/1UUztrAw1I/xw6ZRwUFVPQID56gzAFLq1EtCWrHv3TpozQlS 8lOV4j8BbLwmS8qf5wr12oj4qjyK7mUyzHkg/tPRZRypF/y2mXeiPsCqflhunB2BxEtc lk/dk4BDZgKhsI6DJx32nXn0+pnjZ/F1Bpn011txM3Nex0ZIVSXikLN6jHQKQ3Sa9ImY Pqmw== 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=o4amvpiO+LWSxg4WGAwTki8YsyCcWz5FR88AOy0i/nw=; b=X24UkCUTpY4+zVq3QdC+O2Pz7H4hqnCrHs4XbB8oNINEexQayw3t1OoCObxEvdPz/W ZfFh7QyaeyI9hb7sxn+pcff6PQtTYtdcqbAUiW/qTtynK1EN7QG5skSqbibabE0pPr8m PL5DteIxpX2EsGMIecD4hCwOK9PGKVFD8RPeXzKitoueX766cd7gg2EJgZqA60hQTFIj okdzV7AFh1dUj1H83Wovxp/7qT6U3AsEQuionCazcbKEmFFLfZ4soBG+FohRDZ8PUwPP qNzVPha2PlhNbDt3TE4ofmejokHC5/nAW+5seElcvi/WjjAmf2WhDzIs41M78xD3Gv9f JzBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SIcgwHkS; 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 p64si10924304ybb.161.2021.09.18.19.18.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:18: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=SIcgwHkS; 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]:56956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmPC-0005CU-Bq for patch@linaro.org; Sat, 18 Sep 2021 22:18:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5O-00045m-JY for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:43 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:41532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5M-0005HR-QO for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:42 -0400 Received: by mail-pl1-x62a.google.com with SMTP id v2so8744305plp.8 for ; Sat, 18 Sep 2021 18:57: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=o4amvpiO+LWSxg4WGAwTki8YsyCcWz5FR88AOy0i/nw=; b=SIcgwHkSe0q/kkQEcTTOMoD8TuCPUEDAyAdPEkUXh4FhX17JI7Gyv9dUEsHzPiJ27i ufDQ/5i4wFHR8AculgXxOu3Pwxz48+p3QRuIcluZdSGjqurj9KITvE9ZDVhlfwTz+kCt 7Wrl+qPaq9xQYJMULhpotdEJDaR40zhYdG0emkplxBLLLeWKrVlz3a6BB01gb1CKW83I f+SLukiPBKWQt8dx47pQfQAgdo0pCbMWfr+jF/S2XrkJta89Nkb0jdC/NOSOUr/02aLM d8uYvVDjOmRMvFkQu2X1iRroJrJskF3MbdwAqVYsE7CN/nN5bEmxGsR6t5VyPwpjofhM JDBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o4amvpiO+LWSxg4WGAwTki8YsyCcWz5FR88AOy0i/nw=; b=SM8vkBy/M0DOBCRU2NYHOKzjAaqxhlf0ldjiYY/AletYlPlnrTSRXN/vZZW4cuBxgM R80MpSPs/O30OGm2UopYTzkQPk9eyRzxbPLDSRGeKmW7K89YJ7tmxWWsIvRJ+NAGcNoF JSj9s5jhxXIgBgmDNaOqNFrJUeFW0yn+y/levmSUBRTwidd/ExtVn7aW2ZZX3vwoHRm8 PFzRee3H05n8hy7bRl5b2pZ0jzzZUsbzpGM3/HO1c/L9u9v8wc+0xhPKYUl+Opwf1TvO NsjZUKtfKMlq1xh+Szs2YwdVP7UBcTS9P/c7SKdfu3A92Tpweg51RgCa9jqJcMtWKZza ofQw== X-Gm-Message-State: AOAM533HobTd5G9JOiv5jvkVNCR/8TVrqmWsmlPS1HLUW9f4DRaVUKxw f0jkFAR2Ml2Rkxa/fFyfcHNwCbMz7SIfow== X-Received: by 2002:a17:90a:192:: with SMTP id 18mr30075819pjc.119.1632016659565; Sat, 18 Sep 2021 18:57:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 24/25] linux-user/sparc: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:17 -0700 Message-Id: <20210919015718.466207-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index f5e0de7eaf..414cc95740 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); @@ -239,19 +239,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 Sep 19 01:57: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: 514278 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp894365jao; Sat, 18 Sep 2021 19:14:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPXIg5tHESV1+h+KRBEHv6bOxU1JEyrqDsVteTWmOHS/PJwv4xfHGPTn4k3jHqpU2Y4buR X-Received: by 2002:a25:4843:: with SMTP id v64mr5125229yba.210.1632017661906; Sat, 18 Sep 2021 19:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632017661; cv=none; d=google.com; s=arc-20160816; b=pVi8xeUjuWEsx10cvPZtdFOcr+0Qz7OauOlJEAR1wGer8JiYqDr1j15/U6P74B/A49 N+Ck7wINNdMk6AmvFrRPuvRkDTrJwc4gcClzP6pwiAMRxQFW5szSkwIM2ufwyYU+NZlc 3UUWOLzEeVCwrHsc+JPxvuHaiJZGomvhAY+Ixy9xTMcNAvfx3doe/DgB5VCR5kvunQBn szHfTjexzxDS8VVtFsDwNPo5HORJ/+HAjsygKW+fDLjjehGP51YaM4Hl1RX/K+m6Sl9p Kv9TU3XoZysLeSpaUOrPd9M772Js2uxOP0vnysE9Hdt2KykJGayfD1jkw2cAQaguIz3k wHEA== 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=dG8D726sLCXCL5Zfb1IUY8jWTYav0TmVZuH4s8Ps4fo=; b=HmIwHpTf+MNNymsDWmx0gSXxiLPlvyssR4r7pKgkEMnVSU8dmkVLcVnkoA+lBgNUYF 88foIWwHusTL6nT9K6tWw9W9YsJ+TYFrcmv7+AOFMcuTYJvPnAxwOf+v4a6qmNRMVJEH ZhFRrQX3/8qc74pEq9nHNzsmobTxlM984lH1JgG75HlOD6c8SAoZFgeHdSLKutvq2AyJ E8gEszPTeiPXE3aRgS0WKWi2JY98QtgeaRuxBvnHgHc5k8X7oxGJG72y9F5//eOKd/3f jjgO4wsni5fdkPWiXQLHlW8UqzAmEeFmSKvRNTLfQWF8D93eaYA7jHv3UxeCz/dtWAHs sLOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LJX2tj0A; 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 s8si11927355ybg.430.2021.09.18.19.14.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Sep 2021 19:14: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=LJX2tj0A; 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]:46560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRmLV-0006d9-Bf for patch@linaro.org; Sat, 18 Sep 2021 22:14:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRm5Q-00046R-Ke for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:45 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:51182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRm5N-0005Hj-QK for qemu-devel@nongnu.org; Sat, 18 Sep 2021 21:57:44 -0400 Received: by mail-pj1-x1031.google.com with SMTP id k23so9586931pji.0 for ; Sat, 18 Sep 2021 18:57: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=dG8D726sLCXCL5Zfb1IUY8jWTYav0TmVZuH4s8Ps4fo=; b=LJX2tj0AWPA628j6fXMjCZPvAJ8rNgZvDGPjlQ8BKprcYAAWkJKTmh2kmnjPy7UgfE wwf8WcSg/oaVahcVexOeZ0nCTvM28p54e/dBVCK5GVYBCWwt53YTbs6GStAayYb1qPHi 35CGV1aTPGLg+4aK+8u6uoinllsoB1R4yCVAhgJmIQ9mRk+KVQR8XH1Yme04D3hKdlKq ODHIxouRERAYuNvbhJO1tc248GtkjngVBQdOkwle77tgBELZSqW7p7rkSNO32hpVsOYd Yv+YpjciCY7mgEp0Spv32IZa+7yeOD2kE3Pr7p/4BSFrLhhZFMVGS3G9HpS8xVRC6WJZ SJTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dG8D726sLCXCL5Zfb1IUY8jWTYav0TmVZuH4s8Ps4fo=; b=DOHYRgY8dYB3OEDBHkdbr+bQkW1vWQBblhf0HMTqToEGnvrAekfz2f8n0ce/cYaWLm AeW7Z7oqw/X82vf6jFy9QeD4ZtKsqkg5SZXldh+m9nJH1JXbT9KWMXifRdHoWtzfgaVE 8R2B4AEBeCAuwYQJ8Lex8CsJPnC3eJ7DXo7wNR/wAI+DeMwoZKHmglgwTJF553XJT0yF di/AohUXFpxEcSbU8jJPTsUPrnHC+w3rP35Hi2nbL8dbCsYDppVVjCiSxf8zc5sUfEyW ZbgHM6MjykLStaliGr8rFNnYQfWSn+7LsMmMvBrkzhs4nQptubVodnh5yy0jRPPkTJOg L6Jg== X-Gm-Message-State: AOAM532COuP5SpA2mDHBfzMYZtv8P2iFiT4c5O0M1CwjemWoIWza3Fqx Ug6HQ39IzBAR9Lmid9zs4gcC5ZzcIHGaSA== X-Received: by 2002:a17:90a:578e:: with SMTP id g14mr30382899pji.184.1632016660245; Sat, 18 Sep 2021 18:57:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id k14sm6747899pgg.92.2021.09.18.18.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Sep 2021 18:57:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 25/25] linux-user/xtensa: Use force_sig_fault Date: Sat, 18 Sep 2021 18:57:18 -0700 Message-Id: <20210919015718.466207-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210919015718.466207-1-richard.henderson@linaro.org> References: <20210919015718.466207-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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: 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. Fill in the missing PC for SIGTRAP. Signed-off-by: Richard Henderson --- linux-user/xtensa/cpu_loop.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index b48781c6e8..7392e83c9b 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,11 +216,8 @@ 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; default: @@ -230,10 +226,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: