From patchwork Wed Sep 28 08:15:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 12992147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02E2CC6FA82 for ; Wed, 28 Sep 2022 11:08:59 +0000 (UTC) Received: from localhost ([::1]:34336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odUvy-0002UP-Mx for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 07:08:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSED-0008EN-8x for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:43 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:33237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSE9-0008CT-GY for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:37 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mo7if-1p2fpQ0ZD9-00pbgn; Wed, 28 Sep 2022 10:15:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Helge Deller , Laurent Vivier Subject: [PULL 24/38] linux-user/hppa: Fix setup_sigcontext() Date: Wed, 28 Sep 2022 10:15:03 +0200 Message-Id: <20220928081517.734954-25-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928081517.734954-1-laurent@vivier.eu> References: <20220928081517.734954-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:nyvb0xlTfKgSrLZh0sNx/EtoZdcMLg70Ejf8AFpKn0fcZoepwzG Cf5V0S1BLW1tL4q6fWy8Xfys0RjpDaxWetPa4RgwdbqYsE5R0fU2qvFG0xhi/JhrpVXucrL LA9ombmSQDFT1QGmUjYyT9s3aE7PnpzVgYNl8eee9Hp5olcLGSJxcPSzJDAb11SR96Xkt+y BP5sd+bOpNqvD1LKifeOQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:wyqlZvSCPu4=:nnmB46SSLUAfGsYL7XVoH5 M9vIwEDRo12jYvcgnWBOMsQs6hLJriYysAoIQUWZgXMdCyQWhF/VmE4UdI9uSlhMjpb56F7k/ h9MlmJsyFtjsbAGdFifBHYFSnJlYZFihA8BXwSozDWW45GPvJGfVpjbINvdSj4GIwZK0kPi17 6mbcgYeHZIFAtxjmoH3jTfTbGddlrRWy4zfS0wezswSyWowmg5PhEATkcP6kfajH9bgpSKicD u1hA1bOx3vIzCnxo1k8ta6rHESCohTa/yTfFhPstXVA/Lx9vSRlQrs85SJR6HABuEgXmvwjhR CE9bnssq6U65bWYQ9RkG0x1rVO/KV+9c+HPFBd2guRBEgUKDlhbUt+y+L++DvJRgwjkunN6LY bUrQMxd5qjre2p1GW7XqNLeXxnSrmY0lXyh5ADiKSidOBazZ4UXumvaYXi5n1xPfSosNmVXDa zAa5pOQvRkIdq6CHlQwCXyUaX9m4pwlnzZBNgB+6ecE58si6WAkgsrKPPIjmM+94iyvNVuqcF PR0N+v5+R4QcIBkYHnHN/yqLfTvUf4RH4HsRrhl0TIn94xVwzEoSIVpnY86K+tbPJCB4iWUxQ 5U7rbNimbA4ARzKhX3WLa7qTXJbA9h5+vD+wk5a8vQR0cA4F3MfNS1taCgEDXDitvvl9iZtSP 2WJNIq8RFYSxYSgWgb1789gJIMltoUYJAEODxlTsVOspvQ7EZkrAx3lTc/A8kLJ5fK5INJFfC iTYmzLGqi1w2a6vmuZ7biXmTEW8DNdXKEmr26EduvLx0bvBTf9QckE719UBjQWCiCiwflKSRY 8lCeI/7 Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Helge Deller We don't emulate a preemptive kernel on this level, and the hppa architecture doesn't allow context switches on the gateway page. So we always have to return to sc_iaoq[] and not to gr[31]. This fixes the remaining random segfaults which still occured. Signed-off-by: Helge Deller Message-Id: <20220924114501.21767-8-deller@gmx.de> Signed-off-by: Laurent Vivier --- linux-user/hppa/signal.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index 396e310dc92d..f253a1586461 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -49,23 +49,13 @@ struct target_rt_sigframe { static void setup_sigcontext(struct target_sigcontext *sc, CPUArchState *env) { - int flags = 0; int i; - /* ??? if on_sig_stack, flags |= 1 (PARISC_SC_FLAG_ONSTACK). */ - - if (env->iaoq_f < TARGET_PAGE_SIZE) { - /* In the gateway page, executing a syscall. */ - flags |= 2; /* PARISC_SC_FLAG_IN_SYSCALL */ - __put_user(env->gr[31], &sc->sc_iaoq[0]); - __put_user(env->gr[31] + 4, &sc->sc_iaoq[1]); - } else { - __put_user(env->iaoq_f, &sc->sc_iaoq[0]); - __put_user(env->iaoq_b, &sc->sc_iaoq[1]); - } + __put_user(env->iaoq_f, &sc->sc_iaoq[0]); + __put_user(env->iaoq_b, &sc->sc_iaoq[1]); __put_user(0, &sc->sc_iasq[0]); __put_user(0, &sc->sc_iasq[1]); - __put_user(flags, &sc->sc_flags); + __put_user(0, &sc->sc_flags); __put_user(cpu_hppa_get_psw(env), &sc->sc_gr[0]); for (i = 1; i < 32; ++i) {