From patchwork Fri Jan 7 21:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530497 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp718538imp; Fri, 7 Jan 2022 13:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwlKlTyZ1c+hSGR3zQ4XHOlg2hA0JRsp3GFqHndQFIhUeFmyODFGxu7d0MtDUCi3Ui/bMI X-Received: by 2002:a25:c514:: with SMTP id v20mr4503270ybe.684.1641591482481; Fri, 07 Jan 2022 13:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591482; cv=none; d=google.com; s=arc-20160816; b=BxMwof6ciH8cVWw9AJDbbubDM77+hl3d20BKSWsbqR2UUAxAEhcuOfW7yzPls6xR6p oLluQoL8pa/rNa/klKQ6xpptgetuQLRiqQXodBcGOIQRq3InKv9MaeLAYTUHb1DJYSVW zSNS/Bwvv5dI65blWjC/JIgycdHwqBuBNcSzrGOYI6mCRo7QFpMssALWDDPhkxz99+Id jbpgqG0pDSm75fQbK+gpDvMpAT3i4+8ZM26ufOGRdhKyzv6uQLe4P+MtTgz1MfbPMZYU b+jxz5KzEfqJscRVEHg66d1YqnRRfMIWB4q4lcExQ8xWVwNUM+6q5EPQeScb11rTH5JR 1Isw== 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=fwWk0WZDtoCdr/BQ+wy5whxmME6fmMq51sJIQEkG8UQ=; b=pHgd7K7JfZYq4jmd38yQf7LyPC7FfS9gpWroIdFyAg2RjYDK6kg7zuvgC1/XaHhyPj Jesu8IJ7IpC6EenCWJQ0/SlPxAAfsFZ/tY+OVxgNiv+7B+KKjgT0SxcyDr9LRsuqCkuy MypxQNHZO695EI7rWxPObplahM4QBI+YS7SH08dRIv3Bp5F2o29yjyKvOKpcJ8EKBaEC 8845t9Ii6rfTiIHKM6yzhurAKocSpE+RbKtivYqP49nFl9FoWA5CVvf1r9hPmY0VLjOW qhegsvYvrb55fQfkDYmYNEW7MXFdM8UV//MCAV0w8dRUhwMGq0oyDpyPOxa5gZ9u7iqw 6RXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DUK9d69H; 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 n4si1142016ybl.728.2022.01.07.13.38.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:38:02 -0800 (PST) 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=DUK9d69H; 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]:47274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wvx-00034n-T6 for patch@linaro.org; Fri, 07 Jan 2022 16:38:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqu-00057p-PF for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: from [2607:f8b0:4864:20::52b] (port=43679 helo=mail-pg1-x52b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqs-0007lf-Lw for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:48 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 8so6481096pgc.10 for ; Fri, 07 Jan 2022 13:32:46 -0800 (PST) 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=fwWk0WZDtoCdr/BQ+wy5whxmME6fmMq51sJIQEkG8UQ=; b=DUK9d69HZDkSgCk+JMnw4frbTHSlpGqbY7ulCAFmucA3TUpJcXkOIevnB+BO3cPmSi oY2V8gWMpVqBpT+pnNBsOtfO3oFCcQpUYv3TrA29VnLa8o88LXoZvlCwoFzKxH52bTcH bynz106HUykw7/JkMUMqWS+zP+yOD7pU/lkQdLoxL9xf4+uYCl2ZBsjiIGrFEMYTQuMH 9c3YAilc0ElDefGWykKg9PV5oDxJvew+VeX1WbJ2J/v7IQdaQQ2tNEP73zcQGiTH0IrD 2C7jAi0NMiep08/GEFN6Gnamh9PH1TNmJnvyornGKglq3ZDvTKVgJLsFMb7eLTnDmN9+ wN8Q== 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=fwWk0WZDtoCdr/BQ+wy5whxmME6fmMq51sJIQEkG8UQ=; b=CLmllXt2OJew+idq61rUhX9ft2j4lAOBP/RXwwgBaO9TNO0vE25R/6ha8pDh6FSf4A 5BepId4q03gFmCiNQDws5WdINxTEyp6ZPcrQrvtXbsyDNwdctxC3HWbwyMItqVZ9fMYq +qle1TUs49glXyGkMzMmWilkyuaeMXR99ktmO0UzrC5HRO7rzYZlWHol8RdRK8+yrc3w 0wqYqZ7dWPGl7h/LXytnm//GLmd/1Y/Iozwa/7do5FE+wfd1Y3RH/3UuaYYU9h9I7Rgj cQOcV7fDUNb8+4A+yruqhNPlxMjb2A6wGGnTs85OSBdIg/D64HzgvOW9CV8bF0aTsoO8 Rpcg== X-Gm-Message-State: AOAM5321UJKoN6PdClTszQFTLQuVEaV8rew8tMr3AZOzpL67pieu5WgD Oiw0t/hviE9fS4Uxby4tfdhmMquh6Vy4TA== X-Received: by 2002:a63:6945:: with SMTP id e66mr57320935pgc.237.1641591165392; Fri, 07 Jan 2022 13:32:45 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 01/24] linux-user/alpha: Set TRAP_UNK for bugchk and unknown gentrap Date: Fri, 7 Jan 2022 13:32:20 -0800 Message-Id: <20220107213243.212806-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::52b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" These si_codes were changed in 535906c684fca, for linux 4.17. Reviewed-by: Peter Maydell 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(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cca561f622..18bed558fe 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 37c33f0ccd..96466b23f9 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -86,7 +86,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; @@ -155,7 +155,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 Fri Jan 7 21:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530494 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp716617imp; Fri, 7 Jan 2022 13:34:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzRO06FAuCzhUSS2x/PoCftF1YWIPMdW3xryZ8qVLyHbxGZ2GiCdkhFZka7wY9SYWTWibW X-Received: by 2002:a25:346:: with SMTP id 67mr66390494ybd.456.1641591270799; Fri, 07 Jan 2022 13:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591270; cv=none; d=google.com; s=arc-20160816; b=eBESuj9xTs5GcObpoxBY8RjypPp9nD0tUj04WVgJzfdUNK9OqxJkpcQ6xVgIIZ33l7 bNy1WoKF2wgNovs/mfTV/m3bODoQhgjnfQtPbsvklnHkSXBrTtB1IgXheI/gJF9jRyKp zdUkLpvV8YzVygweLT0yVh51K8nyfGJ/BpH9W3c4kOiBVdoUdw2Yj02qqbDhXEBiIwqe u0KzIYx6Tw+7bBh8MvUfjoWcIWICZ4ljfavPtLPkC5LMq2tHpcSTs+pQeZq+5mH7nzrG HoRqR+UjPrdpHJWyDalMCtPaQEKZRvjCz/MLccwOXGJChLXMuULbuOCVXgzAgE8Nlstj ZVEg== 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=U/9jwibW8tpqJgzwOdU5uVnM75VsccZMKM1jZSwFQWw=; b=qMhkVbaHzx1KPzCWTl+B8Tbhi579Y7A6efXi68Qbte+MpTQVrke6EZO6UlEBVBpIiP hG373GuDiz8tv0Qk1rfIdQa4EeC0OMeDBgoonJAbum7U/C8+WrBUZdYik4opKHAfTE+F 72qoe4NWSnVKzlFFX1dYv+3m8MxtVthzVgpALIJgVg4BqrUUYh/H//5vVnG1YlFxr18S U64Y+e6EdMujoMF88dF1Uq6uTvwlRn+4ef6NN+DgxqlVPV/SDJ4ZLus7756F41JYpOK/ TIbL7e/YI/I0Mw+Wr0W9EBDoSHXBSfsXSZmFzp4pbEk7lxKHYJ2CEBZmmO1SwCnSoLXN 5iRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yBRP8ghu; 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 h38si5968557ybi.387.2022.01.07.13.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:34:30 -0800 (PST) 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=yBRP8ghu; 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]:38246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wsY-00059y-AV for patch@linaro.org; Fri, 07 Jan 2022 16:34:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqu-00057q-VY for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: from [2607:f8b0:4864:20::635] (port=40494 helo=mail-pl1-x635.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqt-0007lm-5E for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:48 -0500 Received: by mail-pl1-x635.google.com with SMTP id l15so5819796pls.7 for ; Fri, 07 Jan 2022 13:32:46 -0800 (PST) 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=U/9jwibW8tpqJgzwOdU5uVnM75VsccZMKM1jZSwFQWw=; b=yBRP8ghuGGCYWIEhCksVtxmsOAVCIRAj0i/mNBr/xTVZhzq1YU91sg/tFUa1qmDUmt jAcN+N0nf8bkwiJPdmdQOyoKn6OsLHysTc1itGNoe+IxCuVz8Z569e3I9ZuQmGLld46R xrXTBjy52BPqjtrtxFzaiYC1ep87xYLTkKoAR2dq7ceuFjmE2OnOq2Mv8P2oc8vidYcy BnWmZ+1VUaGl9LlTk2KwiCtn+8G7vTKlvGdqXMAfnVo72Ema7WLt0JzDHdVYmNgFL6Xp nMtXQaiXn5F3022ViysPN63zAa/uCfXqGqfsi5c2425LUgexdZIltvRcMKmDFwd15GZj NsMQ== 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=U/9jwibW8tpqJgzwOdU5uVnM75VsccZMKM1jZSwFQWw=; b=7AC1ug22Ga+dSgCGlSDtZ47aOLB5SxxcBB4/rCYxd+BPqRdjYq/fT6jek44We5me0P 9DV7o6mgxnaXQrHnAvjSNiddpxKlls9Gcqvn/ZemV2ki1ibG/gzwtiQunMNvxQg0VmDz e+p9fxcdsDVCca6M+gzZVw7I2noWiLQVvOnMJ4puAnIoMUYAMRcZWj7DCrnf0RqnUwj1 OczRKcghPNSHg8wDjOW3QgyFLAE5ctiSYwrmGA5jeaV6YFhxJnNErodI69bpxCFpE0Gt MUTSsAuCKQ3DDeHcs/kcF6AoZ6hJdbrKlGhyrrTq+J11CrkKf01j+BgQruwjciU60WE+ aOuA== X-Gm-Message-State: AOAM533jSDEjCorpSFmg+kFF+DtLd801qAyker6eG/eVxBPLTcqJOdVn 9NVKKYtVsPhWw43RMNawQ/XF1IVDykbuGA== X-Received: by 2002:a17:90b:3b49:: with SMTP id ot9mr17887317pjb.110.1641591165919; Fri, 07 Jan 2022 13:32:45 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 02/24] linux-user/alpha: Set FPE_FLTUNK for gentrap ROPRAND Date: Fri, 7 Jan 2022 13:32:21 -0800 Message-Id: <20220107213243.212806-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::635 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" This si_code was changed in 4cc13e4f6d441, for linux 4.17. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/alpha/cpu_loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 96466b23f9..caeea97b9d 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -151,7 +151,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 Fri Jan 7 21:32:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530495 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp718481imp; Fri, 7 Jan 2022 13:37:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+zwKdQbDuDVRlhdQPTgt8F7+1Ff75GEucPX9+mpnbtvFQfGnMa2WF6UPkjboQOuR4nsqN X-Received: by 2002:a25:4987:: with SMTP id w129mr64425256yba.34.1641591475299; Fri, 07 Jan 2022 13:37:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591475; cv=none; d=google.com; s=arc-20160816; b=oVgiEfNLbCOr0FM6SZxtR89HWfNpL5SOJsj41EVXatwNZAJSm97eV4dQRfSMglE2ra pIno/YtwrrIR/w21c0FE7XNcbJhmT13SuVzn6pdQl0WFhdPfuTMQn+Naqm8TTXt1pTRZ I2JUsueO0E6yBNHrfb9G/1ObMNt7gP2Rt/f3+QjYPRIaAy8AVnWuWt+m3J3HajB0vdRi lmPGM5UE/tB1cJISyNE0im6FC7S6NjeagmqX1hHyFeNdWe0DJvACnQe9WmFqohk/8a3r 8YUATAoEdC3rPyY6XQIsJ+plAMQmo7X0j3AYBJ5XjJu+aV7A94bilU1BXaNZeC4Yi8y3 Lk5A== 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=T3SR4ipsMMycJcvIjccSrjD9V54L86dgx4hN5og06FQ=; b=MsRctCrtpRWkbMyfqvQ2NzaZZyek3z78GxOASE5rcURSIEgn3dWOS2tNa6KH+VYJtK ABMV1JTnZphDlpWHeTbJDmfgmcuXNbjaC/805ZxU1F5oKZK1O2qDePzVZr2pZX/NzPx5 IfnpXEBQtAjLLAROnosDUiBJN5uF6v/zUfyePqqRDY2EanZouk9aJ0kdpT8/0cbsWIK+ hrS7D6/kQYlBaeADZ34tr2tAr4EpRWzPBFnkbef4sa/nHfviwLQruGy/T1y9Mx4mmFOL An48cpifbDsARLYZlzwALKyPUn6ppOvwNyC3V25C7Gd3qPPx4t/GUPqHkgtuMx0dt8EF dMEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zIy6o1PW; 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 t16si4752630ybc.65.2022.01.07.13.37.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:37:55 -0800 (PST) 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=zIy6o1PW; 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]:46590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wvq-0002a1-Pq for patch@linaro.org; Fri, 07 Jan 2022 16:37:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqv-00057s-B9 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: from [2607:f8b0:4864:20::430] (port=43909 helo=mail-pf1-x430.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqt-0007lq-Nl for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:49 -0500 Received: by mail-pf1-x430.google.com with SMTP id 196so6161752pfw.10 for ; Fri, 07 Jan 2022 13:32:47 -0800 (PST) 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=T3SR4ipsMMycJcvIjccSrjD9V54L86dgx4hN5og06FQ=; b=zIy6o1PWZB+fHqMSzzCyc1g8lk8/IsvQjpNIojNd/5CLEWCmaxgC3CUsl/fVQS3BJw h9Z0TGKKWHAoGtbYZTS/mLCg6DMig0CRwT0BO/h9P2OZxkRBJ0RBeuatmuZIdBieYR90 sBTlo512uiBLJORBr/Tqrx6dO6DJKdfzZTzFgF7vaAQidMnaftsmEx5mUkB/x6rxIY+l d8vrqbQiTkbXTrtu47EpQNjGqnQ7xxpJJ4rWQHr4zkNpV6IIx+xk2dhRzSJkfFh3h4r5 xgW8Cb5PumGNs9Rp3+eYuKLxpOy+nSk5IOV+IowBPSLQ3UQJT3i0nM5ViYVKcyQI+lFC 9hoA== 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=T3SR4ipsMMycJcvIjccSrjD9V54L86dgx4hN5og06FQ=; b=T00SowtD0SC1R0VFHldda9MDy/4Qd+dlaYVYZjsyME7D76sJuxrM+q9zkjSMsIKopC byu+gfq9ckj8Unoi+FaQsYkjck6yMICvm/Fgpxwl0fD94SujPZtxUcRYg0Yl148Jdka0 W9uHB5xZsOnsDHLEr0StMJWNFvaje8wOMA62UY/n9ekxIqnppxcZV2bxIi23gTF5mmO1 o27dqdkKLPrAAqcF5LkUlmG2fkb6P5zRhrf2zOqia2Z4E4eFjWNfqPXragVjzOxpfOyZ 24KdDA0DCYvyrwpGu15WytnBxQIdd7A+IxPruEnw18hWjcKnh5mgyzj64HICBxVBCrVn akIA== X-Gm-Message-State: AOAM5336FvGA7QjY5TAgl3ooRlhLKXCxT4B4fu/Ypsx9/7nvWAm5mUgJ aDN+AS+uzqF2FXbMa7Ex4kEE09fPvl23Ng== X-Received: by 2002:a63:6b01:: with SMTP id g1mr4178340pgc.53.1641591166503; Fri, 07 Jan 2022 13:32:46 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 03/24] linux-user/alpha: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:22 -0800 Message-Id: <20220107213243.212806-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::430 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/alpha/cpu_loop.c | 61 ++++++++++++------------------------- 1 file changed, 19 insertions(+), 42 deletions(-) diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index caeea97b9d..de6e0c901c 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -27,8 +27,7 @@ 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) { @@ -56,18 +55,10 @@ void cpu_loop(CPUAlphaState *env) 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. */ @@ -76,20 +67,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]; @@ -130,47 +111,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 Fri Jan 7 21:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530499 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp720576imp; Fri, 7 Jan 2022 13:42:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgVYn0b4YAIRVd9JhOSz98dDjZq+hDqGT4bIxsQz0iB1q5UMecK11pL1iR+dB0sUAagRp8 X-Received: by 2002:a25:84c3:: with SMTP id x3mr66396542ybm.553.1641591729746; Fri, 07 Jan 2022 13:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591729; cv=none; d=google.com; s=arc-20160816; b=LfE+lh5DeeFFEHCwgyaGFSKClm3h53xHEWjYmbMy5zMwzrG+O1l9108X35cVcdzQce 9Cs7jTq+u9hW0bOa0L7QBoBmFmFa3XIUw7sVD7Xz9MBUcJyqHrfkQ5e3+THGOeDda2KE 6vZOetW8glyeJ6ttxwmUUMRTevR9lbobeqF5CE0PzpHDPWe4jm5Ty0pQ03ET/brJqz5G 0uGsVahSUuTXwg3yN31p7ZT6nw3X/bF6CtTcanXlyRerVp4nek33FiVvQk6rDnvpYNzY gwrBF8s74a8BrI8vijKE1983X7XKyPdHPxlnQrqjbpP41Lv8lp19BnqOPI3RWmzjedmx 3/uw== 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=mv1fuUpltIxjjPECtR2wMWMWUuHJti3WH2udOrlkbEI=; b=tcGcQy34+0mRaUg+bhr0TiMB+P1qlgrRJ3Snuel5OIu7kEjCrT7jxw8KnpAJ3Vhp6+ FXNqnDYV8j8H6CtoVcBKJ5y6V3eBGNa6G3ukO+aSHTLEnzpKx8iIThGr4KUEf8Krn8Ti d/rze3SiYkosAtrhWIB0tee9Sv1o31lHd6DW82Ked9ydyZrH+5c35XL57NxbZXYkOTi/ iLyTu9zaeqYLrndr5lpyrqqIHYaErwhuHwnI+qV1tK7cn/9Ns1Tu3qYgIlznUGeDhKHU 4DLIm1Bfk/xtAYHqL5MKIuNCNTSOS9C4Slnftwfs2XFWYvflolF1bh8tS8eJkuhNs9cD fRGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v9Cl+2jI; 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 j79si5100028ybg.434.2022.01.07.13.42.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:42:09 -0800 (PST) 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=v9Cl+2jI; 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]:55166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wzx-0000Oe-80 for patch@linaro.org; Fri, 07 Jan 2022 16:42:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqv-00057t-Pe for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: from [2607:f8b0:4864:20::629] (port=36796 helo=mail-pl1-x629.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqu-0007ms-9w for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:49 -0500 Received: by mail-pl1-x629.google.com with SMTP id p14so5838972plf.3 for ; Fri, 07 Jan 2022 13:32:47 -0800 (PST) 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=mv1fuUpltIxjjPECtR2wMWMWUuHJti3WH2udOrlkbEI=; b=v9Cl+2jIU0v2IuH8d1zjMn1RluwrjZVp3m5Yc3e0nPGI50mPHLlLWdhSt/pq/g3VkA Q/zLjyU+4QqdlhNKW4tf7zsKVATs1hEOuxlDYSwhcYRm9okzAF8Cl2za2er8TLfq7PUa fALFcKYi1f8LmkNdgumwfaBkz0O0wKu4kKTkPMQ8HfqcsbC942Eems0c4OqybVKxgUWv 43UhWSGOkKc5ZfOfIWOt+pgIRy5NZllkkNEcyt/yab9AvlMiSMasUfDLLHfp7sjOq9ny e+cZz3Vl5UU+MsB/avtjrBQGfucv2j/wumdOXUP7hot8RN4S6R85NCXlCZ4IhLPKibuS TlJg== 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=mv1fuUpltIxjjPECtR2wMWMWUuHJti3WH2udOrlkbEI=; b=y5XFGvqxs6eSEyzcs3BQfxJjicjVr2rv/06Tu/z1rIUiHBxLMQoQYgBZ0Qg6UNs58r 77Ichr36muz1cVNHuSY7nGFc7J9esEHQQ6qywiAwKaYP2rqLauVlWI+bw1alRg6Uy9ZZ OBlPz6lxQQrHqPweBPxjPVYaMKulzc2AemBAGQrZOLeu2bLPGr9w0VGb3l7sYMcAQcA+ KPe5l8DaItb6tCTMXYVVhJHcYqNRtxfSOI8xQPxnw0ewvWTlVn74CmDWNcrBPcGUos2y oYfa5XmSHx5ZjFqXRrot4DZt6CxPd9iYT4oP9mMC+EybtnCG14NTktOJUm2vHdTo681O WAFg== X-Gm-Message-State: AOAM532VX2aEgelUFXrKA6EsIn/mtEgWJozbrYWu4n72MQIrN0ZrB/Ph pQoZdKNu0rtafnzSSK3tMnSTsvK/xLce1g== X-Received: by 2002:a17:902:b082:b0:149:f81f:a29c with SMTP id p2-20020a170902b08200b00149f81fa29cmr7719384plr.39.1641591167100; Fri, 07 Jan 2022 13:32:47 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 04/24] linux-user/cris: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:23 -0800 Message-Id: <20220107213243.212806-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::629 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/cris/cpu_loop.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 5213aebf55..0f46b3c1a8 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -28,8 +28,7 @@ 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); @@ -38,8 +37,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], @@ -57,10 +56,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 Fri Jan 7 21:32:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530502 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp720676imp; Fri, 7 Jan 2022 13:42:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1HU/9PGOKG+CWetWXj7LXEK8bSk6VfPTvw6yqfVqtyUr9T2r4wR8ejBl5OoYc9KYv2iyM X-Received: by 2002:a05:6902:721:: with SMTP id l1mr55723272ybt.64.1641591740911; Fri, 07 Jan 2022 13:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591740; cv=none; d=google.com; s=arc-20160816; b=nJv15Q6LdKR96ShYbTA7G6dd3m1JPhBrysZEffK77zvGmz/lfd21EACgJYjByMULW9 UyEGswfBfZTnUkfxRTzk/hBLAQpB2npyqj1YzGlWQgLeqSw6vlao5OS4h/20V1sbVJnE iv/eE9ldP6xxHUI0e2cMY2O9m+ePN8cX+s+dVKJlORbajf0Cpg6K3CaAYRZY/uBSLQsB wMAEtj3YyVBZGseAxbRGUnMufiOF81qgu67pNJNZG6jOILs8P3Yrtxy2/l/jWDPpiaeS 0sKp/SgOfIp5KwON6EcVSO7bH90EQMmhjxleAXrqo8VKsQxOVlAZFqbgH1dCt/MUDsDa q5sw== 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=Ca53GjQ9RuhRXPL4DhHW76qKdYdJSEjrupmNQVoTgGw=; b=LyomjOCpgxj2EqkYaoMD2mnX3rMdFXIWtb4tBTF8y9OWrJCBzO7u3UxXqlRQUydrdy gr0Hd1EF6jaLkT0MrV3HOHBNlSZRhAPeCxunySf9fsrWFmyyjWmOwF8LVLp+6+32Sxit pDp0x7E+IRY+bw+VRUMpt/HO+OEGB4U9c8ieWxsrMht6Gw4zDfLQz6EtItpjzQTSCkVz gYQIb3/K8WHo6aFDtGi5cqsuWZ8ceo39B6vfZSoCJGGI5HyDKGG0Cl+grGNDjHvIynOu qyt0qgNztbDEdvNeBJEFt6eo9Hvul8WUfodPP4rZnEBTFDj+kgj62bUAWpmQBzA0xqtk p4QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="bvalEP/l"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=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 q1si4720788ybp.228.2022.01.07.13.42.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:42:20 -0800 (PST) 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="bvalEP/l"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x08-000147-EA for patch@linaro.org; Fri, 07 Jan 2022 16:42:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqw-00057u-C1 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: from [2607:f8b0:4864:20::432] (port=43911 helo=mail-pf1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqu-0007nI-Su for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: by mail-pf1-x432.google.com with SMTP id 196so6161795pfw.10 for ; Fri, 07 Jan 2022 13:32:48 -0800 (PST) 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=Ca53GjQ9RuhRXPL4DhHW76qKdYdJSEjrupmNQVoTgGw=; b=bvalEP/lzTB9fFpx8FUPn9tBqvZimS2X6a+6CsFKZUzus6kg1CZyDiqREy0GJKYygv k4RvgfDqgxmB/wdsNtXRWTzCX4Lu/DPq00Chir3KumghAzmbhIPg0AuEC/mfroLyBRTM Z6Sdp2DB/652+tHHdJJagcE4xNtP5Awac7xiR0mTNr7VgYMrDhB1KoO1y++PFT5ftlNE fCBDN1RuEGuLQtawAe84sCwhY434LBPnXAXuahXh1i6U/1WxC5maSYn1rLQry9ih01Yk YvKEi03DctGsAbNhO3JPj7wVUW+exoc4US+T2f3scYGOTBasIoKnK4FlT+Q7dN4CDJ63 7csQ== 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=Ca53GjQ9RuhRXPL4DhHW76qKdYdJSEjrupmNQVoTgGw=; b=p78SmeI7lxZ4gi3+U9itdCHJF4PnlSpzdC7t2hTjEyXz2ZVC4QG4nRm2N0LBUAgarB tD1ajZrHEzAObWd3Lil+jvyCAF8IDHr3mKA/vxXVzwLdqduREFQbz1ifVm2RqfwK24F/ U8EwYQMQmrAtiSkyMRP2jaYhMkyhyCJesgIjuX8AIhZXnRhna9jrRK9eq9bRaVOCZnvY X+1vY51fSJQZx6zlKhDNZ8vE7C1w5IlWteZOXqIuIF6FV5oVNxlzShbzez4KSFdfecUT oZjWuVptQHIA2/Semi+zgFEHWWKWiOZEqfsVnCpCQkpCQzNpnTa1+WXTRtDQI0nF6aKt PaGg== X-Gm-Message-State: AOAM531KPY7LyjeCO95JMB5kDhLohWbf1EHG4qzhXodWDBSKOTQ1J+I1 Mn809J0QisDqXZYhoMmGZyfFAi07NtaeuQ== X-Received: by 2002:a63:905:: with SMTP id 5mr58455024pgj.485.1641591167640; Fri, 07 Jan 2022 13:32:47 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 05/24] linux-user/hppa: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:24 -0800 Message-Id: <20220107213243.212806-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::432 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP and missing si_code for SIGBUS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/hppa/cpu_loop.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index a47a63176b..4740da1b7a 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -110,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; @@ -147,26 +146,15 @@ void cpu_loop(CPUHPPAState *env) 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 Fri Jan 7 21:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530491 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp716531imp; Fri, 7 Jan 2022 13:34:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwYyJLa0BOnQYDy4419aINteOycX4vYXTRuQorimJb2l2H6C1zC3pKf9sHPcFQILJz+Tbk X-Received: by 2002:a25:11c8:: with SMTP id 191mr60039821ybr.303.1641591262248; Fri, 07 Jan 2022 13:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591262; cv=none; d=google.com; s=arc-20160816; b=0JrmmuhpLTtQ1H30wmTngruoT799XiUaG4gRZeJnG6hec5LaUtWOPVqrJTNKNr1HV6 aqpM2KN0Ri4ZZb3FBZnkFJSDPXX049U8VTmSpSZrsKnkJ06Xy0SEKi2BG/pI0nv01X6y BcPitUF7qiipyp2N16j9I2trxbGC2XeLoVib3ZumfqsNSrxjUCznk9hK3n/YzDVVhwAT vsI9Cgf9cYY+rehap9G/u+58AR2LBVgRcskpHgwy7lSpzz7SHr5eUyf91klSL860zqRJ 06Qoc3pmeoxeIo91j2neiV+AXeCAyxjXQqCLmsUqG/+Uc9DSJhqLUFVP+jEjZrBdy7Xt 0yOQ== 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=+KhD9iBx1ZcOuJcsoctGGF86ynFPs7hIGRRqzI4Hcb0=; b=lf2EWxIV/iWwcpND/xlW4hut6FgM+O4acd68eqltxAVTi/+HV+fjlWpz6ckAPWJnpv J+9lOUKByDUne5AD54ulte+stPMvG8GOViDhtjTzZrWi3sjDhR9aofpfSBR51sTv4vru FnQAPk9LakXVBBdqOSbW9zdPd/GJ1AK1frtd/4jfquGoATZlQmJcmKIZWQQka6qfnRva lRggnnLXYbC5WB8U1I/W+LPZPgVw4y4g4gSzgwwCfw6vYDdrdvK7Y1lS0gHWzzq9E8p4 aw2xZ3ov3xABV6JpGKW1JH6qu/NSmaDiegLXBUdcYaKs7FGq3QeacRV0QSIY0eVvYawb FxtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=L2QpYOnJ; 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 t18si1238418ybb.236.2022.01.07.13.34.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:34:22 -0800 (PST) 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=L2QpYOnJ; 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]:38266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wsP-0005Ac-M4 for patch@linaro.org; Fri, 07 Jan 2022 16:34:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqw-00058Q-Td for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:51 -0500 Received: from [2607:f8b0:4864:20::535] (port=36674 helo=mail-pg1-x535.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqv-0007nT-GD for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:50 -0500 Received: by mail-pg1-x535.google.com with SMTP id 200so6517343pgg.3 for ; Fri, 07 Jan 2022 13:32:49 -0800 (PST) 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=+KhD9iBx1ZcOuJcsoctGGF86ynFPs7hIGRRqzI4Hcb0=; b=L2QpYOnJ657Az+NLFQx357QF+z8sWonSnsXHiL0wpbcTmIl7YJs2OJZYiU7VIUx2BQ BGtq0+bWfdZzndxikCxH9z9roKwTfXYWg3SA69WO4YifP1nH9vWPupnoqM7zGqaOQsZ4 BHJV4Nz3z0KMJXTATtV71qtceiivvaYnJNIAJqDYf4ipVqoejdJkoeqNOk8RKz+6TkT7 3NPMMrODljpXdT6APduxNPOE8O8F+v8etCvg6YNy0yQb2ee4xKegjSbueXWiOoA/v5zk fVrWwVE1khinZggsw19s9hQn9ebBJTPkvbHGeC2zXmdjlcgeywHvFQFvsCdGOKrLau1/ 9kJw== 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=+KhD9iBx1ZcOuJcsoctGGF86ynFPs7hIGRRqzI4Hcb0=; b=xbqkx9KijwTvfdbJZUzkb9QS01Jx1bnKlsuKfroSBbQ4s9gjumRfOJwIqAeYvjETjO MhI4pZz/9cP2awXH5ZxcKQx3+20F3tQN7Zt1TQ+hDxzbUsw6hkTERZDyla30Qe0/8F+F 5quuaR7+TomdL698Ctn+frcpoGAeWjXUulToZfy77tvwGJrDiTV8ALu2CRISzO4PdCUr MlQ0n3WrxDgos0+1e7fvvPjCdcHHICilsCjxSu8uBgXddtsGAKLvYx1rMZLRIBh22Zgs xelwsNzm2iqAo6sbA35fS7J2EZmifQgf9YakdKpkQ+Qe6LjrGsikY5yWJgYyw+CLj87W HMcQ== X-Gm-Message-State: AOAM5330677A5/k4DANdsH2X5PGDUxffHl9SNHT18Qa54Jc0aom+L3K+ ByYqXpuFL2g5Qs6oXNv7K5YzakGp4OmkqQ== X-Received: by 2002:a62:cfc5:0:b0:4ba:7a1e:9ae5 with SMTP id b188-20020a62cfc5000000b004ba7a1e9ae5mr66053387pfg.39.1641591168232; Fri, 07 Jan 2022 13:32:48 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 06/24] linux-user/hppa: Use the proper si_code for PRIV_OPR, PRIV_REG, OVERFLOW Date: Fri, 7 Jan 2022 13:32:25 -0800 Message-Id: <20220107213243.212806-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::535 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" These si_codes have been properly set by the kernel since the beginning. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/hppa/cpu_loop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 4740da1b7a..a65e1571a0 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -144,11 +144,17 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_b = env->gr[31] + 4; 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 Fri Jan 7 21:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530498 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp718542imp; Fri, 7 Jan 2022 13:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLG/w8AXkC4QTV3U74PcCeYdWhjOigdskyhQb0jV8akKpxp0btC7IRFjuXAREpgsmwYLlI X-Received: by 2002:a05:6902:532:: with SMTP id y18mr71298137ybs.296.1641591482709; Fri, 07 Jan 2022 13:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591482; cv=none; d=google.com; s=arc-20160816; b=XpB/6HgUhwPbf6XnQDcENV3DPL5L8PHFHvq1pky6fssn+vgWXTqeCflPU16+cvKlrY nzH+bqYlMJXZcvekQXkrhsy+XCeI86Avu6OpQ84PjJWZNfXmWHnPK1dE0QMWEBjtxv8u QvZt8NoPfUe9/wi+ILrka+Tb7T+3NapNYzJGr+Q+wUC9kkZJnQwHUZMVw8pzK4MrBXkD yHS9pNYMJDrkOBqVdYVWuqIM6qUwMPf+UsQfc6hzDc6PsNhaX7mWlYP2tnBhE9OTtGhh 8N8SlTh5e3sevReZdxd1c2w9cJbQMhe+cUBnJwvhso3+PF6UXdWXY5PPsHTvaDZMu9Iv VxJw== 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=QpRO123Bmcp8gnxHTNxvrG4cXevO8jcgrFEBPY0E1Yw=; b=sA3nvNZDMKRMSiWMY1dHGbuGBV6KfuXdpQ+TfqN4omZCo5AkCv7vVvZXauZRTV26EH aHw0cvx1NYfg0IvZA2HZd9RqC/HWQB6RJqVjStDG4PVhX/ZVWcZOiNvr10mSNpByYllB Wx15e3/nCw/T1HJnD7LauhpIED9h1SCTKpc9N1fpyM4+Hp4obXXPpn5uTmQsKSNqJq6C KCB8KObpo0sLNrYOJsYTVc4nHVjrJ4VL3eRt1AQ79xfXTuV/4+bF54OTZ9Afof/d6ytz CXonJ30StrhxbBD090XMz6JV4+P58RpXIE70CGkYde4jR+3Yg4AL+vpH++ciPSaHkmaJ eJDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wo9hUcFN; 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 r8si7554972ybu.467.2022.01.07.13.38.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:38:02 -0800 (PST) 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=Wo9hUcFN; 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]:47300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wvx-000360-6j for patch@linaro.org; Fri, 07 Jan 2022 16:38:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqx-00058X-NM for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:51 -0500 Received: from [2607:f8b0:4864:20::42f] (port=40472 helo=mail-pf1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqw-0007nw-01 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:51 -0500 Received: by mail-pf1-x42f.google.com with SMTP id q3so6180557pfs.7 for ; Fri, 07 Jan 2022 13:32:49 -0800 (PST) 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=QpRO123Bmcp8gnxHTNxvrG4cXevO8jcgrFEBPY0E1Yw=; b=Wo9hUcFNuFQ2N7daapWkP2NQmDxMr78MWiuVZEGQiYVDCaVVLJkGtFTWxFRx7nvXYG bL3AQC0c4UxbNi5mE9MhpWYpKdzMYhpXf7Ua00zdKUevpV9MbY0xUaF7Ok6MLnXbEMDd XivYDAqOx8/onjpDJZzO9HWe7/SD1rgCPIuQYRhV1JAtW1f5kbM6Faq/gqX5RzJQO8HR vF84YIvSwTvZBVXzQl94f7Xfgv4qxOQlUMkuuZCWT4yKuf1aGBzZXZFl2pSQP0iDAcR1 CGNWDtxoj9waGsT38h4kBYxNLjI9YdWXd+VpMJOD/Kv7wXMLGieEwlA7fYQ0LcNedj57 Fo+Q== 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=QpRO123Bmcp8gnxHTNxvrG4cXevO8jcgrFEBPY0E1Yw=; b=txVGtA8sDZKAilZz7QA0CKhWFjq78W9vtZr8feJmJhEqvXhxJ4f3E+Qgk2uZn8RgFo sT0/70gOHJFoC4p+YKSM21X3K2ltsA0fi0phD5DITm8ZoYiDnGEmYk+IfLj0r3Ei+3+g S5TNhZSdgvtzyV7f/+/SHOWjeooqHf3LK/ksoK/faA+6MrdkRA78uzkxTd4uFA6c9WYA +CTwx7KIYQYE8jJK8EMKJB+YKMD7s05IhQ647YiEk/jsKdTJN0ig8q3M0wWchHULXBNr nPpTTVl+Z7nErOr2ZwJILK7FLRv5QqJkN11DgjCtqByTblETBkmT2KHL9cvgsFYXrrue rN5A== X-Gm-Message-State: AOAM530piDQGIdHGyDU/kOJ593TREj0uhC4kWnLxlBxHOl+EDyKtNBqt lwKEcrxkumWdfTTXRYYjP7otzq835qksmQ== X-Received: by 2002:a63:921a:: with SMTP id o26mr41303398pgd.312.1641591168818; Fri, 07 Jan 2022 13:32:48 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 07/24] linux-user: Remove TARGET_NSIGFPE Date: Fri, 7 Jan 2022 13:32:26 -0800 Message-Id: <20220107213243.212806-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This define is unused, and we have no similar define for the other signal sub-codes. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 18bed558fe..510a8c1ab5 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -688,7 +688,6 @@ 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_NSIGFPE 15 /* * SIGSEGV si_codes From patchwork Fri Jan 7 21:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530493 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp716612imp; Fri, 7 Jan 2022 13:34:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJ0KR/U1Si0P5cXo2aKjv0a7MTc6MzuSALI7+HktVEQUCBnspKodY+7DVpMx2aGWQyBsqj X-Received: by 2002:a05:6902:134a:: with SMTP id g10mr69640846ybu.410.1641591270668; Fri, 07 Jan 2022 13:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591270; cv=none; d=google.com; s=arc-20160816; b=OvCVmfM/U0Ziwb9ZWfCT/sSl5knkWQYNEOE7Xp7ViZJ+lwkF+cwbNq2dQDfjjfTdSj YSngCoNJOjSgDrt2wWIJt+39+i5vOSJRCIHYkXOCGDDWzSA6NQiEOb4EkytSHwd9ZCqB 4Ar8Z+pE0g/un/aFLqJ4pyumJpgV8xoTE4g1OydKbwfzF47bV5ZlBFccv/W80oD13UqL VDJG2JGnUPjNEkDbcsZboHV5d3iN7cv5I6G5liWv4uUdts0bm4FiKwLEFbWTAdkGyiqF kF6B95zmSKxEkUhHvyUEUd4ZAARiE+J1xOlKtuCBrjGWGIz+gervpFU/5Bz/QPm2R7VV WyNg== 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=cHQ4X7rzXaJnYCapLrO4HAeSSTSF3ady3e3gQlLak+8=; b=HVWi5YY/8fh+2icqcI4fcKFHJlzUKpjznWhxrDZvJ6L18Nc4XoXf+CYrr9b4+hHr3j +ysltHpAQBKI5wHsalPvqW4SirGgnr88QG7GFf740xZfbSE7HleduLANKMY+wUt+2V7L ckv3f6jreI8X/evvqZ+4x8pjje+Uf+3zJKyu7hKx4dKY91AjIERjz7JEFTQ3pf03zxCB q098PLd6MW9RzKHEMl7KQvPy0rbt5k+EgrW0fUlkWk3rADQ5JSbdLi9WOpjeUY8V/Qwk mo5sTRR5QnS6wJ5884lA72YppSgTRmBLgVx8OCSp6jca9EVE3grO16mZj1vNjuUmhEjg y8jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jxeRwy+9; 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 r22si2001438ybd.68.2022.01.07.13.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:34:30 -0800 (PST) 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=jxeRwy+9; 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]:38408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wsY-0005FW-51 for patch@linaro.org; Fri, 07 Jan 2022 16:34:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqy-00058Z-1M for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:52 -0500 Received: from [2607:f8b0:4864:20::42b] (port=41496 helo=mail-pf1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqw-0007oA-Jl for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:51 -0500 Received: by mail-pf1-x42b.google.com with SMTP id m1so6162400pfk.8 for ; Fri, 07 Jan 2022 13:32:50 -0800 (PST) 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=cHQ4X7rzXaJnYCapLrO4HAeSSTSF3ady3e3gQlLak+8=; b=jxeRwy+9RJikNHfgZ7IOqYmx/l7HGCuOPcW9CPWAjpTJrvPj03bwk+UtERwFQLRSTo 2hSsZz5P7t+/MWAr+3CUKzBKeDD2hSIPOm0kQrvkvQh4Enj2nYcEQ+7IKIRX31MvbJeY jnI7LS+CRMR5Ne4eKQqHKdRntwNn2GZoz0WAneKuAmcnnBPMCGGD/wRRe4U+dWRPq4IV JQ8Usa37IwFNM0Rqkp964616FoOrSeYH45WljzvkICUSvMyFNaewXXvQ336YbAAfba92 n2vdB0q0tv7Rvu6BM1vKjihYDYOK0Vh9kZZykpEd6GOPE7eNAurMqVBEyqNW1kUN4hbU tRlA== 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=cHQ4X7rzXaJnYCapLrO4HAeSSTSF3ady3e3gQlLak+8=; b=Gm1LVczYoOu3b1ol9BmE/wCFyL4vPgFIXZxpTqYy0jvv9fioB/O0vf8I1MVGF54b+4 +H/pMSzsKu5aWiq9cAh2lkimqIzx6mvdJ2yaleMSVDj4wKPnZShWOmyBUBlCGyK7LoQM IKljuHVcn5oKUtZI7n4BHcso9l3x5i0UC7jALQTSa9sNAnkyLAPvWSAv9ay+tNcsHErT KZJ+FezTttzmJjQPXXeHTC8vFi7dTU2/KXuDYNvLDfes0PAnJZaDxdpGjjdRiJKpG87C gNIB2br4p3HJnyyazn4Z+wcjfA0dDxU8FotuGT/BlrKV+R7UaFJaRxFwRyGPHaT2oM3h mvCw== X-Gm-Message-State: AOAM531IdTWghmc3Yk9b3Vze59msHjoWCUU+s5vQ5WhDcwFFzViba2p1 rc1dwyPl3bnDdFwyLowYEzX4MILPqIZZEA== X-Received: by 2002:a05:6a00:1484:b0:4bb:86a:c061 with SMTP id v4-20020a056a00148400b004bb086ac061mr65951263pfu.36.1641591169399; Fri, 07 Jan 2022 13:32:49 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 08/24] linux-user/hppa: Set FPE_CONDTRAP for COND Date: Fri, 7 Jan 2022 13:32:27 -0800 Message-Id: <20220107213243.212806-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This si_code was changed in 75abf64287cab, for linux 4.17. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1 + linux-user/hppa/cpu_loop.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 510a8c1ab5..f23f0a2178 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 */ /* * SIGSEGV si_codes diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index a65e1571a0..a576d1a249 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -156,6 +156,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 Fri Jan 7 21:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530496 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp718497imp; Fri, 7 Jan 2022 13:37:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmFSSEUzDucrLB8HaqMCT10KxCRbOlv2o09s8uEulIoMoUfeq0xEXq7pLKDDKo+OTGeprO X-Received: by 2002:a05:6902:83:: with SMTP id h3mr7492960ybs.70.1641591477202; Fri, 07 Jan 2022 13:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591477; cv=none; d=google.com; s=arc-20160816; b=bvwCdGJQwWZZyZ21OrSmZXtkx8Tu8Y8O0E/TtAkH0Szi9tA2zRV5Iay7+y66YBsKMC 8TcuTw1kZNwT2MNs67OoRuyouVyR9Axh2+j1uvtBQfha31hhZ1Y0YT/Oxez7rn7ra9yZ PN69n6Ypvhqw8xFZmif4Pf0UxV/4n2N/9DtzWSsjphVMGZqx40qXZMfRP/ykbBULT0/A EdsjsvZqVTkJIat56aG9Fdj9IkW3HfwKj+vOXvbXptxjZAKk7rz8xGFtOPVeqEXPHvcs IMlQyN8mOdMcQFjDaD/NkmC2xbF2aUaQ8rHm0ngDtMTiQrATrq8wYG8VZ3I2AIj4Chu4 vodA== 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=zWx3T0Y8jTkfIXWJVpZHCL/Mjwf+W/c1urCpeZvmP0U=; b=BWE7KknfJxRwrTGgO5zowCgNf1q2cw6Q+jL/CZtpAH3ZxUI0Y0JWtK51gOt6BdzHAv 4cEfbHM7zDMA45dJzqmC7RduZScMMenc5wWB07tY4yBcIpnvxQQGSnDS21nTZR8Dw0ur 2d6exbz9jWH1SfGj1Ezu5dVPmbMQg5Dm2olHOPJCUX7e2JB/Lr93mHHJ28BWCyRWYC+U guEefIIWfCj0iqCn6OMLpL3Yk6zdiao5Fp8AUeW332eCivnAGYuswdsjK0Vdn6CMsI2E 7RsnBj4TCdpikt2N4AcIcT1BnyD1hgZfFJuBi/2Ek97KVnRyY8EdykWFEFU1xOsAZghZ faqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Lx9Q+eLg; 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 t11si5478040ybu.785.2022.01.07.13.37.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:37:57 -0800 (PST) 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=Lx9Q+eLg; 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]:46618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wvr-0002ac-Ma for patch@linaro.org; Fri, 07 Jan 2022 16:37:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wqy-00059E-P7 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:54 -0500 Received: from [2607:f8b0:4864:20::52a] (port=38466 helo=mail-pg1-x52a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqx-0007oM-77 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:52 -0500 Received: by mail-pg1-x52a.google.com with SMTP id s1so6506399pga.5 for ; Fri, 07 Jan 2022 13:32:50 -0800 (PST) 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=zWx3T0Y8jTkfIXWJVpZHCL/Mjwf+W/c1urCpeZvmP0U=; b=Lx9Q+eLgKtnz2EBi/v+NCf2KWdwa1gMmPRd2GsVnBPhlAlepEoCVidKGp73rUy+Zre 2fj3DF5ldiFs1ZEhMWmJO3tdRvyz3TM6ALcakGOEOi1CAxzuDlIyGSNNZcam0j5xgbtU xwsuFm+vW0joaHMl/WEFubMBVgPJ8PcMLonMW3q85kJhDIvpVGzT/94O+8USmOfBlyag 8LvwWmuXNZo/lvyyuJYHknoKM2O3ycX/xBgHxZ9f/lfBNFgMSG8BA4dzYITtbfrnjiBK C1nZOcM2UW3VfM+kCU3YZlF4hTduSTXSEo6sWpUw5PZlX1HwE8LdcEJOHSnuipsBrT// /7ww== 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=zWx3T0Y8jTkfIXWJVpZHCL/Mjwf+W/c1urCpeZvmP0U=; b=EyJpCNO+i63isnEXDQp4p2nnCnIf63ZK6XZ838Gv3QExHY6u4I8kHRXCnJfx/4F5DX T0zgToqCcywN5CF/gZ0EEx6TsVU8Lt1wjUy19Wo1OcuGq5J/nopk/UagBmgCMvlYKqSY 72HFK4QrqDi9iExRLzDAFH5k+A2tRHddtbTANt4wi8EWJSd8VxGaB2F3JtBXLoUs3ElP dtO5tL1qn37fb6ogM3VaasDQKO0d/RHIlTLzuMeaWk0IqHQT29Wcq0+CwTNUcSUI3UXp Gk/ZgdOcmPLoOLh8yL+SyNdhH/g+b6iGgDzMcAhDhl3JqC2HGCHTa8DiCI+pI45GAbhG g5Xg== X-Gm-Message-State: AOAM531akECLZ5aaaBezRkTbosArG6zQXFdnY96ZNEyrwnfaQuVlEOWP GZz7TTHrDyg0GGWiFxd1TjVqR0hTaGtXZA== X-Received: by 2002:a63:7d58:: with SMTP id m24mr4059575pgn.24.1641591169948; Fri, 07 Jan 2022 13:32:49 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 09/24] linux-user/i386: Split out maybe_handle_vm86_trap Date: Fri, 7 Jan 2022 13:32:28 -0800 Message-Id: <20220107213243.212806-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::52a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Reduce the number of ifdefs within cpu_loop(). Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/i386/cpu_loop.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 9aaae93e2f..ac0f4e3211 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -198,6 +198,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); @@ -259,12 +270,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: @@ -274,22 +282,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 { @@ -298,12 +300,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 Fri Jan 7 21:32:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530500 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp720580imp; Fri, 7 Jan 2022 13:42:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRkWnz3fblJik9pQ93ZlUlvLIUnKCRkVzL1FlXCveQb446wTpoN+8DuEQtW+PwlFDBhEaU X-Received: by 2002:a25:7444:: with SMTP id p65mr65805840ybc.254.1641591729825; Fri, 07 Jan 2022 13:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591729; cv=none; d=google.com; s=arc-20160816; b=NrSWfbC9GRxjKWV6mt8lhstIaprkn7ppaliKBUJJsVh4eykRoOI8gLLxo/MGL/84w1 X4OLin6avl6HrbodUZmtuWbZURSS21Hbx/EKGVtvxsEw+xCk2nOeh1D8YV69rupsZda9 jg0SFNWt687cZ6eSqCKGce06yXdvwJvmWyDLmXpYnScMuONNKS1VbraMpxqoq1rKv3n/ 0PT7lEiQj7Oxt320u1BFBppGGGoIG6NudCJ+MV5PTZScFfyabut1+hkoYVnKbi122mJP VpO2afkaRBBtpc3rMjbL/oz7ipAodTccfgQ7Upyzpj9lrjfkarFExrb6XHuPdGQxCeuy DP1w== 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=TpHn0Fhs0LB5c3hIVLLK+G+3+OaCxi58Bs9uIsk1ZnQ=; b=McNMH1xCG/K+h275qc0PMVumKIGjV0YTqO2HV08SQHCwlWl1LL5jyMAqbxQfL0WyQP /TkVGhk+4tUq3iRW2no2RKzNvIKpOnHa5Od4EItYs5Do7R24xwCsJ7ofyhBtuebP+kel mRHLKBQTum4FVXAEM+Ik5AlJ86SOpoc26VhlFr5OMV249IeWIclipxSzuXdtmLAgUz2M 2LfnmE/pRtdJ1yiM4XvGA7Q91P0YnYAhH8erYi1OhdX7VevTmhd4LPoGBev5geoO1ANF hRlmW5yupq+W6EbtT6mnV7QgzyVTDDnY/ePcqCWuCFnzaJ4KFuW2tNhMhNOlWm3aD6rw D12Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="uwZ/wfBh"; 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 e11si4551550ybf.480.2022.01.07.13.42.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:42:09 -0800 (PST) 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="uwZ/wfBh"; 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]:55272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wzx-0000Su-9l for patch@linaro.org; Fri, 07 Jan 2022 16:42:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr1-00059o-B8 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:55 -0500 Received: from [2607:f8b0:4864:20::42e] (port=41499 helo=mail-pf1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqx-0007os-PC for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:53 -0500 Received: by mail-pf1-x42e.google.com with SMTP id m1so6162452pfk.8 for ; Fri, 07 Jan 2022 13:32:51 -0800 (PST) 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=TpHn0Fhs0LB5c3hIVLLK+G+3+OaCxi58Bs9uIsk1ZnQ=; b=uwZ/wfBhzUcC30H2TxBlD1vOXu/AZ0daelKzYm9CeH7G3pnMbemTBaA2/jLp8gtDbG vwmhK8x9B79/55ahED2+DfAZpoYZxZ6iRbNQRLwaKv+euWjz2PHS2pQ2XzuKaFy0Dhc8 5aw3+YwSGvXwIhQpFf9dH97b92+c+kl9751c7Ydqecm+ShaqlWwQP1BNf8uJ1I1HK//e puxnC9v9czMhIplBt41J3qCp/d4AhScF0vF29fYLsjE1OG5eqaPj+cVGekwpIKXKalgG Ce9/iXSU1dz0MeYLM+/yIiEIBhOqEbqPqZT52pcizP2pk8jr7a/Gpl1J9Kg5pNBq9u7J zKzw== 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=TpHn0Fhs0LB5c3hIVLLK+G+3+OaCxi58Bs9uIsk1ZnQ=; b=5IDkodbf55VKdG1M1B3C9ym70SN04k1zkXaX2t/+8ifGIjcnRFZey8qV3YXFUC+EuR Ajd/FFaTJvLIih/V5CDDOc4J3/0wPkf+nEMubUZ7ftcCCYwYEROIDhUfyywBxs8Oj0eH OLQGgLFSYnFms2zt8HawkgGQOD1cDK6gUNFCehRbWVmJ3uSeFEHKhXwhj3yYbuMAuBGF 5JDtd09rhx3HnqXHjstPdeMu5tMQe2ubsXGdhooCZXyEIDnfvf1lzVqiIUpzpRd5OOVk Q4BZ1pBAmwtKOP1fSO/cweuQDfAhwNWRp4qTXsvmIugL8Rsty7YoCyrjn4daElHWqN4s qwhQ== X-Gm-Message-State: AOAM533phWn151196bgnWEt0T1q+d4YGt92dvZwhKksg0AYR6ugOFj7N rdGbwLO+DS41k9Gf9ixiFxXcJVFEh7wj+w== X-Received: by 2002:a63:8c09:: with SMTP id m9mr26845782pgd.138.1641591170524; Fri, 07 Jan 2022 13:32:50 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 10/24] linux-user/i386: Use force_sig, force_sig_fault Date: Fri, 7 Jan 2022 13:32:29 -0800 Message-Id: <20220107213243.212806-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Replace the local gen_signal with the generic functions that match how the kernel raises signals. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/i386/cpu_loop.c | 47 +++++++++++++++----------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index ac0f4e3211..29dfd7cd0c 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -84,17 +84,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) { @@ -107,7 +96,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; } @@ -193,8 +182,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 @@ -266,53 +254,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 Fri Jan 7 21:32:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530503 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp723625imp; Fri, 7 Jan 2022 13:47:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz5PE4Xok+tFeZR3Bjv4sbHT0bnbMwVgmVJgBTqKqKyhhEIUh+g24O2N6Emxkb3KRMSt/D X-Received: by 2002:a25:abcb:: with SMTP id v69mr75783329ybi.317.1641592054761; Fri, 07 Jan 2022 13:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592054; cv=none; d=google.com; s=arc-20160816; b=lUweM8fq1tpclekY9/RXkyTTJDl93pK0OiKnSoj5GFFQ/8RWyteiPGis7ZKFyKC2XN 0Ao4dWWuh/5r1LSbGzvYufJSNlJDJ4X+mQkuQmqvpgj6YWRJ7MyYtR8gW09oZ4Mk7MXO ynpk6yQY7Up2gfpSspZAAMjRKowVp+iTFJVPqe4wek6cBGYxtyNAiNoxb+St7457jp90 h+qj1zb94EJ48njzOTq43D6UeXcSoI0P2Rw1sQa1NOze7feDwBRrRupwzBb0FCMvc5Xu /ngZlzVUVqxY9QAYzynrKbeDpu36x1mLNPUh/M/nnaHUjadTu64as1VkOD5F+y5ZNJWW HIOw== 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=CAdPMVXz8RRfjrWL+LNY6mFa7+kd1yHOj+KAK66s3KI=; b=atrU8pH7v8PUG8V2Hjv1MnjR2hC4SNP4BUR+rehpdRV3mWmtvJN53xTLxNjL0T6GIb 9a4CmDfHXT/YYTvXAV5e2aYascHicDh9TowDgTJqyOybu9hQX1LM0c3I3KQ6yiGqAL+B /po2d6aqPzSUo5L763USVebmQApMjOvOOIhKbZfnLKil4qcuXwPSlBa3gF1xfEzCdZD+ 3UfplLHx+Gj0cHH5f+5NpLslBz8aeVTGERCGVLuEkfG/XMMhsJx5/6O4r1yrDVS5pfqe a03tq4rZ/53DnU1NSzZTSf40Fpi97HPnERAsmEoAEvs7NPqdEGkg/D4/ZBpCmsxACJMW PYSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BAuL9NQH; 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 r5si5771224ybu.616.2022.01.07.13.47.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:47:34 -0800 (PST) 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=BAuL9NQH; 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]:35566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x5C-0006Wm-0j for patch@linaro.org; Fri, 07 Jan 2022 16:47:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr1-00059v-E7 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:55 -0500 Received: from [2607:f8b0:4864:20::530] (port=41913 helo=mail-pg1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqy-0007oz-89 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:53 -0500 Received: by mail-pg1-x530.google.com with SMTP id f8so6498967pgf.8 for ; Fri, 07 Jan 2022 13:32:51 -0800 (PST) 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=CAdPMVXz8RRfjrWL+LNY6mFa7+kd1yHOj+KAK66s3KI=; b=BAuL9NQHOZ2ZmdlxiLg89xKvUw0OURYY92RQK1phfatJ6/FE9YmGSJljcAZRyl88hr t0Fxn6M3yHvU4NERzahSVsVUB7WLUfCwZAyHNZJ6JlFLVzISKWvQTc055g1G046urpXt riL/+Ofm1Bn06+jv4TgoFw8b1PaE37QD32m38yws+uZcVcHOtmsmePAWVDLzupP+/2M6 tBCLrcPsGCIDWYe5tnB/bAl3F3XeV+znvTTpmeM43YarEJf34YjOOIGP1ngTbmHzgNwA DOLM6ukNbi6NIvqdF1jJyaFjrFws6Qg8X0kvHfhJic9eT08ZWQ7fOIYokeGAvZR+T2Dl zWBA== 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=CAdPMVXz8RRfjrWL+LNY6mFa7+kd1yHOj+KAK66s3KI=; b=4p3S3eL1pcBgnlx6at1+/0zNaQKMNEzfrOEYi9/U28Y5ydxSVl+Xwlknx12V2iqqYL /fkooJTiqegxJavGRxrIDddBgN9OOi0fdq7Lr0l1Csvc+2y4YwBtRv/+oyusYXiyA9vU Q9J+84aVrRSAGlxk7KApqaTgvx2PJIT+/emrQJkj4N3FwtPhBvUlihAEXaFMkC7lMi9Q zc3NEtm2QIXayVy2GpFtS5qKCRy90Ho1zGxksvOH07KKlIlUFLMNCP3iCly5JX233ybs /EKPDqR26sZaVCjOvURvVpyc6EOsHMsyR80ISPVHSZCMkAlqnmpgVMmArpFIUJCt3fi5 gO9g== X-Gm-Message-State: AOAM532WjnqIrj0+4dJPBrIr9ucNLWRgyX+tZBAyS/0MxcGo71QNLBWU VVsLOS2/Fyhm+mYoWOyMl+v4Mv3L0k6m2g== X-Received: by 2002:a05:6a00:1890:b0:4ba:eac4:3d01 with SMTP id x16-20020a056a00189000b004baeac43d01mr65812653pfh.22.1641591171040; Fri, 07 Jan 2022 13:32:51 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 11/24] linux-user/m68k: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:30 -0800 Message-Id: <20220107213243.212806-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::530 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/m68k/cpu_loop.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 3181594414..928a18e3cf 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -29,7 +29,6 @@ void cpu_loop(CPUM68KState *env) CPUState *cs = env_cpu(env); int trapnr; unsigned int n; - target_siginfo_t info; for(;;) { cpu_exec_start(cs); @@ -46,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: { @@ -91,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 Fri Jan 7 21:32:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530501 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp720667imp; Fri, 7 Jan 2022 13:42:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWpCc6iww+PgU5Tli12tY5sim1XL9PfFUStkDNpAzd+IJNptCCsMma2okJ5ejRHDqulJw0 X-Received: by 2002:a05:6902:1243:: with SMTP id t3mr45996284ybu.49.1641591739660; Fri, 07 Jan 2022 13:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641591739; cv=none; d=google.com; s=arc-20160816; b=H2g7AHitPNP5VzNteGpEtC8lcKEvs3bcr/Dh1wTWVsCyaZ9EsXtO+VVs/0SxtpGAte keq0IKgHsuRERsGy9u2TK9cBYILLLH7SYNz3Tev6iB0UBc9AttIZfwhiYPUxoBOvLmoC 9uC1RrndAMi82Keovz54s83TdSQFNPWvelpcHFqtD5KwNTsv6E2dwhLKy/ZLyJxFQU7+ 7UVpZQrZLZmdGD8RIxikr2516Lgn4GXoUQhKBZW+lKozcDbfJ7fJ86JcQauVbuxc3osu yqC6WW5kzVMEe3nhXoSIT4d+Ufo5yJflu11cCzMJMxJSMZ/FHuf6EDkeYms4oNrvzMmY JX7w== 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=VQuAVj83D8N41Enr2c/2Fh+V+6HnjoMfetVUSJ6+wqw=; b=tQuQ201hPCQv/N5tq1Nm6NBkfu7btnM/YjlQqILqcRn5J5FW57H36N1053iUoDV2D2 V23qWux3UqzwAf8Wz34sE/rO9Bc8YKx1Ju6B+QbgFJM6SNp9g4j0nTwcTV4WpH0Swvzq NOfBSTudFzywd5d6b9o6agIOFZO1xGt3+n+sWPtvkLlxfJ04wXEa+W9/197+u0F1dhmN f8MyC4ArsFanR3NhAygIHUizY8BMWKpQSTPOB6cgTxP5HlCuD3LkKXDJeDcS/nFVXdyS R27qjuH5MGJPZbzHVOk4BiUb1OHPxI0mc9RmG+/bFxWEuYdVI3xXERsOcak836I24eX7 N93g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HrZz7Lhm; 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 y3si4702818ybk.214.2022.01.07.13.42.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:42:19 -0800 (PST) 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=HrZz7Lhm; 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]:55836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x06-0000zO-Fb for patch@linaro.org; Fri, 07 Jan 2022 16:42:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr1-00059p-C8 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:55 -0500 Received: from [2607:f8b0:4864:20::42b] (port=37565 helo=mail-pf1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wqy-0007pJ-Qe for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:54 -0500 Received: by mail-pf1-x42b.google.com with SMTP id p37so6184028pfh.4 for ; Fri, 07 Jan 2022 13:32:52 -0800 (PST) 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=VQuAVj83D8N41Enr2c/2Fh+V+6HnjoMfetVUSJ6+wqw=; b=HrZz7LhmSSESR/al+1nE/tCJwsc5gH56GywVZ3Ctzog8Djx90F6nsM/cHEYfZMtNjs xJCz4LkrA749DGBQCcgmSNg93ll6YaORATCDla1RYNaf3lONByL6zpoID59gpxNI6oMV Km8KJLiyUcmJ7ZOKU9enthRQETbmI3t8w6UqC4W1sbaSW9nY1HKjh3OTziZH+UzNhuDa EDbCp0r8F0s8+VyrO4+/x/eEFHWviA4yTiJrFctx2gLwOVUKZQXHHfCuKeUFfgV1nmBa WEEuVBaMd+VL1M6UBDalTOOfMGC6AV9QWyPEOlRYzhm+Rzja7Dzcjv6axuHtwSAb68kx c98w== 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=VQuAVj83D8N41Enr2c/2Fh+V+6HnjoMfetVUSJ6+wqw=; b=jDKJCQTio8xLecnKLs47PkjBcBRya1fJjnl6s6eiPYkmvdRKI0DgM0iX42BxL0pNZI aEmHjCVYfnI4zvYa1jjxcXlgpTzmXEWeNrY+PXPms9XPJmrh2dfp4ADnn7TKVswWVyhQ Ib7NNH/FZiDKba1WxyorVD8gTOmAZc8xa0T4SzBX7nPKSgE8dDlDgakp8+aJzx9flknf zboQRI0kmc1PDl/WXVXdDMqlBl62NgLykS4y2O0nQMMqtK8+Q5kGDTX5gDbivpaOm2HY QzD9dYlh99PJWnIGPU5Wm6fLJTuuERwA4+pmlKx/ftfPQHF7eaa1zwPhpWLx6uPrscgV yjvQ== X-Gm-Message-State: AOAM532KAPQAqC2wUS/VA+6VdSite8kRBxHyWVsuIZ/9SagOm3um/HTp Fn7cofe0F5GyzjyVU9t6LG40e9agYXszHA== X-Received: by 2002:a63:87c3:: with SMTP id i186mr57808222pge.507.1641591171616; Fri, 07 Jan 2022 13:32:51 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 12/24] linux-user/microblaze: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:31 -0800 Message-Id: <20220107213243.212806-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 61 +++++++++++++------------------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index ff1fb26c8b..08620d4e68 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -27,9 +27,8 @@ 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); @@ -38,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; @@ -67,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) { @@ -74,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 Fri Jan 7 21:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530509 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp726208imp; Fri, 7 Jan 2022 13:52:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQzRNy+MMrSX4Tk3WNQBZuCTmAyqZ+bAJiS6FyE3TWiW3wRzqRCK1e27Emd3dCtlxpMNSl X-Received: by 2002:a05:6902:102a:: with SMTP id x10mr54366246ybt.305.1641592354384; Fri, 07 Jan 2022 13:52:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592354; cv=none; d=google.com; s=arc-20160816; b=0RWBxkGH9l3OfINxqQxrfoQMtaagL6W1lEHpuWIEx9nNcHSZPfAMoeoEhnrdPVDlgv KqYSvXWconIEsZRb4FR3TltLCs8OE4JULg/7vLtkKfBTIdQbVHKUJ5azub61RD86uPB1 w9ToV0q3SD6TylE6rt2PZdCSNvEwkPdmkI+yIbCcYQqVse8GxPg/QE8UGa5CeD7vIAhj fXDQU8t8kDFvzabaQdOQblHvZTwCMcjkArb09Q4BmQnw6j/CsanTFtB0G17xbemPoegU dXFJZ1rFvwWwvFrjmomdqkt1SBsGvbYsA/x8rG9xf+MCildX8ngXBtSmMaJPCDbSjRTv 6nlg== 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=nnIfwY6lMbUB9YHpQy15uEKax+AILhmSHbZZeVZpWtQ=; b=njRvQ6xKzoqec6i43+AcO2ZGdiD8/Smo+M3zjlL1tyNtqCbdiE1livZ5L8ZnzNtwip kLjQwKhQ0w+VCuiAIr92CKvniBcavlsp90RDFQn0JFQEf2x48zvYEEvQY9eSjrvL2Djb UAkZbkMQEYvazA8NZBOGXDCiRqLnGHiDMwHnW6rBxEaogLKeOEw39K474GjL5F1nLF2Z z3vJc7LjJ8gSsXHWqo5e5Us9V6C+LhzILDTQd0nxWfXl6IiUWjfW7XYHlS/7u66CJmwA pqDHf8LkZOtVJ+XZ+cGsZhMi/rNE5emL2LUn2YFCX0I8dfJO12Sy03YwaSBB9IMUgrtm IdSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QyLkhQ9a; 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 b9si4947307ybk.381.2022.01.07.13.52.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:52:34 -0800 (PST) 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=QyLkhQ9a; 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]:44900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xA1-0006XL-Sc for patch@linaro.org; Fri, 07 Jan 2022 16:52:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr3-0005BC-1c for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:57 -0500 Received: from [2607:f8b0:4864:20::530] (port=45931 helo=mail-pg1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr1-0007pY-1y for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:56 -0500 Received: by mail-pg1-x530.google.com with SMTP id f5so6485361pgk.12 for ; Fri, 07 Jan 2022 13:32:52 -0800 (PST) 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=nnIfwY6lMbUB9YHpQy15uEKax+AILhmSHbZZeVZpWtQ=; b=QyLkhQ9aP6l9dcTKQV+K5C7Ilevr41fknntG8UiorNypA6I0AQ3oYL49XBLJvs5eeK md0o5bd0s2qr/i3CQhQyN4KWbXZbpJ+K8e2bdptsJmFjddFAaCKR1KmCxB+r/R9sVj8e Td53DUa5cz0lzzlBDgofxzjZWTwhKgojwBuph9+i3m19DLT6opcmob1z+UuviaAOCv3I olf9N9dj0JPCjqh8WswqDbpDsYtlAfceN+Ec1oApj59AgleuT50ui12oZRyrg0ejQV6j 0n3DgEkpeZPfTJhffSC8/vlt0sAgNxveQt56rhrqaeYd2XAfiSJqb9OHUVoN9eMUYNaH TDeg== 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=nnIfwY6lMbUB9YHpQy15uEKax+AILhmSHbZZeVZpWtQ=; b=do6y8BpqfEYpp7wzvfARus2TdLTgqFnej2modbz3whWfrWkcPUHC2K4Bo+QQJXgWH9 IaBwbGJWIjiq+P0cFHFwzNQ8qz2/+5hbnZdSqzGa3IzwgzOwn1C3C4TgEnQcOFeOSpNp EwPT+6KIpQIi5JXDyuMsmk5UNV3ByMp1ajaur1FHB7FzK3Xu/a8MTJemgB557SvxstL1 4/sQbHrXsH3fV9CVmWDqfrBgxqGIDvQOkxLHSgidIuAjbCJO3A6wc0RfzmG613+PxV/B qIC/V34BupXcxsqzqzJY5tT9RgGrsRmo2godZFvVtBqjsgiN3CO3vylElrkedtmKEudn z2wg== X-Gm-Message-State: AOAM532EMzBonuDRg8dB/81SYQ2OX+4Uz09vW7MXvLkqY8OZKP8Yf1A4 pKY9uqe2QFyPszb54mZF9at1ioD7O3Z3ZA== X-Received: by 2002:a63:6707:: with SMTP id b7mr58387982pgc.588.1641591172121; Fri, 07 Jan 2022 13:32:52 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/24] linux-user/microblaze: Fix SIGFPE si_codes Date: Fri, 7 Jan 2022 13:32:32 -0800 Message-Id: <20220107213243.212806-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::530 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Fix a typo for ESR_EC_DIVZERO, which is integral not floating-point. Fix the if ladder for decoding floating-point exceptions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/microblaze/cpu_loop.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 08620d4e68..1a2556be2c 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 Fri Jan 7 21:32:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530507 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp725982imp; Fri, 7 Jan 2022 13:52:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4rdm3yFEF5mmx+xF2RvBnjVjqIVW99t4sehF79Z0DER+nSJ5hXrqoITKCX+2QslpYxQBR X-Received: by 2002:a25:b4c:: with SMTP id 73mr65055529ybl.728.1641592324114; Fri, 07 Jan 2022 13:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592324; cv=none; d=google.com; s=arc-20160816; b=bjjN1PxG02PPdn6WqqivHL/qraaAWFd5grfyXk9DMaD0Qa5MUNHNC3Z6KxMySSqTeo z5wJ3tj8rwlkZDqqZww13wlEHuArsAPzgy+RVoakDEDFsS3veXT+9tcDdm1Rdr924riI HN4raz33SmakIIb7wO1qUyvGWHF7rotJMJIF3Yvlj7b8CSFCSjZMK72/49Z9FeMKdpFJ 1jXSlAVnOQi63BjQLREty741wNzjxKEjnJKeb0khVDxdv6erhA3DuXksbXuDfzpTUUv2 o2WyLAsJQ2sclapTghUKvlc44QcoUNU/dZuBen2Qj8c13JMVBmSD7yTlbjAdW6+3ex0f mwsg== 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=rBQkgkJ54f7z1vTww2xh0WVqmfrtV6PIdKV7fgqQBjk=; b=dWRGt4C1j8tvQy8MSNzCOHOQQceaOGQokENJj7yEX9JyCeW1UNyd86uptig72wBr/X M6fmhBUzH/sNgIYVFtnYxtEpCclMm8HskVr3hXi4j9b42hWtPcJIKjSzobKN5RcCpMDu +KMo9T+agdaWeYqLNsWqfp4o/pr7E4Bk8sTL7PDOdEsXwuqsnPlZz4ftjs4S0N0neJvS PJ9Y6lCBg29kYctNtPH/2mpoeZKLVzxCDzBDSGrJWJgCGl7//b/oirbhu2KHf/l2ajbM 5Je9if4vgZNdg0HQTomF2kJ54zBbokipYZib40PlM+MN66zhAFlUjNsbfqckJwUYB9oL 9/BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIxLM0oB; 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 o13si6188776ybu.562.2022.01.07.13.52.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:52:04 -0800 (PST) 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=nIxLM0oB; 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]:44170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x9X-00060y-Jh for patch@linaro.org; Fri, 07 Jan 2022 16:52:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr5-0005D7-43 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:59 -0500 Received: from [2607:f8b0:4864:20::1030] (port=38628 helo=mail-pj1-x1030.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr1-0007q7-4m for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:57 -0500 Received: by mail-pj1-x1030.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so13206299pjf.3 for ; Fri, 07 Jan 2022 13:32:53 -0800 (PST) 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=rBQkgkJ54f7z1vTww2xh0WVqmfrtV6PIdKV7fgqQBjk=; b=nIxLM0oBoY28xeOsqZFDrarRbr9NVx1nNic+uJ7XF1nfOYKwZpSyVofAaxjJXxZQsx hZKQX05I2xDFTe1vTAUTsYZTkqi+uYTp0Qzw+fthxP45C+z0V+d85ZoXhV7AWoPIUJuZ ujkAkJX3dNcSn973BXaze6F0uVHaX2l3/Cve56RJ4NpjPRNnPKnnixm3K/zXwnuIWpY0 WXQQDFzBtoGJgraKvbMiHQDmqh5AreJ/pnUit0AgUJ6gz8hOJwkF/yZTLXVUwFx5cQv+ MdddqgBz2C0CctLL7myGUBtyBqCErKuVQyJul0vtpJk2UEPqjXhzi2AoWE8d1rU01Jmy xCjg== 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=rBQkgkJ54f7z1vTww2xh0WVqmfrtV6PIdKV7fgqQBjk=; b=YLKU7O1I00riNfixz/GNTL1l7k98mB5Dq7++CTYXorKhS4YrGvsmnKwv28upJjfBDg NilEAcfKM3h6wufodFB0rnI3U1WGF4dILkR/XdBJMAb+No8T2kDXF97z7cjN5BjmWYmh 4HXW8S1sNAAZ4jrHyC2kqyyY6dl+nJCFHf1dwvuwkXByxDke/aoFMByLa7hkOa6sgSJE egFpUiIDt1UjyQ56KuuK86JvjUA/dSlZAfNwdx1kZpUU38rr1sH1fNyvfLFUP0/OLQG7 NRCjRf1kqpJzmWQaJ9TlfAeTEG9aD8mpJsBcoeCWUNvVhus2rRU7QgcW/aVJNGd3/WEc Tiqw== X-Gm-Message-State: AOAM533mZ/rtbaePwVtrS7pZZt7LlGxrGECTgJDwT5d17YMN4Mjvsu2b zLtfzbmFNut2EfoPu2gb3pvIrUN3QPxFnQ== X-Received: by 2002:a17:90b:4b90:: with SMTP id lr16mr17702458pjb.209.1641591172852; Fri, 07 Jan 2022 13:32:52 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 14/24] linux-user/mips: Improve do_break Date: Fri, 7 Jan 2022 13:32:33 -0800 Message-Id: <20220107213243.212806-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1030 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 46 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 32f9fc1c1c..4fa24cc074 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -40,29 +40,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) @@ -205,6 +201,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 */ @@ -257,9 +260,7 @@ done_syscall: } } - if (do_break(env, &info, code) != 0) { - goto error; - } + do_tr_or_bp(env, code, false); } break; case EXCP_TRAP: @@ -267,6 +268,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]; @@ -293,9 +301,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 Fri Jan 7 21:32:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530505 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp723857imp; Fri, 7 Jan 2022 13:47:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdnSnjPjPMNLDnKG5Y2wlak3Hm7z3oZLLXXtksSkUd2g19belq1ufmxNMMSH7OdfXM1MVc X-Received: by 2002:a25:c041:: with SMTP id c62mr5375523ybf.743.1641592077221; Fri, 07 Jan 2022 13:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592077; cv=none; d=google.com; s=arc-20160816; b=i8xKojSZR5xyflPNV+skBbt+Z9ExudOQvcJ7uAD0xIKwj64BnthXsM0LfHGJxlBALS U9Qsd8BG6qkmCmV/lGaofH5LR6bltcMPcGBPPDWBYpGwD5l0Bs9DfOw+g05NkA4s7bU6 1a4M7LvzrteWhen//+lTFSeczv9yzLaZ6nFipber8mQ75kA7qzYsq7F2huJ+FuqM5EDM MgxrgVFFUqFQeDyA8JX86e2cgGidaxGtvfMtEckN36PJONUow/GxLZDThB47JWauABr1 hNL2KkZub5bfgFEIkBM6RNVQxFp/MapvyRzhAjh6fhAH6wPSbYift6ZMt/gTkKke9lR0 4yVw== 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=8RA0Ku7nHSdkDF6d4ejtW3+OZBLOqDrcXi6Q40nYBNk=; b=YQgmGA1POPrxseSe4OwB5QYimBwtZpWRp0EBMOjzuqti1hBg8J97DwQ1UBrexQPbUk l00kWemuVcR6mjl7UF9dUe92njdbLElCdKlIuBUB7w+7gJHqntTvzd7JTRfcNnvI9Ea0 RTaBZKctbxKWPDMP5btTfMWCCAHbFsAWRQubi4WSZeKinvbKPM4SJAZGalwH5A8azpv0 ZHOAgtHBALg/qGu3TZL1hlzY+DbZjLO/MphCgB1aHu4zTsbchl88Q/B7Tq/+zOksoqj0 0qeSdqAyJ/bpZ6xTma8Vbd+JgkoJrp8OcoYUEmsFgNdwnCZqXlZxNJbREwQIi+1iKETn Ok2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yzxsLNj2; 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 d4si4241420ybs.652.2022.01.07.13.47.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:47:57 -0800 (PST) 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=yzxsLNj2; 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]:36256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x5Y-0007Ps-MX for patch@linaro.org; Fri, 07 Jan 2022 16:47:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr3-0005BB-0N for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:57 -0500 Received: from [2607:f8b0:4864:20::1035] (port=46900 helo=mail-pj1-x1035.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr1-0007qB-4Y for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:56 -0500 Received: by mail-pj1-x1035.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so7582438pjb.5 for ; Fri, 07 Jan 2022 13:32:54 -0800 (PST) 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=8RA0Ku7nHSdkDF6d4ejtW3+OZBLOqDrcXi6Q40nYBNk=; b=yzxsLNj2398e2P12uc5PmL4TZv2DopJyIyRLcyZIDutm6CN0revZ2+2TRatvasCESs pUgdegaYjd+VUIJepwqhmlVP3/0CwmrVs94pORHLpu/8C35B8HVBNQPpiJJ0wswG4ltN Rxc+G/18GpGrOg4y9+mCsDM07M00R6LHRjQuEGvMnBx726vWqZwexLDkGKRXDuOhcI8u pktyPtNvf9x4KYDLFJABsvcRMx+nV//dqeQmX+j9Ehm0Y94pRDC3VoSclwOSZ3fx+0M9 kqtHdb7Bb0SZFPugnMZrfcbTHjUHE/ArlaAxketz1ocoL/p/tGlDgVZsO3QXkXLm79NV ffHw== 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=8RA0Ku7nHSdkDF6d4ejtW3+OZBLOqDrcXi6Q40nYBNk=; b=wqNlEaXjCxiumhRgUzjN5ZWZCIzpm8VsQ/GHHC6hekQpq9t/PjKR77psWir71+ZRN/ NJ3w7lRCXdHwrZk60/G+QyKn4xwoQZe/+E9Zz5WtDP1+qj5f1/o3B/pyepxsieFW6l3D UWozuuNVxAHvUDyXw2mnZEi5avcLrbuYyE6gsoTIMAF7NGjdCOwtzRi8gVNPGdZ/9SQd KlfdX0+rynPo3Hs3wDS/eC7zmU3j6ZwRZV6ZMSz4AERnTlrscn33qNSs4PGLGkLR4oV2 eot0EP+ajJ8mMbtsD/Zw5CcYzdTaPpp+cyp2nfKjp9zGI0o8gTTisGrgVAmWyFLDScuv CiCw== X-Gm-Message-State: AOAM533P8YTz2fZi1ejyk/BV/K19IsGF9XChxQ4r/NiSKNtDTQU7+RIu MsR+v/Xo7B2yrbUeWUxB8IhJIWTHyPTwLA== X-Received: by 2002:a17:90a:fe7:: with SMTP id 94mr8870914pjz.23.1641591173452; Fri, 07 Jan 2022 13:32:53 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 15/24] linux-user/mips: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:34 -0800 Message-Id: <20220107213243.212806-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1035 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP and SIGFPE; use force_sig (SI_KERNEL) for EXCP_DSPDIS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/mips/cpu_loop.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 4fa24cc074..1286fbc2e0 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -64,8 +64,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; @@ -156,43 +155,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 Fri Jan 7 21:32:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530511 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp727129imp; Fri, 7 Jan 2022 13:54:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNhBioCrdrkhwYnEFu1y0MF29bp2QtBkQ+xma/N6gFxxVSTswW1Ltt8Y2rBUs6GA6SYWqW X-Received: by 2002:a25:4196:: with SMTP id o144mr77578854yba.419.1641592486610; Fri, 07 Jan 2022 13:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592486; cv=none; d=google.com; s=arc-20160816; b=konhpxuNdJbem0MPX0Ckl5oH3jwzSwGU2wPoXB9bX2Flz9QSc4n4VifVoz1lH8/fPI 0ave3603NiHQw/tPtDeRNw9a6Bjn2PGIbqFaWWJjFXw8MhBg0tZ8c+4r6SOwZwEaGheo TGOOOY1iyvn5RE/KsYDNWIIz1x7ntkjTjk/CZIpNjPIRTskvIlWT8SpXLQaL3BPTEePt 5vva2iT4VgMGCFbVbX1v3gvftf7AJhyVAfhVErCo/nYSv/RVqtqyvstn4xstRi0XIREN 07RlPsbu9rtWNYlKC8Lnq041exAwCGj7WGcze8lRYMFH0zBxyTbeoJjLs7j1m+TAmp5v svyw== 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=1ZnKZhX9Hxd8Pfgs4kCYD/L+5/8tI955It7HaTGIro8=; b=x/DYrmLSn02YjN87uqCALwKB6TGKbwwK3r3hXVYmT3ICeSxVQAkb2ntbp10T2E1F6o X3HHEa1DCY+WZvattto5fbZiYP86gz9ac6lZmNDjdPa7IZmsutP1fz2w7OrUnSFq8i6m uINLhebL7Vacq1BbRjHs4CiOBl5vHxkmCryIZWtSI8jtTu55LH371c2g+GIQWAJkDnRH XoXtOCmXzcx5KcsQ1ThSrEJo0qeftueKNxNF9Ag3XTiRYtKWi+upFFCP/y0LvxM0noHf DYYR3KUJv74gvCE9efukZeyz9U6/ROmlEJxJfWy0g4zYi9evLqrOJNp7k4O0Ingjh/pV P2tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HR7+hSpf; 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 b11si4070727ybn.254.2022.01.07.13.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:54:46 -0800 (PST) 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=HR7+hSpf; 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]:53422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xC9-0004mK-LG for patch@linaro.org; Fri, 07 Jan 2022 16:54:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr5-0005DA-46 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:59 -0500 Received: from [2607:f8b0:4864:20::530] (port=36670 helo=mail-pg1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr1-0007qI-BH for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:57 -0500 Received: by mail-pg1-x530.google.com with SMTP id 200so6517709pgg.3 for ; Fri, 07 Jan 2022 13:32:54 -0800 (PST) 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=1ZnKZhX9Hxd8Pfgs4kCYD/L+5/8tI955It7HaTGIro8=; b=HR7+hSpfOP0HrrcXGHjRargHraD40jLhqIwqWMwDPio7X1eOKuSpgdtgHti55GhB3n 9I3eXCUneYqx9TkxpqrENvG1CarC3TI9WzTxHG+HhNEmHk6O1lZSIfvEQlfbUJeo4twr rzE9SDWK24JfG/7N2AdsTkGal+vhkfjrHvYbT99FMewS5A8ZUnOBJLkIYenYAJSMv5qw HTLvxiAtat93IT2PkQNdVNwKflETxEYF72TmnQm0yT1GTrad46KVCH9kJ+ENELNAvE8G 3AsbMEQkPinMv78zdMF67TZqGzz2cLzXraHKekTRX9bd9lVtm4AqwwIxuZICkZRj7CLF lY1Q== 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=1ZnKZhX9Hxd8Pfgs4kCYD/L+5/8tI955It7HaTGIro8=; b=owtNEim3L6QJEw1GhbJrGXSmuMXNzpV/KG5mXJFGofX0enlg/rap8jz9fIby63Jjlj SmkDvJcy84ljtfkJNs1AzvHRh5hQ+ZnHoJf0qWHF9sCFVealpDXgnfnaDpCbcE8WWqiI 1UdAzyMF23rhgXdj1qDcNhPEcRR1b7zWgeVo5YHcWL/v58zVKB4dA4yb1PQ3yZUBEg8U sLKOhY7XIfr6pasT1EfdipPfUfUgS/TKjkOhgt9oWSICN6VfhAu0InIsN9lmVgUYwpil w1kbu4I92ctDJN8OLRVVs+gY83DP/hq9xAwPT8CW2XDJYSktgdgR1WSIBmqbSOqfEM0A qNIg== X-Gm-Message-State: AOAM530hxKfeoKcOAhv5C9b/kM8hGy0RYlUHMWvo3KKgzEQYZd45a4uO GVPYtSbpgl07ROgoHMw4dJfIyyHRLhk0GA== X-Received: by 2002:a63:fe10:: with SMTP id p16mr57249283pgh.546.1641591174068; Fri, 07 Jan 2022 13:32:54 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 16/24] target/mips: Extract break code into env->error_code Date: Fri, 7 Jan 2022 13:32:35 -0800 Message-Id: <20220107213243.212806-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::530 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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. Reviewed-by: Philippe Mathieu-Daudé 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(-) 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 1286fbc2e0..9a6ab2dd98 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -65,6 +65,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; @@ -185,71 +186,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 47db35d7dd..a42f507aed 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); @@ -14160,7 +14170,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 Fri Jan 7 21:32:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530504 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp723645imp; Fri, 7 Jan 2022 13:47:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzg4tOKADymx45bnKk8QNThRJfYERkfhcYj3xJunf6LqKVRcLKBUARCx3DRoUZTo6uX+Qgu X-Received: by 2002:a25:dfc1:: with SMTP id w184mr41072982ybg.249.1641592056365; Fri, 07 Jan 2022 13:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592056; cv=none; d=google.com; s=arc-20160816; b=xWk1yENuD6vBEPmyZP2R8Ns51GCy2Bk0TRuQpuxZaajFBt2Vx4L0V1Dcvps5cCaUiP VKzp8X86GcaR55kxj6CLlkUb95E7+4gWit0okny8C4U1+Z65tN0v8N4ZtxKxroPmnJhi uWK2xPYiFFH20nRk/oU4NxojB34qA9YuZSlVgiNLuWxo6gEJWevSmu3d+xL4IB5BI9QB yOM/1x8j/+nsg8JWnmmn6dfpGx4SKdxl7bdZf3nU6aFm6IRwQHDYBddBYXvJmam/fMeF LUKdbrqbCvYs/nXloAjZl2IJveanY+LXrS+/+K8/MxuwDBRT80KFQbF/HV0IXqJh/DsB O2sA== 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=XqRFdx94jAEiNbtzy76sxqGXtQ4AZmWAEUgwWCxHmkk=; b=l6Tk+UHNWobsUyZmhYjhfT03qY4qXcD8/dgaEOM1jK4Bw9yplcshEX045/xtoG/sOW 7IuODSmBWaDJmS2XPr+fCMrE9vACCeAs0Z2Jtwsgv8yRU/o5tRDI197OfMqpJLsz7bHb 7fwvbmNVk737ENBUH9Bu4HFrKfT3cpXHntAJLWIwwfGn4Jmb7OITjA6vXBSdilThCf8W xFdJlqq2f0L5e3WzmTFIVzPA+EUyxPNKEuDg0CGFkNlCB/6lheo9eR9lF08EsxSzK3HV Df0wxhENKXxEtD3xyBWXa08Dbym94cX5QicLWRE7ydlygR4q7ob/Itr5Q88zXzEYoAFr +Yuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIUvJg3m; 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 f141si5382493ybg.445.2022.01.07.13.47.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:47:36 -0800 (PST) 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=TIUvJg3m; 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]:35692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x5D-0006bI-R2 for patch@linaro.org; Fri, 07 Jan 2022 16:47:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr5-0005DD-4N for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:59 -0500 Received: from [2607:f8b0:4864:20::635] (port=37863 helo=mail-pl1-x635.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr2-0007qa-Mi for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:58 -0500 Received: by mail-pl1-x635.google.com with SMTP id q14so5839687plx.4 for ; Fri, 07 Jan 2022 13:32:55 -0800 (PST) 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=XqRFdx94jAEiNbtzy76sxqGXtQ4AZmWAEUgwWCxHmkk=; b=TIUvJg3m/i5ZkopRO2TgbmGl5HVdp+q06W41qi5PHchKtD7pOcgbgBj7+ec8ihb8kh azh/AzX9r8rfjLjyjgVo4CRG2TQogIxN4/zbJXwp8qdtfIFXa+9XdeLmvpZj+rhcsiOQ KEatziTfRi6z1FBbwWQg7/qjIG0045vkEyq91adYqOwYNjG9YJYTvPfM1D9reeaPkQ4J 7oMvezkxGmHxqflJh90XR4zH5APcpCK6zkpc5t3yXXUwNd7Edr84HGYhodi3kg3KW4sy Lc/DBH20pkqjOHJHax3ZWKHEiRXamQki7bplYms0SwNjb66xNP0gL1wai90PdGkk/G/5 ntTA== 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=XqRFdx94jAEiNbtzy76sxqGXtQ4AZmWAEUgwWCxHmkk=; b=oJ3O9CDjKO1UGEhtMn9wqzWwWKpZXKrY1J6WxinrVNpG0ISGeDeCwflBABnrAcCapr 4MeYHDNjqF+kN4a5f2mBfm34dD7pYrWO5cUk6ZHzGScVgARprtA+D5qqpK8aWS5FzFND 4mo3CqAX8QaoIvmHZqd16MoZDswn9q2lEMuIopaEvmxh0ZukZhhfNLPxmljGhlyb/R6c 99vtekChr75n7+MVzFQHoh3fn+w2DnYjaXqP8ZPXERhHijgjHuMa8tLzBjJakWy0H+4K 1d4wnO3IAvrqRhnwZAJ87CGnpyBnoZvyH+oT347pFAH2hyy7wb2us/j4dLvpAYfV/gHY ruBg== X-Gm-Message-State: AOAM533CtepK5y9d3tvs7/18MQ14TBbmvKtuefXhxl/CzPM6RufQEnAa FfKZoRJ2fBccpUYibaMfUkZ74j4h7MoHTQ== X-Received: by 2002:a17:90b:3652:: with SMTP id nh18mr15533453pjb.210.1641591174618; Fri, 07 Jan 2022 13:32:54 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 17/24] target/mips: Extract trap code into env->error_code Date: Fri, 7 Jan 2022 13:32:36 -0800 Message-Id: <20220107213243.212806-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::635 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Simplify cpu_loop by doing all of the decode in translate. Reviewed-by: Philippe Mathieu-Daudé 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(-) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 9a6ab2dd98..9bb12a07ba 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -197,51 +197,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 a42f507aed..98c0f1aab3 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); } @@ -14155,7 +14172,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 */ @@ -15289,11 +15306,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 2c022a49f2..916cece4d2 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 Fri Jan 7 21:32:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530512 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp728339imp; Fri, 7 Jan 2022 13:57:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUzabX23mhqd6J73lOSuTKMmYVocMJ0PzGWwzSl5Pyteh1eiqGll3R/Ox12VJdkn7qq7BH X-Received: by 2002:a25:ae85:: with SMTP id b5mr69925795ybj.200.1641592649255; Fri, 07 Jan 2022 13:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592649; cv=none; d=google.com; s=arc-20160816; b=cb4x6fTZ/MB2T02a71kdvSzxIsWxueYixsNlEG6L73EndDcSmihsw8RJrzXUBlOvLj BbHX8ByUdNbES0Ib8OAaxM0o639bs7zlYXjhfH7QlrbCdMKQbOWJxf9h6Gqb1NQv9iU2 Ycd2t7XpJmADQcwuOnP97gVApSYbFxcrztb8a+T5PU2iT1xiBDKFJfYu+iXPTrivvwrd PUnlV16THN8Nx2I43vl2e7OcecI1hynKDtbjTNlrWb8+erumecDb7heaNV3bKj8JseC7 ZNMpPKTZBS2A0XuWNPNBw9R4vXgmkLV4Pu9SZmeaaOSsj/Q/z6zN+3+F/JnI6JnJY19x /6tw== 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=JInWc8HbqwhtPM0FLPOWoh/UvMIPVblznx96Z5wDe6g=; b=e17aSB9OY8G0CSBoMkskqBGFX8KwMJ8NcIpLpn2fIEB1XexdGilzJBbaaVHchmrgat LyuD75Ypv0YHMv1+0GLTn4SpJ60vRG5cYW1w9MTPLIo8yXBL3d/e96XJeAhVMxPLKUsi MYnl2aRbE9FXKI5ixL515++5Wb0yULwbsRtPXpQnBkFLDchGOELCFic+skWX14e+Sc4b rQH56X4YM+VxJhK3huGrfOWwVs+ia6/eMF3LzOlwmWCCtJdvuNmAVwG3rttKsIn6jlWh tpX60lLljbBC/3IRV1thas2kn3TMZiXR1l2oS629oN+spDBivkmkyuSUEAuEMmHa2FJx UZBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="qn/ucyFX"; 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 n62si368622ybc.165.2022.01.07.13.57.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:57:29 -0800 (PST) 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="qn/ucyFX"; 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]:59692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xEm-0000cS-PT for patch@linaro.org; Fri, 07 Jan 2022 16:57:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr5-0005D8-4D for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:59 -0500 Received: from [2607:f8b0:4864:20::1030] (port=39879 helo=mail-pj1-x1030.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr2-0007qd-Ot for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:32:58 -0500 Received: by mail-pj1-x1030.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso11741712pjm.4 for ; Fri, 07 Jan 2022 13:32:56 -0800 (PST) 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=JInWc8HbqwhtPM0FLPOWoh/UvMIPVblznx96Z5wDe6g=; b=qn/ucyFXNiIAF5wI42YerykxIPwzp41FmU2B8y7OufRN1noW8u+fNNrcAHUSn2T+0+ jH402FIBB6uerV3GEQPKvEg7svM+G1uELRn13YeJl4NUcXjFANHs7pMev329SqleuEr9 d99zTugBY5YBqiPvyIUyJSnYlJQpukomPNdRCPW+utZ/jWcCMlcV6DG/4txVNHRRw83n JXJVBgXEAmx9UcbUVkqmObO8cULDIjYw7S0Cmu8yE1W8E+QREFykU9WXv7zMAHEPsFi6 7PHQDvcfiP3MmmzmVmyf2+q1sl4CU/mcEXKY48G9KOiuBdoBz0N/rjkrhSvrWR4AUo8v 7d2g== 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=JInWc8HbqwhtPM0FLPOWoh/UvMIPVblznx96Z5wDe6g=; b=IQ4NnJPUpa63XppCb/pEbZ5BbOpIQBEB6jP9h3Iie8K3NuGBIl32lati+7iqhYoE1u sVnv74n+eOoHKQ7eiBi3bWeR2ZNk4BpOAZ6Hz53Daa4WcrHF8E6Zf/kS5NM2pd+CTUtK pXAZG2hLlL++eDrDkcqJKteXgF6l7eizlig8/aQ9R11EmdKql3xK2gzwrOu2hpUCmBvi /wDBoON5QHPf3w9r8U7pH/Oo/U0U7iX0WI8OWIPuVMnLCn9WDkRK0RLRO7R77RYMQ7V8 JUfJ4qOVETx5pzEGvoZITBzNGdntSVsQd2XEB+JCHoTGlgoJibTbC0qtOfOLpFwanV/+ Njrg== X-Gm-Message-State: AOAM531GIFLz0dK+Dl+d7hDAYZiTJz2a6CUGxWaEFk3v0PovyioWIeCR oJeUO28KlV0JfOnJ8HXZlDCBwZjCTVOu1g== X-Received: by 2002:a17:90b:38c1:: with SMTP id nn1mr17980852pjb.65.1641591175631; Fri, 07 Jan 2022 13:32:55 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 18/24] linux-user/openrisc: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:37 -0800 Message-Id: <20220107213243.212806-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1030 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stafford Horne , 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. Reviewed-by: Stafford Horne Signed-off-by: Richard Henderson --- linux-user/openrisc/cpu_loop.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 592901a68b..7683bea064 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -29,7 +29,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); @@ -55,27 +54,16 @@ void cpu_loop(CPUOpenRISCState *env) } 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 Fri Jan 7 21:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530508 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp726179imp; Fri, 7 Jan 2022 13:52:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxs9g86KHtPrJxdKOhlQLS9wVKeJGoL6/ya99j4ZHTFdzJ7B5Ph+Zhit/LiUAUKPxZRrFBN X-Received: by 2002:a25:74c6:: with SMTP id p189mr64634405ybc.495.1641592349634; Fri, 07 Jan 2022 13:52:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592349; cv=none; d=google.com; s=arc-20160816; b=fGN4lwWt+ulHUOqVoXxyxOKtX3adRzq+MfY8yTVVLP/5+DcNVMEsgnDLomoi0w0PJ9 lBayeIAx9X0Wvzk5h6ErsFsMP+AstI4xSaT6SqT196XBhhdFYKjMUu0tXw3qUKG0MdhQ WHybFtwRsiV0PrLAYedYa9+k9TCpSqOp3+LWJpBClRMTSV6ML+zOGOqjv1K6rkjLjOyP QYNY/+JBCICthG4+HUMB94oyL/JFLpR5GHvfMqQpNpbTdiJk0nRf6ADgx3TwRsYpJ3+N PbjJn4sSI2REq3PqHpBD5hCLeftJtt4lUDqAtIrk9l12BbAhoDk4j9PaL+tfhaOA7/F3 sY+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YzG1yQEVOnVVuMDnvuoGRgUP9qKo3a5LHm69yssMXAU=; b=EaU05Rrp6XUedtopSfXfFJl5xDEMmYua3VEX1lTgdHuIJHo7EYbmdu8lloY6TLA86C DwI4gmNBV/Sy/MFC6oR6G2Fw7u9/n6EfmyjDm2aIRHAZYyIjTw67VjNJyan4Kn3ey3Py ipT+QO0nOpdyUeNzw/6H+QlmPHnJRo5rqaCjivM3XGS9wYkMTY/F2WqYDgewRUjcqG61 3LCaeVJHKGJv32Nw9a4xv/Ygw1XVwLl0Wfo+Fb4+4+O9bZ9aZGR4R3O0oFXXBUZV26UR N/rjS0BwWGIxHK06PYnDyzlANdPF+7nklCo3/FKge160SyWJ6Le+nRm6UuDZodNvqNVD XvbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WagvvuhO; 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 u17si5333738ybj.113.2022.01.07.13.52.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:52:29 -0800 (PST) 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=WagvvuhO; 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]:44646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x9w-0006L3-S5 for patch@linaro.org; Fri, 07 Jan 2022 16:52:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr8-0005HA-Ci for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:02 -0500 Received: from [2607:f8b0:4864:20::435] (port=45040 helo=mail-pf1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr4-0007qm-Go for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:00 -0500 Received: by mail-pf1-x435.google.com with SMTP id t187so6146646pfb.11 for ; Fri, 07 Jan 2022 13:32:57 -0800 (PST) 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=YzG1yQEVOnVVuMDnvuoGRgUP9qKo3a5LHm69yssMXAU=; b=WagvvuhOnI5pJS3DA4ZBoI2vxi0aKs3W69sKC1eS+xCWGQSM8WZeUZTy7OBkHnRztC QFPRW38db6li+iSXNa/xGG3dGKRNFH+bQjkwGwX4y5gsr3nb2vuyTFBw/miW0mjkP5kn s0uPjwS23pCrUJn+UoAdnkNz73CIDly9Sm6zxbOn6EWnZwYH4Wj/YWFFOufJt4SP3jfW 0Atv7dYsCIl5CHtnVxmc2JyOJib3CjpDPhRke4WMqJqdSxnAVubwretMEI0HPQE3oIRD 2NsLLOK9r3KakNcx6EK+22Vm/vYqKKAUatfkwpQoG/FPXxR5EzBrdH0KRotGDQkQxyyV mVqw== 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=YzG1yQEVOnVVuMDnvuoGRgUP9qKo3a5LHm69yssMXAU=; b=q4GW9lNj/v971NoMqqNfntJlc4Qy4L/BRtuDcYXq5kNcg50AjN78XnuQ9r1/Di6K1h SfkVBc6kdhE/Zf73ak6DdJNlhVkwkxxVz665tsSvFKl/FaNYh5wPdnjuoPMLZsIKbkKE 529m1GRYRRBgRV6AQbt04cCB8E+z0pDKO3WmNL5tfJZjavh9obLCxCwCjbflqkAwbqy0 g5gci70XqiWpbA30S3XYc8/7FgQZ2jxTwzk3lC4t9FBl2L67eKX7ObIS6uGKOwnuE7re 7/evvz4O2qEeWmIpYyxl0JXKXrEZxsZGNK/nhv6oOZBPSiA8zQdLYMC/fcKEhh5pNdYw YZHQ== X-Gm-Message-State: AOAM533D0IU9xWF6tptniuRp0PhoMfyoOKmJY+nGwJgJ+/vkcLlEb8Kc 8VZYhevaHpIh5encDbYgl/dXzPtNY4q6ZA== X-Received: by 2002:a63:2cd5:: with SMTP id s204mr9767386pgs.121.1641591176170; Fri, 07 Jan 2022 13:32:56 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 19/24] linux-user/ppc: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:38 -0800 Message-Id: <20220107213243.212806-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::435 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/ppc/cpu_loop.c | 136 ++++++++------------------------------ 1 file changed, 28 insertions(+), 108 deletions(-) diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 30c82f2354..46e6ffd6d3 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -76,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(;;) { @@ -102,61 +101,10 @@ void cpu_loop(CPUPPCState *env) "Aborting\n"); break; case POWERPC_EXCP_DSI: /* Data storage exception */ - /* XXX: check this. Seems bugged */ - switch (env->error_code & 0xFF000000) { - case 0x40000000: - case 0x42000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - case 0x04000000: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLADR; - break; - case 0x08000000: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - break; - default: - /* Let's send a regular segfault... */ - EXCP_DUMP(env, "Invalid segfault errno (%02x)\n", - env->error_code); - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - break; - } - info._sifields._sigfault._addr = env->spr[SPR_DAR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - 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. " @@ -167,24 +115,23 @@ void cpu_loop(CPUPPCState *env) /* 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: @@ -193,51 +140,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; @@ -250,28 +196,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"); @@ -292,13 +229,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; @@ -355,13 +285,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"); @@ -444,10 +367,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 Fri Jan 7 21:32:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530513 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp728932imp; Fri, 7 Jan 2022 13:58:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQdEtcZTZgE/B9FB2/KKVEREaPcxz7vaZbty+uitIOVX54Q3OuvXXUDGPpeD54O2+2x6Qk X-Received: by 2002:a25:2e41:: with SMTP id b1mr27492025ybn.511.1641592735524; Fri, 07 Jan 2022 13:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592735; cv=none; d=google.com; s=arc-20160816; b=SU389w6R1v/ZT2G5xZz8bCoeKy416GnsnTlrGrlNnFRWLxDsqBHbx8TWJXDPIXDOdx HVOjR14a1GlSYfcjcsALnUdn764xiImA/hrFqjLoKb4IOcdAKjrdV9PkiJSdf+KoKBMx bdlgLDnz4uPvLLAytkSsPmbgSlXJWyF2aOPjzJXaogTmLdA7DHK3qO6iEtJ4BzWPsAXl jqgfX8YVZeqEdcJL0wvbT/QgP+uH7Xuk4uklZ2pHabB3bEume6EAia7i3a8BZSXc03hl w2UAOEP7/qlIoSaK/cE4ICpTdLX3ccGNBYcYDJqci7N2csGvsxtK/9bP6vNuGceTihk+ +xAw== 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=iJB67htN9cbgKBCPEjsPU66VMJ8WI8q4gXhnM+e3yvM=; b=unSnprfNk+X/xv+UvEUaobCTxeB0H8Mn1VQh3xl3tMiaaMdnp/jqNU+bVJF56iPZaf T6A85VC1ss/4f+jmX12tj77PutbuJEdIfbMw4HlaUw0a7nCS+urm4NBjeTrfpniztw2s 74KpflL40Omm4UU7L0f5n+D2S13847Oh75wZxjOxW9wyAsE5od/wI9KL8ozXFq7HjAXq wgVOkEYQJrNv7LMcIcz6lmz7i/d0bc9yXqluzqz5jBqu+iZ6/Wg5FRfJSYIcMVP5+Njs q6X4i8LMQEFWRuvap8glsqodj+Y0jwgH/puny71sEfy0jw7glZn1qRHsbx31RI4Vw0xp LqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fRwcVV4s; 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 w18si1705978ybk.94.2022.01.07.13.58.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:58:55 -0800 (PST) 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=fRwcVV4s; 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]:35658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xGB-0003Oe-2j for patch@linaro.org; Fri, 07 Jan 2022 16:58:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr7-0005H4-KF for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:02 -0500 Received: from [2607:f8b0:4864:20::102a] (port=40748 helo=mail-pj1-x102a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr4-0007r0-QT for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:00 -0500 Received: by mail-pj1-x102a.google.com with SMTP id 59-20020a17090a09c100b001b34a13745eso5905616pjo.5 for ; Fri, 07 Jan 2022 13:32:57 -0800 (PST) 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=iJB67htN9cbgKBCPEjsPU66VMJ8WI8q4gXhnM+e3yvM=; b=fRwcVV4sq1ZJ6dBkJqmoKb7VH1al7xZ20N3SHQtLbAvFG63t0cpIS/SVKVjB4phcXY nUUT9MTpqOUbgymv8WjsI8uCEHB2g+eFBve7cn6dmJMWwpwzzaG7mi/kZXFslnUEAwRR XjR9d42TG+AKWH1I5GYrRcqdfJ5/RGjmFklUAiUNJ101Esevp529uINdvJRqdOAXy+50 BNV8yKySoo7gtdaZS+5pkpYXfegLSZ8EcZML6EP0sCaEA3NSSMaDUqfz5cSQb7cfTYjZ Xi1ilO2GPMiX/EsBGxx/N2IH+eD1Xjzsy5TuUo4/y781WKRJRxwI9M0VihP3wP/YDQjL wjdA== 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=iJB67htN9cbgKBCPEjsPU66VMJ8WI8q4gXhnM+e3yvM=; b=SQk6Uj4upMpAl2MYHOpKX5Q9yr76AyFUI2+pOOcVDdsjBOHrnTwpiUjCRkMXlJcowl wgu3/Zeeep4jAgFuwDVFWNHMPflfRbEiHywlPOiPbGo6oPTo5a31yoMTgL0cDRDeyTfS 7odghYoqGGl569lBjzzJTzJMXu7eEXMX50co8FqRHDrKY1DosMv7skdH3ZJeExwzYO7G 3lNC1UJbeJfvbtQQitM7aDyz03gxD+hlruuL8pYzGI++lDnBTzpYrQpbbHbVs9TlFM8q qjEYFmdQkSiMrS1XZ4+N9CgV6oG/75baDGYCqBT5jmisuUzp6b71EwAjSCIjjcxIwEbq eljA== X-Gm-Message-State: AOAM532QcdGupuG+AH306xe87VrI91Tb7fNB5bfYqI6gYPVfqX34cIsq kjNMYFBToi68aQIJAJdq6j8WhosSY1N4rA== X-Received: by 2002:a17:90b:388d:: with SMTP id mu13mr6465604pjb.193.1641591176736; Fri, 07 Jan 2022 13:32:56 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 20/24] linux-user/riscv: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:39 -0800 Message-Id: <20220107213243.212806-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fix missing PC from EXCP_DEBUG by merging the case with EXCP_BREAKPOINT. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/riscv/cpu_loop.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 0cd8985cb8..26d446f323 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -30,8 +30,7 @@ void cpu_loop(CPURISCVState *env) { CPUState *cs = env_cpu(env); - int trapnr, signum, sigcode; - target_ulong sigaddr; + int trapnr; target_ulong ret; for (;;) { @@ -40,10 +39,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 */ @@ -79,39 +74,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 Fri Jan 7 21:32:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530506 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp724788imp; Fri, 7 Jan 2022 13:49:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyLFbLSaB0OZMgA2UjitdkfiL5nyhHr2QzbMG1uzcis2eWg5BAX4krLrLJnsV0n18pl1UT X-Received: by 2002:a25:4dd4:: with SMTP id a203mr49586265ybb.580.1641592183702; Fri, 07 Jan 2022 13:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592183; cv=none; d=google.com; s=arc-20160816; b=QTnNXn8uW/qREyUJhcFgq5607mxR7hA3TyNqra+f4XZlj/ZI0ywn/Y0JYAfLldcjeQ a8XxNr3GFGT0MookqPfCTNWXYbDSM2mwq6uWmL5TA6/jG/Eafyz2CQnCPxE5lGXc1MO3 2i9O47FECiY7xFNue5Lj67WIRKDw3rEgeyfBPcZSWqVlyN28iVCNYSg4XGlu8xaaSWgO N4OSKqIRRHQhs9ZMaebS/vo828XmZ2KT7xT8MQb1cRZsSMw2obRoWSoJTfShmWeoayTe beKQWAGxyw7kIEVmYTx1jCRRzfNBF0/ljAnCY3on2xnffBwTl+NKiPUGouDbLKNz8K4N jA6w== 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=cnMeOOraRx16biZwob4YbW7EgejpJCPvW6/8VciOXdw=; b=beLELwP9IC+obgJko7Eqn4iH8IBegWQ5kkzE2nMwYZBbB8bt4hh5W1hR5OFBCNXqKh hlZGtPcWELWrgO61sp8DctLQnoMl8xtzytyrWHveHv+W+xRGRtj1cyKpuK4KHFacCiDn rVLR5BM6e9KXr0xrPDHVjghi1jg9HnE+W4r+9K7LMV3L/ACpwSW1UDr44bJI4CNmtkUh hMonOOrwB+R9iDulAjLZ74HldO31Jed85tr4kt7qLbOXuiZeMfC3xFZprW1EWYGKWW7d nHvbU9EDhS35tbv3dWTSN3w28xTfFA1IeX5u6fFjOYzy88ocVNWpADg0dTiqgqpCHCa8 /blg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kyaRAgQX; 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 m1si4776851ybm.336.2022.01.07.13.49.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:49:43 -0800 (PST) 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=kyaRAgQX; 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]:38584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5x7H-0000kZ-7E for patch@linaro.org; Fri, 07 Jan 2022 16:49:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr8-0005H9-Ci for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:02 -0500 Received: from [2607:f8b0:4864:20::629] (port=45974 helo=mail-pl1-x629.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr4-0007rB-Qu for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:01 -0500 Received: by mail-pl1-x629.google.com with SMTP id s15so5798903plg.12 for ; Fri, 07 Jan 2022 13:32:58 -0800 (PST) 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=cnMeOOraRx16biZwob4YbW7EgejpJCPvW6/8VciOXdw=; b=kyaRAgQXiyyfIucWjuzbblrCRLD55HuseGXdt4uRjjnbA4m7zeJm9afBwDqu5zz5K2 WWuDMQySO4d6ax9EdreMzyANaG/WMOkKpp4xkG4gzZ+SAts9cF547/W68DDP3h3471KV xCnyyQVXeyG6/u02h1SKLot+Ni1HJqP/jm1Wq47T04Jmhc/lu1UO2YpfxxU3g7XW8eZL qEaqgxFvpv4W81nseiq/4hY5VMkY5/96l8EPDNZoFw/PYWF4Qio9APCsMHBmN0tAJdcQ s0dvZMYwKjMmwOWpvfAngDHD2LfA59g5HATOsvBDDGKaVvpgxLyjY37i30j1rzjCGQWv I5qQ== 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=cnMeOOraRx16biZwob4YbW7EgejpJCPvW6/8VciOXdw=; b=wju+2194XV+EgljQFr4m3XKu5FGpgPwLudFzxFUWpMugdaVNOBt1vq1fmKrJmRUoA5 WLoJMUR0zhtyEzv5mC1Rh9R2sEIp/NQsD/TVaAzKfz2/aYzs4ioohPJtiITnuLwJOLPO tR4pyH8VRGyhmwuP/nj0DYnUScwScOYw+wxbOjZg9MqPKvqfCkYMup4ibaHD421nW0X8 ME7Ov/dlv7M8tRVWUv9uhOuyr4stPBT0jV7PySIN2u1lQsTz2ixNFuZZc1SWctIg6h9o ofJy5KxHqhrqA4pY0HcQeC4kLrVLRs3Z6OH1okpQQFPN1dC5ZW3rxd1fAKQ1b8ec/iAa P+JA== X-Gm-Message-State: AOAM533mdrKjGh8FGzVofDkQRDgNCv9ToDfhoFyv5l1srclJWPHisehx 81FfkUklQ6fv0XOZA5uEBPICWD7xVzdUmQ== X-Received: by 2002:a17:90b:1e07:: with SMTP id pg7mr17726418pjb.109.1641591177362; Fri, 07 Jan 2022 13:32:57 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 21/24] linux-user/s390x: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:40 -0800 Message-Id: <20220107213243.212806-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::629 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/s390x/cpu_loop.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index ad0c3cd263..7901dfe6f5 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -58,7 +58,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; @@ -158,11 +157,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 Fri Jan 7 21:32:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530514 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp729861imp; Fri, 7 Jan 2022 14:00:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPfJRKMuJXEA0CFhLkfluZ+ru/izomgAvYOEPCfjVaqHnkFRwwfUx7fweiIYEzEtGPo0E6 X-Received: by 2002:a05:6638:2641:: with SMTP id n1mr30386653jat.265.1641592852006; Fri, 07 Jan 2022 14:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592852; cv=none; d=google.com; s=arc-20160816; b=M2OWMNJ9HhbfDbrTWc+JpuNK8PPpcjpmi4x8cZNzLs+zYTBUr0kjAOou9FQcqRNjdH HMAJTNO2c/sstwAqVUNCtVO80hnCrr/SV1gkKbYFuPOMY53JRpPCAF4WKGHrUGyRElH9 pNRBl6xg2eafPnp0+W4yAB5XkPLyVOQWr9p+FeF7eq4SrYIPoI/Euza916SHKjbkguzn sRqztPSBvuU0hHXbKfk+JdBinz6/0uPwzhLu+QOgnsYwEJOUkCsnrqTSSGL24jtyduvu yRIfDX6qm069S/GX9uGd83PuZ5oEylH1z1jIJXq5mlB9kcoA9ENtw3N+eAmC7teohbKc IVvg== 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=IoCTcgZr8ax/7M37Z9ZYxx4sW/uyBEgqSZ20UDGQHeQ=; b=CNG4UMDRYZMg39mjwM9AzrExSTViMNbdAXqefH0GNIRtWU5DzHxqA7IU8jDXrjjalz CRYTZJfzX2anKb5054LatfHEkRuChzEiqaxXYz9gNB4G8G5fEqdwWRhU9hCldD2so7zn /h+iMsC0qzjbOxXHjX6CM+kBDFqMTugZWRA2mDhMn/ydXf+V0GHZL5RY2Iw7QdabdSYE gePCkfC1l4yiSeMti9LSNUZuZtNC8HwDqCtsG3XaFop9au9esLU06oTK9Hc+KK8ayq7e swXSHIO0It3r7ueobSlw1OBMjJKOQ10xN8bOo7R7+vIjti42B/aHtuggd6QM0jOZrhTb K21Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gMQmOXzk; 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 h3si2922022ili.73.2022.01.07.14.00.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 14:00:51 -0800 (PST) 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=gMQmOXzk; 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]:37796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xI3-0004rR-Gj for patch@linaro.org; Fri, 07 Jan 2022 17:00:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wr8-0005Hh-QV for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:02 -0500 Received: from [2607:f8b0:4864:20::1031] (port=39880 helo=mail-pj1-x1031.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr6-0007rN-BL for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:02 -0500 Received: by mail-pj1-x1031.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso11741856pjm.4 for ; Fri, 07 Jan 2022 13:32:58 -0800 (PST) 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=IoCTcgZr8ax/7M37Z9ZYxx4sW/uyBEgqSZ20UDGQHeQ=; b=gMQmOXzkwTxyrm2GQhr6We3rFtK457tlpDKpS/nEFpBZMyd6NT1i5fMNoshLMhL5EE A28livDmGZH8/uwwiIAUedKptoKKoKrUE4rpGcZorKxp2d5E1aR+UMSAD2NGU16mGOuB W+QgFtBDS358UvPLMastvR/6W0E7+E56rpUeqKJN8lrj1x85WQqabX/05LTjclJIo2Gi h+g1VBwisfuXzr//d0sHr7R01e+D09JfL+Tp7cLl5R8gklsKwFwU5kBqp6BKarXxsRXX XT+vN5fe7avJ6oNgDi8/j4vsJsECmO98/cmTBciXcpYuLxI6r85ulwPq5uI0yAn0kTLB f25w== 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=IoCTcgZr8ax/7M37Z9ZYxx4sW/uyBEgqSZ20UDGQHeQ=; b=qXLzYMod5giWEkECHmIZ5ZYSg6VnAF8dv9NM+iCA4DrZ6Bu0FtM6Vb7JuOKTNkM0Ui ZGQJD6fwWuMZa0i0cSATXfpibajL2JNAqNAz/11W7PV/mnoaoJPAjuSGSXXNA4CHhXeT pxHS+MLTTho1/3+n6QFXODIVffOQ/nZfwPR3g0teGeExonq4m/SovYTiamSCLTqd7oBs cOJrj4NMmh9sG26lKPuGfMJpzPpRss1c4FkW/gSEJmCWPi9mjL1B4f8PHD24agYPXyde QQj3mY6QpJ03ltQSlwxOBLFrZemWRKEQ1yRq/FRYSz+R3ZOuZ2IqWdu53XvSNogr7tAK Zc7A== X-Gm-Message-State: AOAM532ZCA7RJpy9axXFHmeQESzgdJHi+YRuPgvtgCZZZbDYCmbsGJtX mj/0SeUT+2CwV31P1qSe0y2Lu7aRJpGVsg== X-Received: by 2002:a17:90a:ce04:: with SMTP id f4mr17958746pju.10.1641591177986; Fri, 07 Jan 2022 13:32:57 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 22/24] linux-user/sh4: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:41 -0800 Message-Id: <20220107213243.212806-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1031 (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/sh4/cpu_loop.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 3290f6445c..1bd313cb19 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -28,7 +28,6 @@ void cpu_loop(CPUSH4State *env) { CPUState *cs = env_cpu(env); int trapnr, ret; - target_siginfo_t info; while (1) { bool arch_interrupt = true; @@ -60,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 Fri Jan 7 21:32:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530515 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp731068imp; Fri, 7 Jan 2022 14:02:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJy27oPvdePzOrctv58YHaRJ2IZIQLRe/JR9b6do7K1aMIOgqESIayWidbDFScbtfNMLinpX X-Received: by 2002:a25:734f:: with SMTP id o76mr71880346ybc.412.1641592954680; Fri, 07 Jan 2022 14:02:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592954; cv=none; d=google.com; s=arc-20160816; b=otUjznfgrHndMleXQnvu3wNY7oXNIo5UxJAoWyGzWFjgeMt5PCZ0zbTFFSz4S1wjj8 pkg/0XfJ2nw/5Ci7+exQTnYlO5bWFN9gS1RE1xSauiIouNN68pR68u3A9BlrvdfQTinu 9JXAytniJCTk+5YCU2rJ2CMDWZmHJrilD8j7PDXB2cjwHvn1vcmpb9VbkGEuxQNYjkXy 6hSIEXTsuH/uYbaNmLqgtApBUkDbS/kjGwv2I7Dsk/CUv3UQHWEMXjvZH0MVf0PsH6yx h+oZP4NesrVgQcgpYw2p5pnjkv61wAZJroUh+N7d1Memsepc0fYzW+rXWuuGwhBdpQ79 a/Rg== 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=u9uVWp3qS2YTdbd/RG5Q0Twd/YIPbK2X8Gp271zvnmY=; b=Qp0oLM/GMRRaEbLVAgVDqnJRg1mBOR23/1uRfBOp7/lPwIFAQws0NYJ6usRn4muAmA BBZcuii7gVViLNAlDHWkh6xP4NvoXT9EF+IF0oIZrAiWjXZiTvHpz28jKh2F4x2eR2E2 +Om8NuMQNZz/gGMFAviwtFQaJHk9OIUVIrc3fjb9v+jmJ3wD1cWOCPhrR7hjlGI0M9mm 5i870wRgMmzDIneHM1fNEkNO4aM6PdqpV7Gx66N+viyopzwNv23Tu7YFW9bsmHxRGX4e qa1bHN5JxGPzLeMspvs8nUKBGrB4B5Rc4e4Z9TwwxtyQHeOgDT6sKHXje1OYkeLsEutI GFEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PmbTB+wV; 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 q11si7251204ybu.764.2022.01.07.14.02.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 14:02:34 -0800 (PST) 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=PmbTB+wV; 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]:41266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xJi-0007Gs-7i for patch@linaro.org; Fri, 07 Jan 2022 17:02:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wrA-0005LG-5C for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:04 -0500 Received: from [2607:f8b0:4864:20::62b] (port=37854 helo=mail-pl1-x62b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr7-0007rd-Cp for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:03 -0500 Received: by mail-pl1-x62b.google.com with SMTP id q14so5839850plx.4 for ; Fri, 07 Jan 2022 13:32:59 -0800 (PST) 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=u9uVWp3qS2YTdbd/RG5Q0Twd/YIPbK2X8Gp271zvnmY=; b=PmbTB+wVuUgYU6SdWHtSPpyZ4I9BcNAulhGPvTopOKe3eBpfnuIIx0ogGxsjJaIISg LJVM9dYnRQG+6WveDD9Jbex5WPUWSWuR4SRD9/CkobJVQ+xUjIHINfq10vAs0/YljB6F FvHJeQ/pmzKe8WZvCQ+pgxf1Xv6QBG+nKT72/Hwakp7HGlQABH2xeMniUCfN61ZJCrdY oEa+8FuNNgHMYx80XhSQz7dfv5XYXcG2ZY9DHSZ0huwSwbK9GJhmW16EMz5hsZD+Q9bR uqO114O3n3+Io7guG+s0Jdn98ZzhUddMYTGiP6i0V6seRr7GjQTE5d2kdMyXKgHcjndy j+gQ== 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=u9uVWp3qS2YTdbd/RG5Q0Twd/YIPbK2X8Gp271zvnmY=; b=s7wNBaIB73xaV3ynCUFucAf17tFnsE/0BAQsn65Q3TOdJD+kJL8nX+N2ua7kj9/AfY L8c1wkdsZXtwUQT7UyTKv979TeeqgLOrY1ZXNLWb9RIKsTpmSmDBQddH1lJwbSQv153a DNrjxVu000/ZN5rf1tmNcbHKmStZls3DC+jUFNddhFgkHX15WZuwHNB+W8eyB6QmWGLi rpXenZEq6yXY7StoaenlvdmgBZQ92ZUwUxTp3l2afTa5hF0qgves+LvMZtDu9F7zbtNV 4wRP16KFkVNFzFQvLtpk6juD+uDWe9G/tJXkhP5Kc+YvDvVZ88iilTT/qWzKklHyBQqC AB9g== X-Gm-Message-State: AOAM530dBb1iN1cv5j46uwzTH130NjIbQxO9zzujXvuzVfOHRMufLCnJ l/mv5Y/UCB7uaxuoQXN2JM1Cj0OqRZRjgQ== X-Received: by 2002:a17:90a:9f08:: with SMTP id n8mr14029244pjp.106.1641591178587; Fri, 07 Jan 2022 13:32:58 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 23/24] linux-user/sparc: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:42 -0800 Message-Id: <20220107213243.212806-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62b (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 8765ab6020..baf3d9ae01 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -155,7 +155,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); @@ -241,19 +240,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 Fri Jan 7 21:32:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 530510 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp726464imp; Fri, 7 Jan 2022 13:53:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiwt1qETZK7sAQTpsTBfJq1TRhuhHuKFgg/Ti6HXLywpRphxchyTwya1l2iSZo+mNXniql X-Received: by 2002:a05:6902:1143:: with SMTP id p3mr54612224ybu.329.1641592387413; Fri, 07 Jan 2022 13:53:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641592387; cv=none; d=google.com; s=arc-20160816; b=pOeOyZe2jl9aHUAlzajZ/cP+mKNtNGQFgxpeqXxhjGZ0pH1Q+iAPqgAQGDHQqd/kb6 xip4VEkN5dPo9VnT/1UOKYgiIifa8b5ja4pnNkaMkmUo/6lA4/fCIItHAFL2+Yjn/P54 hnwDkmHy0Hq6UqtvPQCYA8tuf47I0vTloXDtraWe/OBY95lSuQgOHtGfLNreU9/JUhNr wZkMx56jLalcZfhzF9rbkPbm+rPh/lyvr5NZT62pgf1oQfm6L6QVX15VUMYN8SMoKJvb AoINvb/O3VfSv9CzynQJPSuqfTnKuHsfGsfJet+dWpz8Re4w/mWKHdyb9qEQIefQW06o 6B8Q== 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=Y7IWt5TJpvIuMjQ2ZoKSDzqbrC2a4qCP2oWszVzq9gw=; b=N4Ju2Zu2p69XMn7gRPvjFQuoB7m9WoB9SaRWduEXGLBl5LRSDUN6chA1FMOKxZDYUc 1SRBiaEjEx0ESID8UQlOzSZawzIQLVu6IHPGnwdPx5HPd2W2GppGQZrVGBa07Og/BaEV IwKAkjyMAYDKzpA4J2JUBRwiquCyCkdWTi4Dy86ZJR/HRdgzuVtYCdb+thzr9/8Yz/nC HtX5WOtvEtjrS1FhnK9VPSv8q7gPaJ7H4jgnLir3vFieV3oCpXIt2zqxXpuFjZ14vHNQ FpJcqDLDvks14uqS2ie88qY0fG0GlEH3Qc8k2ae203+Hk3rG5p0kzsgueigJxN9tWMzh INtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ru9I+D9J; 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 v13si4604543ybl.508.2022.01.07.13.53.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jan 2022 13:53:07 -0800 (PST) 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=ru9I+D9J; 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]:47278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5xAY-0000f5-UN for patch@linaro.org; Fri, 07 Jan 2022 16:53:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wrA-0005LH-5I for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:04 -0500 Received: from [2607:f8b0:4864:20::102e] (port=41882 helo=mail-pj1-x102e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5wr8-0007rs-4i for qemu-devel@nongnu.org; Fri, 07 Jan 2022 16:33:03 -0500 Received: by mail-pj1-x102e.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so7635375pjp.0 for ; Fri, 07 Jan 2022 13:33:00 -0800 (PST) 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=Y7IWt5TJpvIuMjQ2ZoKSDzqbrC2a4qCP2oWszVzq9gw=; b=ru9I+D9JMi63GzrYSwMY7LHzN2JQACOxaFfcI4CfVigxlkFqOlrLHLGoVlf588Os+s umDno+vLBqvXxqOMWhqMo5kXRy/sFy04/QcWxfMLSc9q11TeKqBUAbzwxBEddtM+kX1X cwoTi5LVRlWtYbaQW8HfwxsA4ShsByTLfZIkD42hx1cuHLSR9x9n59cXOCEICeKTu+cD +0gMgjIit1hTLVawdFhW3E86iMXV0Cl5NFQeIHdGcMSaLddt6q7RV3421Q7pbRbFzgKA a93E0+IaXcbVHicJlhGC/K+3gJTwaT+7haJoxgMPqSf9sD20ZWSf+f1KE2i7a6QtrQaB KKdQ== 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=Y7IWt5TJpvIuMjQ2ZoKSDzqbrC2a4qCP2oWszVzq9gw=; b=p3bbDXwiCov0ZDdQFqZO+GGxydYE6szXHmyaPxBTgebll4EGRdtFNI8R2xtHzl1JRC W3Sc6CvQ0kDkdOun+W7dRPxW4vw3X3LHG1WVz281qh232vpF2c3tqmZKSMSc3JUSMHcg mQ0jQAMY8gUN+JmtBpozDErOrmTZyXKH+k1nlvq/EyL+OAd12NlH3MIY+EkVYbRX0JQe EWigFbM0SbYMnT5f49Z2rDMgMrC9YRWpOqpp2mq/r9YLTEEce3HG0doF07MwoFa/XNeg 5gHqC2uuxp/kky+En8hm/YupX+NFc+fBvBUp0tvQcwYJhBHuI1xeoIpHl+JXhf8nSFTW zzUg== X-Gm-Message-State: AOAM5303qNZAVYcVtbkWVrpKL3Nu14d3n+Myq2QO7zYftF30upa8/y1r 0vp8Moz6aiGBQH7IZLxCXMKMlpMt08QuAw== X-Received: by 2002:a17:90b:1c88:: with SMTP id oo8mr16986428pjb.212.1641591179208; Fri, 07 Jan 2022 13:32:59 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id y11sm6633030pfi.80.2022.01.07.13.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:32:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 24/24] linux-user/xtensa: Use force_sig_fault Date: Fri, 7 Jan 2022 13:32:43 -0800 Message-Id: <20220107213243.212806-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107213243.212806-1-richard.henderson@linaro.org> References: <20220107213243.212806-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, 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.29 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" Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/xtensa/cpu_loop.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 6bc6d6dee6..d51ce05392 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -126,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; @@ -163,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: @@ -219,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: @@ -232,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: