From patchwork Wed Sep 28 08:15:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 12992019 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 B70C5C32771 for ; Wed, 28 Sep 2022 09:48:33 +0000 (UTC) Received: from localhost ([::1]:34804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odTg8-0005cn-Lz for qemu-devel@archiver.kernel.org; Wed, 28 Sep 2022 05:48:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSEL-0008FD-MV for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:52 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:43097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odSED-0008Fi-8E for qemu-devel@nongnu.org; Wed, 28 Sep 2022 04:15:40 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1My3Mv-1pS0kd47ix-00zXJ7; Wed, 28 Sep 2022 10:15:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Richard Henderson , Laurent Vivier Subject: [PULL 27/38] linux-user/s390x: Save/restore fpc when handling a signal Date: Wed, 28 Sep 2022 10:15:06 +0200 Message-Id: <20220928081517.734954-28-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:VJd4pE/Ez6uezQQ+HpdqZ5HrIVflV/cv2HmUc81oPrQSt3bipm+ fzf5j3boPCwccRFLFzXsb6ns3tG2NLOk9hotq+7ta183uZBcsAAHdemndK1ANgeBgZ8wtAG VY6Y/PRXpQnVCCcCtNDdn9yR2Vr4wDam3HtX2My8E/tFc7pJ3CIx6sfE5GqPdOH0i234WwY FdiOjLwmxt3PxJIQMgcxg== X-UI-Out-Filterresults: notjunk:1;V03:K0:+2afVwXsjaA=:Kky4eThTtiYveYlDOFOPf4 6Z8hpYusPzjGHUn7SjaH9rXDFpcHHDX2uy6p0ykBNR+3SLcbdXV2h/r2WN/4rGy+sfskJWxb0 aSzCauxTbcQoSc3/vJ1655bHMYUDjg1b3fxl+jPO1Y3mhFGexJLSVl9kLq8V0cDJSp3dONzyf d2GAqMZWRPg0dyoP/yLwyNURJxw8lNEF/OUolF3TD4rdRaR6L7CMF+CvY2td8K5NOlOSjKElF fdef7geu7A77hwUKRU+U8U/5hWRI6O+LD9F/Ro7hqN8wunBgirm9K0RPDapZFIyLBfsC0Jrtj 2rFI0Yp2YCnuBB6NTpCGN9q7IHsQN3UpY9xfPadNb8zdY2lLEAhQeN6kS+/i85WY4xcHDqKeD d6JglbnoFsflfnCV6B6UN9xrt0+HWPTcbg/XMs1Ej217yZvjBi2BtLALFC5DYG79E1tQE2jpM 4gCXzSFpvCNTs0QPVZtKcwmPuFcQvtpfTB9nd4e3lHmkpFfaC6uB8/BKpDa37PHmCf7+Rr5IY LgOLg5j/keLLYZoxpCucXO+CFpzfCLBuquTzOqBMxCPk/KUxGiJhGDZTzrpOwX6jVe2AR3E1V NXDm7OQqRGWX5wIoOjIYTDvPj7PTmQxk7TlB55X29MvvLycyVgVtAAnTEV5A0apKYtE3wvlNA LhEk9+FUNbMwqgAQlLCFU7SinuCSC7Hgesxd+H+VjivY8OwHMrwShUeHnejkKsZR+Swsi+wwA onKcMMfKq5CAnupD5cdj8aNsgWbauxEOk+c9YHxOrIbr8x/Ja2LI/hJEnlYB+RRP5nyu/qIWP +7RmSWJ Received-SPF: none client-ip=217.72.192.74; 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_DNSWL_NONE=-0.0001, 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: Ilya Leoshkevich Linux kernel does this in fpregs_store() and fpregs_load(), so qemu-user should do this as well. Found by running valgrind's none/tests/s390x/test_sig. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Message-Id: <20220817123902.585623-1-iii@linux.ibm.com> Signed-off-by: Laurent Vivier --- linux-user/s390x/signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 4979c4b01791..f72165576f3b 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -146,6 +146,7 @@ static void save_sigregs(CPUS390XState *env, target_sigregs *sregs) * We have to store the fp registers to current->thread.fp_regs * to merge them with the emulated registers. */ + __put_user(env->fpc, &sregs->fpregs.fpc); for (i = 0; i < 16; i++) { __put_user(*get_freg(env, i), &sregs->fpregs.fprs[i]); } @@ -331,6 +332,7 @@ static void restore_sigregs(CPUS390XState *env, target_sigregs *sc) for (i = 0; i < 16; i++) { __get_user(env->aregs[i], &sc->regs.acrs[i]); } + __get_user(env->fpc, &sc->fpregs.fpc); for (i = 0; i < 16; i++) { __get_user(*get_freg(env, i), &sc->fpregs.fprs[i]); }