From patchwork Fri May 12 11:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13239140 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 B69DBC7EE25 for ; Fri, 12 May 2023 11:24:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxQrN-00062Y-3b; Fri, 12 May 2023 07:22:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxQrL-000624-RZ for qemu-devel@nongnu.org; Fri, 12 May 2023 07:22:51 -0400 Received: from mout.kundenserver.de ([212.227.126.135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxQrJ-0002PL-HO for qemu-devel@nongnu.org; Fri, 12 May 2023 07:22:51 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MC0HF-1q3BUs21kL-00CPEi; Fri, 12 May 2023 13:22:43 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Daniil Kovalev , Jiaxun Yang , Laurent Vivier Subject: [PULL 8/9] linux-user: Fix mips fp64 executables loading Date: Fri, 12 May 2023 13:22:37 +0200 Message-Id: <20230512112238.85272-9-laurent@vivier.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230512112238.85272-1-laurent@vivier.eu> References: <20230512112238.85272-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Abi2VJYAiPvO3Bo9u7tHPh5g20oYvFmbE5FUTROq+OcAgFhHJkZ VyUG98nMXyuN58stbpVJ5ZmEm1CajB/Ob/BcehDeuPH4ypBNHODVRbunpU6gwF+ZA/oMsQ7 s+Dnpwlz4HH+0PFFvg73eBP5fJGoqRBHiQ8k3R5dkIEkZmQG20xIuxcDPwk3VFYRN3sprgm 8lNiE8/bAxI2ZplE2IIxQ== UI-OutboundReport: notjunk:1;M01:P0:/jssH677x9E=;MYVKNXsCnQfF9ebryN5Sld2Va9A YQN3OKLRtSLPZ4dtaSrTo2C1kwFV5DZ2875FhFacRPxYjoYOu3f+Hl7ypy2FqEcnERGcePXie Fq2frxKFjLeGzlMpwuLWDO7Ql+KNpF8186LPDoDZBCtomQg+6g2NJcJ/8P7JLJfU+yqKQmCuD KzmMPA/VlOkg0KvquvGMrzK2GFvDkQifH7v5bh0inxlhesdmxo+1M6dDhQaZFov5M4geyYTmL N3rFxcKlUyhQLj6zZBN+BbzhTOFPxiCD2gGAspUFaUJUHqDFnTnviuhUPNgthflIs26m2tXCA ZXuOKtJNUlqP75I7P6ZL7hoinvaJthLUux4HZTKm+f1uyjK1G/eI4XDFjad9/s6PB14RnqchF L9ZJOGebDxixuvNJBH2jKxUS7bmbSW5KZAhgs7dFC3rZxzL14LyjH+MS0g7mCqshLOI6xxRmn wjf+H6BFDsihqCAWwaWTqFKmtMEjadcN2GrbDv2cZDLf9ObsWMBn1becuEa+wLsOPJQy9MvM4 hWRYxcF3sBnIEr2oPAgPrjxKCtvKAgPVBVKEAmisux5dcrJ8jz4WENDaAhNRmCf9SO8dAn2+O mnk1hMPplC6FphS7fB+mKP2vT81qEeMsZbB5eFndiNGkIwjSXiLPyZ2wqUE/7T5S4v/oDQ9Z5 wp5z6N0hKdkyHU4wzoHxtZDJMe7Om67pD1vJpf1M1Q== Received-SPF: none client-ip=212.227.126.135; 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, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Daniil Kovalev If a program requires fr1, we should set the FR bit of CP0 control status register and add F64 hardware flag. The corresponding `else if` branch statement is copied from the linux kernel sources (see `arch_check_elf` function in linux/arch/mips/kernel/elf.c). Signed-off-by: Daniil Kovalev Reviewed-by: Jiaxun Yang Message-Id: <20230404052153.16617-1-dkovalev@compiler-toolchain-for.me> Signed-off-by: Laurent Vivier --- linux-user/mips/cpu_loop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index d5c1c7941d34..8735e58bada0 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -290,7 +290,10 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) env->CP0_Status |= (1 << CP0St_FR); env->hflags |= MIPS_HFLAG_F64; } - } else if (!prog_req.fre && !prog_req.frdefault && + } else if (prog_req.fr1) { + env->CP0_Status |= (1 << CP0St_FR); + env->hflags |= MIPS_HFLAG_F64; + } else if (!prog_req.fre && !prog_req.frdefault && !prog_req.fr1 && !prog_req.single && !prog_req.soft) { fprintf(stderr, "qemu: Can't find a matching FPU mode\n"); exit(1);