From patchwork Wed Mar 8 13:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660445 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330112wrb; Wed, 8 Mar 2023 05:34:51 -0800 (PST) X-Google-Smtp-Source: AK7set8bWgTDwUMg1fMMIj65tsozdEEYBPBkJru4wr3pxCzJwf4DvWWc6ro9KitTEdZ5KT2BvxBy X-Received: by 2002:ad4:5f4f:0:b0:56e:b59d:2ee7 with SMTP id p15-20020ad45f4f000000b0056eb59d2ee7mr34689780qvg.47.1678282491739; Wed, 08 Mar 2023 05:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282491; cv=none; d=google.com; s=arc-20160816; b=LsMZREymmziQYdfuDhCS3ncgFhJEI8uJBGsHAt78Ed01XVJHoT2yQ5JnH8b0Fs6edR XAMM3tXYshqb04nCQNdgYfqAZ6Ly9HTPsR2934XZ7M8D8Pkf144zuhJZRCxbPpGHH1HT aLaMm0VDqWNFMgTAnpf0/7RO7gEGbRKq3kMq9O2BcuKPRwCmsrqb+tXlV1+0vqG6PGm7 k+YR2bFO9G5NJBR58h0nbs7cDNRsU6ZcZ1ybWzGPga1SvvCdOLGGBV9qF1V3Fm9+v+h0 dZAtLVI5fWtvSpcNzl/ZO1X4Sfqy0wc4PoA47Vd//MYIy7MpAYtaC8Opw8smbAYBswa/ 6Dog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Q5XYsOcRuUhudChN/bURcmhRJCpRSD4fiAxXv3BImqo=; b=dGDMHHlqFqRDmjN98kcgfbOfryzDlSKSSwhpLQeJz7AbVA3ERAGckXR34YY98XZGRT 1Sc5QVHsNXy/qziGmr8MTYNrLn8wdKR2lB697+zaLlH/V/F1JDLH81Z5jBAVBHLWAIdw jbCc/P7PG7nRdV32g22ZuHpmEjViM6pKdT/qCe/6OomO2QiU1HCtlsix4dmmIfhQajgp LrxyB4fxt3TWacySRdQDz2QkMHrFf2dAh+jvPmdzP9YWLOZu8FfmqczDZE32x6JQ84+z zL5gukyL+Z0H/lcUjVKy7GX/HMvI5HWzP88MFws1V8V5wUy09kWYcGV7QYFpl8xHwbBu 73/g== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 14-20020a37030e000000b0073b58c32795si11702901qkd.234.2023.03.08.05.34.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:34: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZts7-0002pL-BG; Wed, 08 Mar 2023 08:30:23 -0500 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 1pZtr1-0001k5-Vn for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:18 -0500 Received: from mout.kundenserver.de ([217.72.192.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtqw-00065x-G1 for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:11 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MvJo7-1qQtwj15ub-00rL8P; Wed, 08 Mar 2023 14:29:08 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 14/28] linux-user/sparc: Tidy syscall trap Date: Wed, 8 Mar 2023 14:28:43 +0100 Message-Id: <20230308132857.161793-15-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:74NF9BUavhkFdIHGsVoV/LB4EEsOrkxuu9jm+0mN+TtQvNYJdO0 AdDTp4IRSWxakLL15TyfcChNIFxhScQxo9a2sWjGE72hnId3CV+YeBcgQ7me1JwbJV4Wq6E RBJ1QeqYKSMsChr3raQX1cAYW8ADhVsF86DYnO0PSYuR6zc0nxjyZ/zoJTZCNmx7JqaW6FE fkhlVEkC+JzZp3tzRWkEg== UI-OutboundReport: notjunk:1;M01:P0:i4ILVZGdys8=;N2XPW5mi+T0BnvbfNue5zrMgars 642QsEqtcCvy9GanTFazO16beP63+WAqplExChsv1ikGNr/JFdw1jJDCcVyBUpdjtvR4CeW2p ofqAc+bmfjJNLxLT6K3pYxI5dNlCspFXyCjYf5b/HCz4nW7noJzVrk3Cxe1+F4SofSuVLFutu Otk3aLzD2aWOUEt/PjSR03/lTSQWfnF6ytsCt2qYD+If2qe5eWRklBBYRejsM01VAQ/G9snkI 2z8xiT3Z+FfS733YDjRfjfpaGmY6PS0lC4+N46+QB12bdNNVCudvDJ/8bFfvWJqL9VhgqerZn e02gpaGhyaY1ZBlq2pKLBVllyuZ1OSwd78tvcY8qWAffR10WbjnbTgjkxJROB0uBuIdohHkY9 /c5xyciPFTF4plLs0GTF/bdo1Q+K+zy+W/ub9tu1szAUmBc6h85HpXSaNs56TyDLxhGkKWyhd vzuNnyDPRt9smmMOLNN/xXB9iMGXIO3aQWMTcVsVTi1BoDjMKECoFe07HjWa4lHHe42/J975s RYVw2FfZ6kyURZxh2R9aorqEK2fxfykXcAJqlx+wEQb4xXgdo55Zx0ShwGSXsJ0zPhhNYtzEV ZtBKsEB8K/oQcvLcbzMFTQSxDBR2mi32l5HzhZ9sK445Ee/cVCJ9l10MmTALvnMMLuoeewJY4 XD3UXUrw0EcC53c3VppVTAN6la51f4ujc6Sc5eRZUQ== Received-SPF: none client-ip=217.72.192.73; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Use TT_TRAP. For sparc32, 0x88 is the "Slowaris" system call, currently BAD_TRAP in the kernel's ttable_32.S. For sparc64, 0x110 is tl0_linux32, the sparc32 trap, now folded into the TARGET_ABI32 case via TT_TRAP. For sparc64, there does still exist trap 0x111 as tl0_oldlinux64, which was replaced by 0x16d as tl0_linux64 in 1998. Since no one has noticed, don't bother implementing it now. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230216054516.1267305-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index c120c422786a..d31ea057dba1 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,6 +149,12 @@ static void flush_windows(CPUSPARCState *env) #endif } +#ifdef TARGET_ABI32 +#define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ +#else +#define TARGET_TT_SYSCALL (TT_TRAP + 0x6d) /* tl0_linux64 */ +#endif + void cpu_loop (CPUSPARCState *env) { CPUState *cs = env_cpu(env); @@ -167,13 +173,7 @@ void cpu_loop (CPUSPARCState *env) } switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x88: - case 0x90: -#else - case 0x110: - case 0x16d: -#endif + case TARGET_TT_SYSCALL: ret = do_syscall (env, env->gregs[1], env->regwptr[0], env->regwptr[1], env->regwptr[2], env->regwptr[3], From patchwork Wed Mar 8 13:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660436 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329072wrb; Wed, 8 Mar 2023 05:32:56 -0800 (PST) X-Google-Smtp-Source: AK7set/1xBH7wW0X8QeLWYxAXeZUJSf4zDMY3GP5VOY8H52Go28MaY748LNv76rvmciy2j69eGzz X-Received: by 2002:a05:622a:1709:b0:3b9:a4c8:d57a with SMTP id h9-20020a05622a170900b003b9a4c8d57amr31729936qtk.32.1678282376647; Wed, 08 Mar 2023 05:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282376; cv=none; d=google.com; s=arc-20160816; b=TsVQRWo/tOHgw/yqTIVb+2/m1DrBdQc2aNZlQORkWC3x8q5OduuN/lmnp1B41VbcUG eRXZ7w3BHJZZtHixZ9jCQJwvgov+X8dt7u48Z4pTZtEhJkRizoRL5RYiKJdG18KIGIf2 0ovrqI6rcJKh/gSNfvu3fnnSpxbeMKllWL55wANC5doI6GkN/nksnloWFJ2w4hWlxd3/ kT0trCvDrCngChXPmxHdZzUWa5k1M18Hr87G2a2AqQZ0TJ3Au1gAJdr3lZDlpwqFtlpb XZZaEC/0mnyorcK04iI9vYFU+JVegPh3TrDAz2Y9HjH4c8CVFzZ0eSR+IUmD0bmxLaxR 5kbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=kYhgU1CbUiQJqXtuQjz1qbd8hMdyjcTAwobHrJwwGRY=; b=uoWuiWs7fguP8bcdoUr83zKS9VhKqMQjbYNyI7llPmgDwHYQ+EY529pGLIZOzJwKK7 khhfP17QWrp42T/7SnraWBM/z3uDJWHTQNli0OxEN2HnrGBhjI1wAdKxnSzbNQTl0ogH SDrWxMIK7Vfhehb3bB5ekjErAfBMQx2Ygp8PymyaAh/b4YlUK+v1f6mnsnTw1RFOEJBn ZdMrY8LjsJeKWU6UZDuzj7zkxYt+lOuFfyYpe7taW75BKHOeBHzd0N3m4CtmBEA9AwiX cwerQOkpznnBofOkEtRNWw/iFVJHWa3m3LfkvLGxvVTvjLo2aDFk5Bi95k1LquYoVkK2 7v0Q== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h22-20020a05620a245600b00738e6f037d4si13336597qkn.757.2023.03.08.05.32.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:32:56 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtsX-0003ai-Vg; Wed, 08 Mar 2023 08:30:50 -0500 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 1pZtr1-0001k6-W3 for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:19 -0500 Received: from mout.kundenserver.de ([217.72.192.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtqw-00066B-On for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:12 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MNLVU-1puKQI2xIY-00OqsA; Wed, 08 Mar 2023 14:29:08 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 15/28] linux-user/sparc: Tidy syscall error return Date: Wed, 8 Mar 2023 14:28:44 +0100 Message-Id: <20230308132857.161793-16-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:1zYLFWVGtO4rrkiHHvdEeDaaS+AIk46JYu54xrsxI0kzDl8u0Fm Gz5zu1pwF6Hgjsz4vpTfI553Vf9kYOOx1/qth+iqgPhNKQzq69iP2skqhmEGs3ZOViyNO+m lb3kA4eySiHBWNLH9fPTXVmZEnltXwH4tRx5iWpY18v2AatH/qlFiVoFg9HuXcIgVoQOYwU VD6yeMcLwugqZlvwsWZ5w== UI-OutboundReport: notjunk:1;M01:P0:3AF6ejRiUeM=;UQDz40gRA8/+ZM6eb4RbUivwTpj vLeIhz5Hd4hWzLppNPQDdIZMBoHxP0fJWA1mj0s0iQWlDCa02uhPOfMXAJi06MdRXc7aAVVt2 uY1AWLVZoIMAbiAKZ2ZUW6DoKmXoQcL6Wld5RLnM0gR9+szKf/6lpz+26G7DkV2LHYKKiVbIj 5AqOKwJeaf84NowBGgyRBRV6GEPcmmQkRBhQHTrf+LSvPPAk4wI8pXrwGB0DaoEBfGABR1Pw0 E6Eyv2DUpxapyWE0Qvy8vwNUFoLUh0JKlSjIb5rSwr5QpEKyE+1j19GwTbk+TU2q7J2NUasmP 0S54R/zbvGumY3XkirK1Kof/Q31pX6a0yHkOD+5PW3Z1WaXcDV42CiXdMK1o224i9LEMukj6e CCcA7ECcBCsMoKIM39fyXTUrC0F4eDESxfgzfDAuK1UN4mkSYHTncGvDNhxQwgzGpaAEHdfst AO7NtUoO/542+luMQWuh91XptQ4JtXAVRN9veKNy1kfZhrxa9qqlenK77BbzehbWuEf7/yhay XQ2UYPIOR7rlqNY9XBqdHlsxwxCxPFEaZRwKR9sOJUrCVNTzpTFqdow9gzJWGEcomUaVk0N1o cCqg2ZMwkYnVsVju0CPPGRgo3DazAn4mAj0hEU0u5RRubZP8VOBJnXQzJ3ASslxWcmp4fCtUT IczCl/vBFAWlHJpj5cz/LBM4g4zPXKMiEkkF1ciqEg== Received-SPF: none client-ip=217.72.192.75; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reduce ifdefs with #define syscall_cc. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-4-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index d31ea057dba1..051a292ce520 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,10 +149,13 @@ static void flush_windows(CPUSPARCState *env) #endif } +/* Avoid ifdefs below for the abi32 and abi64 paths. */ #ifdef TARGET_ABI32 #define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ +#define syscall_cc psr #else #define TARGET_TT_SYSCALL (TT_TRAP + 0x6d) /* tl0_linux64 */ +#define syscall_cc xcc #endif void cpu_loop (CPUSPARCState *env) @@ -183,18 +186,10 @@ void cpu_loop (CPUSPARCState *env) break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc |= PSR_CARRY; -#else - env->psr |= PSR_CARRY; -#endif + env->syscall_cc |= PSR_CARRY; ret = -ret; } else { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &= ~PSR_CARRY; -#else - env->psr &= ~PSR_CARRY; -#endif + env->syscall_cc &= ~PSR_CARRY; } env->regwptr[0] = ret; /* next instruction */ From patchwork Wed Mar 8 13:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660444 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330027wrb; Wed, 8 Mar 2023 05:34:42 -0800 (PST) X-Google-Smtp-Source: AK7set81nffkzKAktOVNEo2qVcCVB5SjnB0XyhmeR8NBkAaMKy+DVQnk3PbOhnAM1t0g9bc0TAS9 X-Received: by 2002:ad4:5d49:0:b0:56b:ea0b:3bb0 with SMTP id jk9-20020ad45d49000000b0056bea0b3bb0mr35895649qvb.26.1678282482689; Wed, 08 Mar 2023 05:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282482; cv=none; d=google.com; s=arc-20160816; b=W3SEggjd4y//fEfLZcC6yx4iUmT40Fpdq4Rzn+gOIqUqY0x3qGvvv7tV6TFFYE+WRa MgndcaaJ5xFKjud41LjjDWLVeFrIEM6uSp1YGB8lerTy9RRV+MhDDqmEB5cHWo03wB+h aFyhxykJ4GZd/N+hJdGyGH0sFFr6eyqA+SW9+VOr3h4ayHOMLN2woCpEGKrZluaPdM4k zJ2LVymL1EDjwkjJjhhtYwo97It5YZ5IqTL280yp1N18DWbkxjA6aLFlLhco9hwmBNwZ dK33UBRIssftp3pe/WdN/QSTbybOJV4Ey00ljiFfM9Mk2C80reWZ+IUxnYB6VxfWds+B 9faw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/TwS21vA/Xfyf3OlH3g4+rHZQdV5DKG8eQomNRsWoYc=; b=UastzLOCFpxgTYB/uVtfx1ppy0IH9lQnKhUHYakTWA9OcJqOUULHVWY/2pwZqdHk3C v+Fm2M+Dwq+05+JHRTneVi96vyBHytUSFbXjznRO9TlFHqcf42qCM1BUTvCtzs61EAWb eAkqHr6zXXdSUw9leRB6BTJ0p1FNBL3+iGkRGOR2cLdUV78qiUv64pxA2LF0zJU5Fgie 3+2zlzLOq0XxD+hpp8wRc3k0gqYPRclQPPLP5Ws4xfQjTfQvkuZPRkHzxnR62k4+gecg PBP8jp3qucuqoEqvQ+o9amVJ4y180S5JLUigyFX4blLx4t9L2LOOwp1Jg19t7zxJ7qK/ +o4A== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u4-20020a0cdd04000000b0056f06690184si11739355qvk.38.2023.03.08.05.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:34:42 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZttP-0004JW-VL; Wed, 08 Mar 2023 08:31:44 -0500 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 1pZtr1-0001k3-Vc for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:18 -0500 Received: from mout.kundenserver.de ([212.227.17.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtqx-00066O-Aq for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:12 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MN4ux-1pswAi0qMX-00J6mH; Wed, 08 Mar 2023 14:29:09 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 16/28] linux-user/sparc: Use TT_TRAP for flush windows Date: Wed, 8 Mar 2023 14:28:45 +0100 Message-Id: <20230308132857.161793-17-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:qYeN/98GA+NYxRnwkmNYGUOlzKULnF6Rw0/ovNou3wr0X+3AO4h vlTKXRr3kKH80mPHPOHvkCpRkdwJcp6VcJKsP6RGtLbQI5zQgyTHsZg00/rksEeGbA2vUgf IAz1clgW2rGYZHfxljnPOBLQYQMJPEUZdweya6IIv77ag0fzErcp2ErddNcWG0KEcrJNqCe pc+EgkAGBMuVf8QFsv2FQ== UI-OutboundReport: notjunk:1;M01:P0:QjSPUjZxwFg=;hz/Ue82yjk/W9kIx5u83czCGIYs zN6DB8ZUr0Ps7IG1XkJHa1iwT5PhUI2UhHVMSvFduqtT+JsX2SZuS6VNISQDI6jge4stHNKih BvuKrd0ac4BRy+EZMVkx457FnCvmvzCRwtxYyExHaCuugK49FvJISo53uAUbgmGWD8+ibULS1 njhktL/V44/UQsxoyaMYqz8tFcF+cln598ZrZq6sl3Hc1aoUSDVsWKPEkKz9vBIQcVn8MO93j q5ubLOYJA3cxQz0UlNH5OzorPXvZVc3N1cis64rmVgJ+9M8vj5hXTxlcUdcGhVaS99iOf5K1g Wq7itVDgfMuyL495rnNg+tbNp66sRpcagFIqw/XZfDmoekFl0gv+sObSN4Ec5Ax+rpCgJVvf+ k2lwWenitTAFDIDeJz4vO8xJixcFSyot5aUBQ9p9IvTPHaimDg9rBVn61mfsz54qkTBswbg7r SjELpCLAJ0lf2q0Lwq8KnR21V8+oUyYBX5A/kuusgLcJrK463PLDdCDzjPRcxU61lTn93fUPc 4TNyLhSTO1ovZ3wv+GLgpUD322fSCxUfOaXalnZMHqCh1rYjbmeRVqNzl+PYP9vWuTaCJou54 hsyV5Nf5ymywt+AZd2PXZyBF09sM6BC3sr4P3k5YEmIbVHO93+yKIRUH/hEHSvg0ckxeyPc9h XkrVomcMmCAZlTi4oel+ra1ecG/EwEIILpLj1agVeg== Received-SPF: none client-ip=212.227.17.24; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson The v9 and pre-v9 code can be unified with this macro. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230216054516.1267305-5-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 051a292ce520..e1d08ff2045c 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -196,15 +196,14 @@ void cpu_loop (CPUSPARCState *env) env->pc = env->npc; env->npc = env->npc + 4; break; - case 0x83: /* flush windows */ -#ifdef TARGET_ABI32 - case 0x103: -#endif + + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ env->pc = env->npc; env->npc = env->npc + 4; break; + #ifndef TARGET_SPARC64 case TT_WIN_OVF: /* window overflow */ save_window(env); From patchwork Wed Mar 8 13:28:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660442 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329886wrb; Wed, 8 Mar 2023 05:34:24 -0800 (PST) X-Google-Smtp-Source: AK7set+mTKBrsM7D2Ex6lKTttsHb26+B+xiXBz4ptfExbI0CpLBLmOAM+8qjwpAXolSetk9nwcfm X-Received: by 2002:a05:6214:d06:b0:56e:f4e0:a4ea with SMTP id 6-20020a0562140d0600b0056ef4e0a4eamr28061189qvh.17.1678282464728; Wed, 08 Mar 2023 05:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282464; cv=none; d=google.com; s=arc-20160816; b=HwmMsLjhUTD5+nLg80FM1lZxsw1aQnM294sM/7ytkk0ZpoPS2sdEHfqekXAjq3iXre pmV6gUBoSwnJggXcYwBsFnNjNYJYNI6Xlmv8zkpCucGbcmOHt3WGM+ZqFagNrHIoUf3J CtFI6AdgeARFquwzPVBZJKSqiWQvfEhoOqzM7d/12XUdIuyR2We4IHBDaoPHpbVinM8S adEmOLrPsCR3IZwTN+CsundZyPf1rJmRGRI/4GLb8sawzsFnx2OdI9SauAfAK1i2e29x Xhu5z8AM/ZXMuCOp38IopQScjK8rdvb9Dl2x6yLUdNhP9Fyyl8J3nb3NuTm4zAadwymu lnBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=RlMIAlm3yps0Lx3D4n3/0xxgAHztK6MOe+V+w5A/zbE=; b=lDrDbsfi+omFMNcGJzvwKVgR3YCCQ+UR000vYabZkLDpqrKvY3p7KBfoeTPriXbFO1 lAHS22tHWW1QbnKVsIqoIo7oXCv5wGBfVy11jOaJZC0OmFpkqqf/+rCS3VjaP7dMtfiK +K6X6yXqXew1vkg7127d6VF1IGpXo7ZRCdaCnQrrOXjJ/WW72vimKC+mM2XenuUlKj4t tqDr4+0csPHbjlzyMWSsOPpV72PQfuKpEUFDTi7x9PO/xJ5QGhtQ1a0LmLDI7PcXtb1D gOPiJ7nvX746UtUVbfIoC/BYdDM/2XV+FQo51jOFQKz2Dx7c/Vu5MghQqNK9pPhBrcgd tq9A== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k25-20020a0c9719000000b0056e8ecf84cdsi12268400qvd.490.2023.03.08.05.34.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:34:24 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtsX-0003Xp-MJ; Wed, 08 Mar 2023 08:30:49 -0500 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 1pZtr5-0001kl-7F for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:19 -0500 Received: from mout.kundenserver.de ([217.72.192.75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtqz-00066d-SO for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:18 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mbj7g-1q8OnD2xiA-00dF3y; Wed, 08 Mar 2023 14:29:09 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 17/28] linux-user/sparc: Tidy window spill/fill traps Date: Wed, 8 Mar 2023 14:28:46 +0100 Message-Id: <20230308132857.161793-18-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:qF8BqfTZHyvBEz/BQyLZFKI+mzZylXNGIarDwpwSKTKkWOqV7bU uMKoYl430EjOjcxPUefjCFKFTpM0u0uJG3R3jTfzy2wWneoMzQxMblACjC3dVn7Mltq6bqX jslMOPwyei/B9KwtSxbOoAvDgzNJ6QxkJzHp1NjVBKgHWlSymWjg/9OJq97mYwAx28CUfnK m7ojPAJRRF33bFf5gRUkQ== UI-OutboundReport: notjunk:1;M01:P0:dt6hapDWLQI=;9ZejsjhzCDBV0tkNeTywNGh8PFv qmCStgz6qB1u0t8oLh8kyA4tMJI9Yk5/u04CHstU9KDlfwaOxSr6cg521yIcHrk6s65a5N6XO sQC1AicVFyMRG4vDsOCR3p9egb+RzADD2dDfkBoggGmW9UVdEl+qNvfmGYcjzIgUkwRH3XMAa mc1JG2X0GS41B6tLJRYzXeYEv+TamN2I1jtMBgMX2iB5OgVCfqcmWya+Ew4MHqHTN17oF2X9e bcbeVAXagMFLF/kkmEylFyM1XuTz8Ea5SpEoKhyQaVmHaql3iUvg7apXQqsnNDxaBG2qqZczK wW0c8vuCTRhIMq+dYoqAf5/3sx5KUyPqb5U8PVdcwGQkqUMAPYI6m0chjCWLCDQ2RnGtq7FKM MwUopPdzqX+3T8srPyuSnZhANFwlYoYB3XjspMaWojEyj9d9R2IkGr4gTy7AjGkVXCBdUw/UQ 6VhXOaU0Co/KNGFixwtsEYoSW4+n9Pwv4+jb9QEzfDnMUqfqSiNgANvQ8pruCShIfCLrqvUIy HB//AlxBU1keCUh1UeHl/JopSW8/jOXSrM+L3qtK2v0BT8b04ZN7T32m9pE5n/IOumzJVe7Fr HacfSVGiF7qRzLIbW7dgzGshAReATK/W0EHj5EfJIYQ2fwfxRnfR5dfUFQOYHdsLivh3qkpwn dcTjTUbCGG5GsgVzY9YI5Gg/Dk1FEw4QlV1MF56eDw== Received-SPF: none client-ip=217.72.192.75; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Add some macros to localize the hw difference between v9 and pre-v9. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230216054516.1267305-6-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index e1d08ff2045c..2bcf32590fa1 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -158,6 +158,15 @@ static void flush_windows(CPUSPARCState *env) #define syscall_cc xcc #endif +/* Avoid ifdefs below for the v9 and pre-v9 hw traps. */ +#ifdef TARGET_SPARC64 +#define TARGET_TT_SPILL TT_SPILL +#define TARGET_TT_FILL TT_FILL +#else +#define TARGET_TT_SPILL TT_WIN_OVF +#define TARGET_TT_FILL TT_WIN_UNF +#endif + void cpu_loop (CPUSPARCState *env) { CPUState *cs = env_cpu(env); @@ -204,20 +213,14 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; -#ifndef TARGET_SPARC64 - case TT_WIN_OVF: /* window overflow */ - save_window(env); - break; - case TT_WIN_UNF: /* window underflow */ - restore_window(env); - break; -#else - case TT_SPILL: /* window overflow */ + case TARGET_TT_SPILL: /* window overflow */ save_window(env); break; - case TT_FILL: /* window underflow */ + case TARGET_TT_FILL: /* window underflow */ restore_window(env); break; + +#ifdef TARGET_SPARC64 #ifndef TARGET_ABI32 case 0x16e: flush_windows(env); From patchwork Wed Mar 8 13:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660447 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330462wrb; Wed, 8 Mar 2023 05:35:38 -0800 (PST) X-Google-Smtp-Source: AK7set8rqxzKiTwUozH45kFFn7JF++q8eRjflUJ391OrNED/TJPlJ3j31BdNPNfCQlmp3IOatwCb X-Received: by 2002:a05:622a:44:b0:3bf:d2ed:ace7 with SMTP id y4-20020a05622a004400b003bfd2edace7mr29985075qtw.10.1678282537669; Wed, 08 Mar 2023 05:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282537; cv=none; d=google.com; s=arc-20160816; b=aXDjjSw1vg76UFvuI0d24p2hKHUAtEsGvhcK+Bx4HCbse60Ty+t0XPkbnT3xRW+qZB mf3kPcaUUEr5rQ2G4RiXy1TRoG3ueD/GqSVxfSdxzDjFzh8th7zgHKr3qJ0sqEJ2bXBG JXG17AsQnmckmfLueUc7QQ0hGJHgcF1deQzTwUmlVIhoayMrrIy9RUu/YYhCdpeED46U R8PrsAME/427Uwxbu/WXeSo6fHmI/b+DPxJyQynaQyb07W3XBsP9LtuQYr8Z2F/cg0Vs oegZ+ccqtPPtK3dJJ2jM6GOtZx+gLiWJUDjewUU/pFg5RsGHq3cJWbraA3vtQvdHkzd2 7Uig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/mHzXyYzWR2GV7Jl6jAmZVW5dkD5pUIsZaK+fE3SXus=; b=KM9//NfoKVmHJmxuEi9mrdV4OahCzbbNEu3t2WpsKSyuAZYMWHPhbJcruW8U5Ib4Vj IgnZMrglel8EUKJEs6VQtTSc6dS88OGIJHcMYt/QdFfFJE7d84prwzRQ+3XjDfYQ7Pcs 0EzP/+IftXmO4Qz/41+O6OZle6jFXsN1xvzKT7y65xSIJIVhBkvc1EmJwxPYx2vjtw6x xa7F9JeWZbx84CPSTx0WvzbUpNhWM+GT/JMBWACjYk1KNsmKZKO/0bxDVoYYy2JmrzfX F3rnZCSs4+gM1PhiQTD96hL3Ux55aXmWttcQdATHj6lU9UpYo/dUr6yDRteVizzO4FFq ackA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12-20020a05622a178c00b003a7e162f83bsi12122698qtk.349.2023.03.08.05.35.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:35:37 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtre-00022u-CE; Wed, 08 Mar 2023 08:29:54 -0500 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 1pZtr6-0001lF-OL for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:23 -0500 Received: from mout.kundenserver.de ([212.227.17.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr2-00066q-RT for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:20 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M894P-1pf8uz0etX-005GcR; Wed, 08 Mar 2023 14:29:10 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 18/28] linux-user/sparc: Fix sparc64_{get, set}_context traps Date: Wed, 8 Mar 2023 14:28:47 +0100 Message-Id: <20230308132857.161793-19-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:m843k0kBoCultNKsgrK6bnXtkmMQGCmOv1QB/g34Sv8iuQMvGRB SWYnF+dnwyE9gBCpMXTCt0nZsJYVWEtXsvWavmh/Xo6pcXdy3vH329cVo6zr/Mc0WqNDrHz kBvSRFlfQlg0Q1w2CznHktStY/EWNRO1RlAWgm4r9pNTGnXslhJKfnXOaxx0Db0qufx4RsJ /wntGnkMEdEDrD5k4SDrA== UI-OutboundReport: notjunk:1;M01:P0:b1LHRQgv+To=;Ptw+EZXMTftM3wPoynduOJOCDc6 yLbXgDbYs4Oye/X7xwtBSbP3qG5/wrCSbwtWGbJwkvTCHeKh/bX41aR5Qh+/3XFLX1Qm45Ysz AeO1UFDCURucmJ8ME0tolMbargEpYwXMy34uLj4xRi2xtKIG/1Z4CyoW99Vhm3qDsTyYl/4R5 3oKRf3RtqimtEW+3mbX/JPGo+7Biaj2CboEl85K0WQ5pn3+eyUDTXjxijJDugs6HhscDU9PuI 9OFDP50ckp6cX0vlm19ybmgQRNZut0j+jxGT5TPZ83Fi/8HdDVMHJQh2JxGts0tv+JK6t77lQ tc7pqRE77gHZbAe/uzhn2Ka4CeKQNqh3O9xFW1AjixEXahz6DwnDE73Xipf/ePhz213xaXTbq Bh9DVhmW3rW70UEDKsUbjkvYjmiWi2BcynT8rcOiM4iomfhRbj+xbkiEmtDUETr8BuCcAxLUM 2F+56GsFcG8O58yagV8eKysoHTDfH0qcWB4s4RYEOBaAJw4ltW850prkPqqzlhDnhlosZNV7g DJihmVhXu+qwAMcoWYTzq/VEVG/AlPtk6116jkk9D5wtTiCqQWzyOGFxlIRy9duSujyv/rzDU xapyPTP6A2vC5zKwd3WQUQSt4SJdgdycD1XOtZU8LnPBqBIvx8eBSBYN7N8YAKK5/lXLVMUGa PzznQpQ7dhWIEruxzzGVacwmeyud9ALCfIOIlTFgMQ== Received-SPF: none client-ip=212.227.17.24; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson These traps are present for sparc64 with ilp32, aka sparc32plus. Enabling them means adjusting the defines over in signal.c, and fixing an incorrect usage of abi_ulong when we really meant the full register, target_ulong. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 21 ++++++++++----------- linux-user/sparc/signal.c | 36 +++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 2bcf32590fa1..edbc4f3bdcbf 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -213,25 +213,24 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; - case TARGET_TT_SPILL: /* window overflow */ - save_window(env); - break; - case TARGET_TT_FILL: /* window underflow */ - restore_window(env); - break; - #ifdef TARGET_SPARC64 -#ifndef TARGET_ABI32 - case 0x16e: + case TT_TRAP + 0x6e: flush_windows(env); sparc64_get_context(env); break; - case 0x16f: + case TT_TRAP + 0x6f: flush_windows(env); sparc64_set_context(env); break; #endif -#endif + + case TARGET_TT_SPILL: /* window overflow */ + save_window(env); + break; + case TARGET_TT_FILL: /* window underflow */ + restore_window(env); + break; + case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index b501750fe0f1..2be9000b9e04 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -503,7 +503,23 @@ long do_rt_sigreturn(CPUSPARCState *env) return -QEMU_ESIGRETURN; } -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) +#ifdef TARGET_ABI32 +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); + assert(tramp != NULL); + + default_sigreturn = sigtramp_page; + install_sigtramp(tramp, TARGET_NR_sigreturn); + + default_rt_sigreturn = sigtramp_page + 8; + install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); + + unlock_user(tramp, sigtramp_page, 2 * 8); +} +#endif + +#ifdef TARGET_SPARC64 #define SPARC_MC_TSTATE 0 #define SPARC_MC_PC 1 #define SPARC_MC_NPC 2 @@ -575,7 +591,7 @@ void sparc64_set_context(CPUSPARCState *env) struct target_ucontext *ucp; target_mc_gregset_t *grp; target_mc_fpu_t *fpup; - abi_ulong pc, npc, tstate; + target_ulong pc, npc, tstate; unsigned int i; unsigned char fenab; @@ -773,18 +789,4 @@ do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); } -#else -void setup_sigtramp(abi_ulong sigtramp_page) -{ - uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 2 * 8, 0); - assert(tramp != NULL); - - default_sigreturn = sigtramp_page; - install_sigtramp(tramp, TARGET_NR_sigreturn); - - default_rt_sigreturn = sigtramp_page + 8; - install_sigtramp(tramp + 2, TARGET_NR_rt_sigreturn); - - unlock_user(tramp, sigtramp_page, 2 * 8); -} -#endif +#endif /* TARGET_SPARC64 */ From patchwork Wed Mar 8 13:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660441 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329771wrb; Wed, 8 Mar 2023 05:34:14 -0800 (PST) X-Google-Smtp-Source: AK7set/z/JV8f6tHMzzFdiLWSu9wpM5Q9hI2OrnLaCF2DEdyh16AzJkjzWL0iWzHrQFmjptcf/W0 X-Received: by 2002:a05:6214:3014:b0:56b:f308:caab with SMTP id ke20-20020a056214301400b0056bf308caabmr30278621qvb.13.1678282453850; Wed, 08 Mar 2023 05:34:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282453; cv=none; d=google.com; s=arc-20160816; b=VFWuOm9v4Arwz2MV0UW6G21mVStl4AUpfFqq7w5/lQONMcuyyPskdZ1cOLU6m4DnZo KsEXm5LoxqpVlWg24wlK6l4uI6Y+IbN2EwkMJxdA25THvfYE7Tg5VDr0NCJTVytHJCUr 2p/R1jud69zA/Xbr3aMw1KrRohi7rrHKOxXeGpMN5A4YG4aFTIGbhi97e1mARMqPGNdm IFLzNKXKTFxwFTeeLHX93f5TXYG0JUveg8R2MQUD5+ocsjIod+WSEjxxfyJ9T4p4CcqC 0joALQKKxVpc3agRRJDSVhNdWqwZ6k07/s0J9mfl7vwBHfh9VP2uGQZGs8B1GrhFxeXA txNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=0ZZ+tPgHVSYSmK305rK7KZRTZCmOpPPrDTUrn0qkjcY=; b=c7QGc43+EzBupGF6RomGH+FJuMMUaerhzWJzR3Kb7GKVy9sfBEqvKSUdYZx1bLWZGX XEgiZRPlib+1ssxU+Spjl9QuxZmovry75MJIYAk2fn7IHrBCqgHjVFcVVfea7Ymnls8q TWFezjLY/6zUZT/5C+MpMuhi30YYvwJ7Xc+ZcOH/q3p2Hlw4qASiQ0kP49aq6glvDF90 Dy72t3NGWSzbrh9pEKyBJ2XLvpklnxvF8Y3nqMYuwFD8lNrbaEXjbZz15czwKqBHn3UA tc+sqmDE+0wzBnuXRYSPxiLeNzkORiWs53exIkoM57RI+42W2xa0Q/Z9suG0eJHStKZl ZPSA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s14-20020a0ce30e000000b0056eb1a4165esi11719223qvl.401.2023.03.08.05.34.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:34:13 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtuQ-0004oE-CV; Wed, 08 Mar 2023 08:32:50 -0500 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 1pZtrD-0001qi-OC for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:35 -0500 Received: from mout.kundenserver.de ([217.72.192.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr3-00067b-5v for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:21 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MJn4B-1ppdK23Qb3-00KCjf; Wed, 08 Mar 2023 14:29:12 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 19/28] linux-user/sparc: Handle software breakpoint trap Date: Wed, 8 Mar 2023 14:28:48 +0100 Message-Id: <20230308132857.161793-20-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:fjBjZoyqHCNl+BtvDE4YQ1hdwGAVI/hga55gLu4BFzIK1YmjYbu pxWR04QZ3RRbyXWpPtCZC4wzUK7HMfgRTWrhpB/jPhP7jw96OgQAztkMEDCZy8UTkOgdnyQ BFwp632Xm5UrRL9tldhJ1DevggeV8nc7gLdNBSJvkUMQwpwrZ2Gtkm6aNWvAXGaYuhW5oGv h+wk7yXxR5YEWgiuWWqIQ== UI-OutboundReport: notjunk:1;M01:P0:WQIRc56swgY=;hy6jrCoeqyfBxFVSav+JeJ0OnR5 3nywoACUmsrnRink8vj5W6+QT6nrB/CmsiArqk5FRVAERceNtG8OSefpxzx2Lw+l5HXA20+iL PhJ6IG8igfPr8qV9G/8mmQDN7I6dsN5OejLsKzdy4G0AXzW8bsI5Zu5g87JlkTYcuvfL1u0ts Eb+ilfYeOObxVuD+fAzpR+iZruxqpFtyqPyQqk1OVcDT9CNIJEgiYCxexzAGyIDyRfLh0nmJj bEtzKrDw552BD/9+UfAqsxCsp9eluQr8uBjCT4ODiRZ8sqhJ2di0aC0neFs0YNONd/miysxKJ 76gONd3e9iZYr/AgBYcSHwnnRuUOYpAbUknsa8hEWlhDa0UfhPeszzaBVTvg8He95U1hwz1w0 siPfDeWnTGer1DeZoqz+uQCwfElh5gqCCAdULAHd7LUxLhp9Hj/wDXxd7a7BIoCfdOAqIVaDk Bwq3LNccn6hfEcbR8W1ojVe4tL+25RAmqWSDZBLd8BXHV4fvDz8Om6L+r8p6vGSwbwAHEhZeu R0kyTPVylhfjO4gVgEQKR/6/QtNylyYNQZuL/SPOGVU5NfM76xtighxQ0jN2L21Leh7tgVMU5 bH43fJMkHG/1l2yxQ1Da0atJENQXfU+8HpgKjdM6q5C7PcmoiURfbCYgPUKOpxatAORbdj0Dr ChhcnSMzxpxLONifGXnGgN3o4xU1D1OYr+EJt8xldg== Received-SPF: none client-ip=217.72.192.73; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This is 'ta 1' for both v9 and pre-v9. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index edbc4f3bdcbf..c14eaea16370 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -206,6 +206,11 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; + case TT_TRAP + 0x01: /* breakpoint */ + case EXCP_DEBUG: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); + break; + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ @@ -237,9 +242,6 @@ void cpu_loop (CPUSPARCState *env) case TT_ILL_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; - case EXCP_DEBUG: - force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); - break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Wed Mar 8 13:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660448 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330597wrb; Wed, 8 Mar 2023 05:35:57 -0800 (PST) X-Google-Smtp-Source: AK7set8FTh0pkNBFjoMVrecHlHLjCTUZWg+fGUmFvmsvknkkiu93yWhvq4K8Y+AB2maodSMY9z06 X-Received: by 2002:ac8:7c55:0:b0:3bf:b707:e889 with SMTP id o21-20020ac87c55000000b003bfb707e889mr32361994qtv.34.1678282557628; Wed, 08 Mar 2023 05:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282557; cv=none; d=google.com; s=arc-20160816; b=p7Dun15rdUBF4HnIl51AWSMraW/bCl8gGDI3mRlVKIwSLXz0lHMUY7OtuDB3edKF1F uMkyRpHRce1VPjLuEmhWRM8FcJxySxkBnlj7/kYmpLS2mXINA8h0lfMlqogBylBNW+D6 0taqASc71ATVvSycvlyZzumFYlY/XXhzDFZMi2VdczwDdtHusQsHmEHfXEcAyUFKFU5f c+YnDmRU09IBAlcPWuu80rQ22v69hoXYHhS54DhfA+qeDOHlaswvg0X0ntiDiD+aDCND AW3Y44MhYJHtOgPAjxTbjC879hyeeVgXkR13qyV76Y2OGpwoA4zj04Ylo9nskjw7by5E 0H9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=RvAczabgql2JYnv/PSf2D9vbDtURny57Sjiie80Xgqs=; b=hgugTKX6lkc8qNJY/5Di9u1lTcEl6PMw6+eFOV4aMjXvzZXX7EoPND1DjYKbTpk1w8 cfnDUAoZnr/JGP0lSTzAl4CVz3bOS/1Y/XTE893L9ilmnnaIFu+9x4y3wx7AELvW8YmP 5+6uyvk5Mh/oJJNXhhy9movKxbJwLO86u+ZQoeXQ4yFG9SFUcNPB4/lRSIx8M47QEQyy jqiCMJ4DiTybovZWXkHjZaB2ziIAAZIwR6ZLePLXz0GGpl3f5aJxceroyC+l6dj6SZTO wgJ/uW+7pU7V/pWXwTCFx9TByF9jOnQFphhmtBm65Z8aSJ5DzWwaqBgebgn+Leah7jaF 21Fg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p191-20020a3742c8000000b007427117bca8si11433577qka.440.2023.03.08.05.35.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:35: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtrc-00020l-H7; Wed, 08 Mar 2023 08:29:52 -0500 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 1pZtr5-0001kj-6q for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:19 -0500 Received: from mout.kundenserver.de ([217.72.192.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr2-00067e-Oz for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:18 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M6VNX-1pcNlJ17X7-006v4Z; Wed, 08 Mar 2023 14:29:12 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 20/28] linux-user/sparc: Handle division by zero traps Date: Wed, 8 Mar 2023 14:28:49 +0100 Message-Id: <20230308132857.161793-21-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:jx1dbuJkZcVQm+wcO1oYS1zmFQF0plfgeovlw/wxXRh+LqtIiRK 92mEEnGmv7EiJ6e4DFVebex56auYdZHh37yg4iomlx7ETkq1FeKeI2pf31mmMiZT5B16UsE X4akwDl4rU2BwQLThUJ3/rO5OS77lRbv+NOOpOboFrJC9+X8X4jSv9O/67GlO1BwGxHpSTR 45Q/Vqo3qHgS4k/RQ407g== UI-OutboundReport: notjunk:1;M01:P0:UOBA8DhajhQ=;nTlcw1TbnJvITwKeuoHlkmM1ZIk FYsL8QvJi3d29MukFcwKiNCfHh/P3hKnITbu3Md7b1QVJZ0H/iNQWMM/5Q/X8kGksi1bjVQjd Woc9XLgXvG8oVbVz8ChKMppDpsQMVJVRcMsLjKLIPpwJb2G7EXbz8b8spay7npN2MKkNbjX9G 4xSi3mZWiiGDHWKgaHdavAVTXZeEYQIoXYE32j6r6InEn2BSGWW0Hnz2sEzL/iJZidUP7kO1V Ld50oTnjWQ9v3dg+PCgr0lHDA708y8myBJubyEZ9F3MymIfmCxd9S7d+IGUQB76hnpVjUZRtp iirzFYFMVen7OFs7Qkg19eNVMkW/LyPwYCYlPziz4+yiSg0qy/+y01s6AXc7fY2hdT6WL+K2B cV/kfkLk3Aqbram2S4dvK220jvoHCBbs0panfiJ0IhAbs0OtcIW721QgAeFp3r5zJTx5eCQRa L2xCf0tnCYJlsunQZpCsawpp8nw+58y9HL3E1UT2DjsvQLqbiPj26Xubyx6+e0sE8JqMfzYV/ KvaKthX0QhhfzqTJtcDaBZepKqbG7ffLFvrOvel/jCIeP/tydAj45DcF3xycAgInyZKwmW1qh nZ20vaq1BptPg1bPrRk76zru/7oYAF09K2ELiT8oe0ptC0np+ZABBQOcn6YU8+tD0r1EsgReF 6Rk1Rv8/UEnnNHBbjexkyKb6bCiNb9WovjVQmYJiXw== Received-SPF: none client-ip=217.72.192.73; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson In addition to the hw trap vector, there is a software trap assigned for older sparc without hw division instructions. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-9-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index c14eaea16370..e04c84286769 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -211,6 +211,11 @@ void cpu_loop (CPUSPARCState *env) force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; + case TT_TRAP + 0x02: /* div0 */ + case TT_DIV_ZERO: + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, env->pc); + break; + case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); /* next instruction */ From patchwork Wed Mar 8 13:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660439 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329162wrb; Wed, 8 Mar 2023 05:33:07 -0800 (PST) X-Google-Smtp-Source: AK7set/LClLGxpkimMKfSQEPHgEHkMJb8UGAutb+oGVUema8Rzt+ezg8/8vkjrD7yKAWV99VPPrJ X-Received: by 2002:ac8:5a46:0:b0:3bf:d9f3:debe with SMTP id o6-20020ac85a46000000b003bfd9f3debemr4757278qta.59.1678282387725; Wed, 08 Mar 2023 05:33:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282387; cv=none; d=google.com; s=arc-20160816; b=cuUtNym7hVDNWwzPYHTRdG6CzYRvn1L/yihShQh+fwd7SznN4mfTdApdTCUhFcHUl0 Be0oN819qIzfFPyvJPUmKY8DrRjksY40tOKd8PqStM2Qn3w8zlz56Z8Ib3WWFkn2HCRs 26TgioJbFg3bE+IY2/hmUOAKhLAmvZoofhfZCdxIYFQoNFpnxOmXo3py8pKInQK8MNhq mrj8ED3PXUNk2aVNnCXYdROEG3PnDYBpprWgBKHE+GbVaIzq7hVBSeNhd72fyKkLRtYY C6gKhhGU7pB92Ubj2ujlgRbw2xdsvvFl/OP6cmtx1ibzABRm216Ke+5nQEx3zcXc3F+R eBKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=UnGCq8YCsCj9GMBSfgLvkVJwtYKx+DeQUq5zh06tZGw=; b=AlCAToZS/YpQ6m84+BTfPZm1X9ZDfDhsIn25G2ih/5C73zo98scgzaOi487OBW8wzb YscE/Ti1fAxi/2sUIHFA7A8qGAxQWG4YFGRpyTv8p7pPyL9ElgGMbq3YpjqwzbOtnCqb 74+pkRpssf9BnxLW3euWW1GZLnNtwnnXExwd6pgLY3TQmw5HZRGbZ6buByzHt2pxOxKQ pdpiEXcja3Yp13QjWGcpEBsFnjiIV0KAgYo/+bMmYSATT4xQ/2gDr5v1mZzJw8AWIBBj BXkx39e7Sh01yo0uFRipbhF3S3TsW/grLf8VXx3FhiH5QfWCnLDC5czuTkYv1Ng972M7 ioqQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o3-20020a374103000000b00716641078e4si11154211qka.508.2023.03.08.05.33.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:33: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZttO-0004Ii-Ij; Wed, 08 Mar 2023 08:31:43 -0500 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 1pZtr5-0001ks-Dx for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:21 -0500 Received: from mout.kundenserver.de ([212.227.17.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr2-000683-OH for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:19 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MzyAy-1qWgyk2vbC-00x5iS; Wed, 08 Mar 2023 14:29:12 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 21/28] linux-user/sparc: Handle getcc, setcc, getpsr traps Date: Wed, 8 Mar 2023 14:28:50 +0100 Message-Id: <20230308132857.161793-22-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:eHalJmY8rD8wOf1IC4sz+QHbX4m89J/lQVnkR+6/eBXHlq3zCKR sub+U5ODxaJBaVRAaOeYHKFzqdYqtjNyCAa/BWcxr2Gg7c3/URN4ewkKJh7cbtEhqrBNnrd vd0Kij7922yYycxxOisj/vH+RtNLb+eRQnmkt6qhOfEqV3hJwGzHV6Vfx4YAWxB3AiGuXN/ qjbEM4lczd1d26+PYOOGQ== UI-OutboundReport: notjunk:1;M01:P0:nwc34GiXmyw=;HBT6wV9vyfEdwANIOnFm7oCYbKz lirTj/z7xtqo+2gPWmnGziF2eMppa5bkKGp1hy4HBdhCGQDjsnOtc+LGCpE40T7AOJHAIApRp 9dzHhNtqsp7TNzEmHwXHZrcPz3UQ4EkAA5Wtl73eKPGXBD7mSbAhM5+d0DUd762VsRKOlh1HG c81+8w6+AxSWsX8sGr2LAenMSKX6Vk9ogwzv42a8CUqUtmggE1kbh38PErw8Jtiiy8Vk5g0xt 8qtX+6ad38JR3YdFF1lLbZAVOCzhrAVAZaWlOfBYVigZBP47+Pl4idvKQn2diUWxEpxO3TyTz WoDRZrCcRcSF2PGC49KDiuSAKgQTsAT0h6htcMNjodRqLbs2xy51KMt0sd+mSHCY59krqupR+ pFkf8k8WtbARW4A3oJQVsOoYzHzKVH9i5EK2Fj+dI8pjARBpX/OMhF32u2DKsqKT/0xsK2eoe iABAxLHcy+lkcpSfhNYlso2OVYsW0GFJe8pPUnA/nIIReMcGAj3/oAEAJ/iz5FCRvUjf2yYcx EiXxuPTnEDtf4a4KtwKEtrM+zClf6BKIVm4Qca38tgO3jtvN5BYWh0pZkzf5tYjfZRGwa8KKG 9m00X99fJ49pl6CZgchBxYmgFgiZl9tsCVFNwuIM4VOGZESToJZKOrsH3e7DsufFA2MfSFPW/ ANobOTGv+n0/pv6Zzv7Lg22XIvMtOOJtiH2U6FXQAw== Received-SPF: none client-ip=212.227.17.24; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson These are really only meaningful for sparc32, but they're still present for backward compatibility for sparc64. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-10-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 62 +++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index e04c84286769..a3edb353f6fd 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,6 +149,51 @@ static void flush_windows(CPUSPARCState *env) #endif } +static void next_instruction(CPUSPARCState *env) +{ + env->pc = env->npc; + env->npc = env->npc + 4; +} + +static uint32_t do_getcc(CPUSPARCState *env) +{ +#ifdef TARGET_SPARC64 + return cpu_get_ccr(env) & 0xf; +#else + return extract32(cpu_get_psr(env), 20, 4); +#endif +} + +static void do_setcc(CPUSPARCState *env, uint32_t icc) +{ +#ifdef TARGET_SPARC64 + cpu_put_ccr(env, (cpu_get_ccr(env) & 0xf0) | (icc & 0xf)); +#else + cpu_put_psr(env, deposit32(cpu_get_psr(env), 20, 4, icc)); +#endif +} + +static uint32_t do_getpsr(CPUSPARCState *env) +{ +#ifdef TARGET_SPARC64 + const uint64_t TSTATE_CWP = 0x1f; + const uint64_t TSTATE_ICC = 0xfull << 32; + const uint64_t TSTATE_XCC = 0xfull << 36; + const uint32_t PSR_S = 0x00000080u; + const uint32_t PSR_V8PLUS = 0xff000000u; + uint64_t tstate = sparc64_tstate(env); + + /* See , tstate_to_psr. */ + return ((tstate & TSTATE_CWP) | + PSR_S | + ((tstate & TSTATE_ICC) >> 12) | + ((tstate & TSTATE_XCC) >> 20) | + PSR_V8PLUS); +#else + return (cpu_get_psr(env) & (PSR_ICC | PSR_CWP)) | PSR_S; +#endif +} + /* Avoid ifdefs below for the abi32 and abi64 paths. */ #ifdef TARGET_ABI32 #define TARGET_TT_SYSCALL (TT_TRAP + 0x10) /* t_linux */ @@ -218,9 +263,20 @@ void cpu_loop (CPUSPARCState *env) case TT_TRAP + 0x03: /* flush windows */ flush_windows(env); - /* next instruction */ - env->pc = env->npc; - env->npc = env->npc + 4; + next_instruction(env); + break; + + case TT_TRAP + 0x20: /* getcc */ + env->gregs[1] = do_getcc(env); + next_instruction(env); + break; + case TT_TRAP + 0x21: /* setcc */ + do_setcc(env, env->gregs[1]); + next_instruction(env); + break; + case TT_TRAP + 0x22: /* getpsr */ + env->gregs[1] = do_getpsr(env); + next_instruction(env); break; #ifdef TARGET_SPARC64 From patchwork Wed Mar 8 13:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660437 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329095wrb; Wed, 8 Mar 2023 05:32:59 -0800 (PST) X-Google-Smtp-Source: AK7set89i9qD7vhPwTOmgaMinBvE2nCS+wK+bfoydarbaj3nOYIE351yZ/OHVsK5CkDDvJgAmkff X-Received: by 2002:a81:8406:0:b0:535:8b4b:b40e with SMTP id u6-20020a818406000000b005358b4bb40emr18295916ywf.22.1678282378978; Wed, 08 Mar 2023 05:32:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282378; cv=none; d=google.com; s=arc-20160816; b=O0qIYhBkPJRBmSoLdVfB4TGHAMddcTmdTmw4RqHp+f63VuJEWoETRYCU/BHnzGKY1X X2Bzap7QMD1SwBlBaOJf0fVkAFXAqSlYaSO4w6YT3weCzC5A2DYDpWcD9q4kExSVJ5ER pcziEGIu64p02t5FVe0x01eFYNwzUu2PgfdXemtGfJf0KpRp4d11Ped7TXmECOWXNyku yNxqPtMbinoWpXvrFHByovIVRFtN26QclprJaHw8hXCGDdztlXmGunkb/lsZG1PK4glQ VDZUo8u2Z4glvRHFzJcCvzkrtgj9lltPO3Ly61nnQOWz9nCb8cYIrfRct2GCezXzneNB 1TFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6/4suWoKJkkzOTjlrRZ75Xs825QjcHR4Gp4asLoum1M=; b=xyLm4MvODVmUKG4UjuxxWXgKD5SzumBBPdVeBcIojDGtRy0KuScQxVJ8zTkZozY8P9 /GPk6dW7FXaAvx1p4wAQcHgsByx25ljYy+TR2GQcb+kcAeuBU3IUSNr97at85pBSCQY9 ihI0D2JRrFXi4kl6DmDWNwmSA5MjW9q4d8OoCqWwsuAUyCOhTbspPvn7z0hKz4SeNtAZ OSfcZr5ED01t3P8PIEZldzkAkB6NaxaAhF7K61RroSX0C3WUGFR9cniYIRsFf+Ia4/22 tjjp3dRDPooeRz5CIoUUu0VVjwceut6A18xJUaU4H/v3lSCjNERGKy6115bTyFU2hjV5 jpfQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u19-20020a05620a121300b007423ca61537si11533845qkj.162.2023.03.08.05.32.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:32:58 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZttZ-0004O3-D7; Wed, 08 Mar 2023 08:31:53 -0500 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 1pZtrD-0001qf-MU for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:35 -0500 Received: from mout.kundenserver.de ([217.72.192.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr3-00068b-3Z for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:21 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MhCq4-1qDvdj0aX4-00eJsa; Wed, 08 Mar 2023 14:29:13 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 22/28] linux-user/sparc: Handle priviledged opcode trap Date: Wed, 8 Mar 2023 14:28:51 +0100 Message-Id: <20230308132857.161793-23-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:HRboGvqcF/pPfHWKzQAuCVU74wxe8LF0NMlPsEzCTP4q6CbS+Kg n19UtNTOfUdH69t44Fvarv2PR056e5829nVhyFZiVJXSlMkzd7dkEQbq+IXtBBxnHVIFccG N744Ke6wo3PYuBT6C4MpQcbJK5Ztr915dd9h+m6H54+HwBEqnNrDnfYb7Fj/iwcCXnlmtBx hm0l/s8zUkkNpKnr9dzIQ== UI-OutboundReport: notjunk:1;M01:P0:ylWKgJsOWKw=;aZh68si6M7wBPTfjZULHKEyNtNr soToCcdmEC/sNUQZiuIC6r+VrwJK+OWTKdGg+/JDG5XzuDEXMlkItSRzQ6R3s8DVTPcaGgEAN jrNAkquz99ZFV0LcgMehSrTyXqzNCGBaLXb4lQQ6lvnZtj9+IRslvehl7Y4d+/d9SIvPxLJqg 8If9yxzTumSTRZR0NszsCw8DKss66zNrbcLS5zJiNY/WASdhmFnOUNTL4wyuNjLIE5e+fas1j JOhXIwR0LjuefERV0ueTaD+LTIrETyvmKeqZbB9zqInce8E1dAsl9ibTS41AfjWi9YySbNy5G Cp9CYx+BXVA6CAgmzR0i96nkmElRnb3w8apYWEeJJoVNMRkuIhRi5DhnqcY2fHVnsGJ9/3m5A VODjTQNWjOOrVBR4Zt2hhfMcQiDGvSW1ooUy7/Et6MozD30NX7JmUujkKde5Wfp3Zqahw1ysu ZzVQKIyPcbaoqtEZmbBS5gqtH946L9U2TJwx/wAoEBnwP6ATutkZHVb0w/E3a8z6+5HpNow72 18SJ+GkqCRl05XZmjDaKEkMDci5VEe9SKGmJvqOLEjG+CjNMrUQkCq+cHJO5QAc02qanhFBoK Tdt+FAFOp6X3/NQTWHxooYHGo9PafLKWK97RnaB9C06o6AcnSl3G5wiILkGbXI6z9Cd/y/W6t bc/rNM/WxTPSG58yqHcDyICFGen7X1M9GrzOGwWBlg== Received-SPF: none client-ip=217.72.192.73; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson For the most part priviledged opcodes are ifdefed out of the user-only sparc translator, which will then incorrectly produce illegal opcode traps. But there are some code paths that properly raise TT_PRIV_INSN, so we must handle it. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-11-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index a3edb353f6fd..61b6e81459be 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -303,6 +303,9 @@ void cpu_loop (CPUSPARCState *env) case TT_ILL_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; + case TT_PRIV_INSN: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Wed Mar 8 13:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660446 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330431wrb; Wed, 8 Mar 2023 05:35:33 -0800 (PST) X-Google-Smtp-Source: AK7set/YDh4JKxu89a19HM3DQorTqd4JyoFW2yj3L9af/Xbv7barZtIGjE6VRfn+vY73GykU9YFb X-Received: by 2002:ac8:5b08:0:b0:3bf:d490:f218 with SMTP id m8-20020ac85b08000000b003bfd490f218mr32062640qtw.43.1678282533697; Wed, 08 Mar 2023 05:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282533; cv=none; d=google.com; s=arc-20160816; b=kDGrIA32gTiZGBe2SpwX+kwZFdG8vNBLmninCMZbtRuQWiz+MZP/tmHyEPQcBSqd87 i/+VgEcMzBaBo3S+82krp2T+7wenFEdHu9i37S0IchEX9qbsKuKCjObeKIwvSvnPa/vG tJvQY1YaqYHEu8E+f2KIRG1U0/YnABhpXkIRfkuADFaJml9burOSIfHj8RL0IbdT+7gj 44zl5sfhrX30Rh+Z7LBzhK6mz/+MbiWIF1qxKfrMr4eLJF0vyvvYcXhVQqoXdaMnRSj6 nvTwAOusoKJr6q3qF6LEC/OUotjoBhHqd6QXIpYsK0uIa9/5PMS67nIYwHh+MCMIpuZ0 y03A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ExEGnszXMALi5wmr+uegQ42aMjQjUAGHlnErCtx5RjQ=; b=RW8Ar0YrNrssI+fXS7vXO5TB+9PoN+TyW3iATYNI570Uqmi9TVGkUD4fWTKXBDF8PP NjG0TYKrIh+HZkDeakxcyvb2BTuSltMuy2N6dy0XLva7KewPPZza9Yw3e5KUQwRLXpF2 Ax/PimSN7DZbu2+T76PxIyefXktbULuWFw/8xDd6X2SZBjYIk4hNgFXHpxgvumv8tq9V pK01tJWIXnDYmLT1EkSSl4EEzVzHouTEh4QHeqmF4m9WgvdbmLeneehiI4r59p30uxmf VcSvLEBUBhD6bxeC0NvmTY1Z8YbRmOAJwp8YKVEbqgB3ZD+bkOefxF2JMtNcJYbLvcBJ 8XVA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p15-20020a05622a00cf00b003b676a1b5edsi12268927qtw.421.2023.03.08.05.35.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:35:33 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtsg-00040i-5L; Wed, 08 Mar 2023 08:30:59 -0500 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 1pZtr6-0001lD-Mj for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:22 -0500 Received: from mout.kundenserver.de ([212.227.17.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr2-00068h-NE for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:20 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MKKlN-1prHTq2Wad-00LrA1; Wed, 08 Mar 2023 14:29:13 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 23/28] linux-user/sparc: Handle privilidged action trap Date: Wed, 8 Mar 2023 14:28:52 +0100 Message-Id: <20230308132857.161793-24-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:6RAAO4vQwXWGHOqmXZYgz20yoyV/pgSxbMb6vpaprBB/PEqb8cj 4BSVOdBA1uY9h7Ks+/Sij1xF5Lx2G/yT5Cg9NnbeDS3KUImoj9Ioj1pLNDp3vYEIo8FbwZQ GsH8fl4DOijGV7+PzfYe/U1gMVCZ7UTXSvCp9ZDNx3palNwjCuvGdGCeBMnxGDKaA5BzApm SZiPMmyaGcIUHJEOsESFw== UI-OutboundReport: notjunk:1;M01:P0:RWngCclXgUo=;HfFZrVHLYG7zei+NmJOWCSsWni2 jWyl95S/k89zFlIe/kPm154ZQWN/y34VnssnK7rtpmk4NyiyyViFGYNQsbEy3o14mY8P5GafP 5+cC/ETlJhR2r/9Kf4kXJJBHHEDSWWtHcs44V7kWTbHdmnL0WqapTfQ0GoiMk8I6rRMxfhRMW JIzzwqKxmc0RSxvWfI0T5qO+OCNxe54Xu9ybcFm5xAH9A6CkckyY0WPAVODHPYfmbsopAe30U tKVKxGSrx75F3xVDGEeTHE6LItoGof5Bs1NwS0ZpjcM3gwpUJbpcL7E932bz9lDvbVXlHI3E3 8lubIw725b5Czb6jT1cuh/Rtkoy6LUzaSUKWpVNj8mqNwShwzOyAnpbepvyWU59yl2OhsLPyu QqIw6E+ASBovOl3wPHJS4EV8oAk4Gshyjs46WcJypQ6A6Ecf7T6cMfU+C8tfDuFgnmSl24DPk uJUT+3ijr0ZIb/V+vKtxB3vsGOP7rMBiV3vldFrg2GLEtIqQXl3lfM0EdITmpZbEdQZP9qUnd dqxPfDnh+i4CtgqUAt7abdqstMsto+m9DajH5ooJFZKZHdQIci2HUpYhreuESCLkU7nMwoVkk FLx1pPpnhdwn8xLI2bQWERygJ4qHWnJx+DgOYu8nI5j/uCwevyXwW4A5aTfGr4+OQgpdgmqll HRs9LJm/u36SHDvQSMZbPmUsujCfoRt14u9ABTYmbg== 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_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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This is raised by using an %asi < 0x80 in user-mode. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-12-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 61b6e81459be..43f19fbd9141 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -306,6 +306,12 @@ void cpu_loop (CPUSPARCState *env) case TT_PRIV_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; +#ifdef TARGET_SPARC64 + case TT_PRIV_ACT: + /* Note do_privact defers to do_privop. */ + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; +#endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; From patchwork Wed Mar 8 13:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660438 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329112wrb; Wed, 8 Mar 2023 05:33:02 -0800 (PST) X-Google-Smtp-Source: AK7set+HlEiL2KqKyCUGCm/Fs6OyEmT9Zh/WNGYlje52wYha2UIQhA2++iFa3LbYckOrgpoGAtdT X-Received: by 2002:a05:622a:1496:b0:3bf:afd1:8c98 with SMTP id t22-20020a05622a149600b003bfafd18c98mr31319273qtx.0.1678282382216; Wed, 08 Mar 2023 05:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282382; cv=none; d=google.com; s=arc-20160816; b=cqcxXHBfDsH4PzfVYVgaN7GJqz8P2/be4qlfpMSNe9FyDnXJuQPA5Q3ROID8KiATLg oc3Q/PNYkp5EDjt5uou/rw7g35Dm3Su4skJS0L0+Isyv4dEb8wGfBl/LilXrmgIuOxa6 rCltmCEhSujtSPJA1FQi2W1LB6iKs4WWtrRUl02lnGPzklficCnNVGZoHH01xyENfzTv Mscf9QK0sFd7+AnPd342V283Hxl9+MPmrmAGI0e0VaSmlU9sg84wQFA0LzczmHS6DbT3 vj8FHHUrBjwyd3yhYkA4+5JwhndQUAUyHSuYM2x0mUY8sew8OjPfWmUu0NdnbIEy1T05 uMXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=lp4Xly+wE48WfLDSLe8/cnw7KPG9840YV0L7fkl8ofI=; b=vkrOtwAs6Fshopw8BaEh/GVlbxa8IPOPl5fqJmqX/3N7Lcm44e0ePRouSg1YEtFT+t gk9LPVyIYoL+ZkzOXPP2oJQUhTIAF3N+Bw6UUEzy2vyChXj2Cak8/Fk8NOxq6rJ9dBPs +iUp0KXmZRAFfRoHn8uC5p5ZJnR3aazlouaNL0x9Ru11MCdaWcJGuPOORJV3rMRvktxt ox0dnbUtB1Ik1/Np9bZzu6JqmiWZamxa4Lfr67MEU4Oa540nyvN8vO0ZhByJgUZiD+oo aXQ/RUCnODCSREnaWVfamnetrHYunu0+DTsbz/uncEUteT+kL02GPnBRnuBO8J7UCJWo rdlA== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 9-20020ac85909000000b003bd134d475bsi12181177qty.368.2023.03.08.05.33.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:33: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZts2-0002K6-2p; Wed, 08 Mar 2023 08:30:20 -0500 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 1pZtr6-0001lE-Mw for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:23 -0500 Received: from mout.kundenserver.de ([212.227.17.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr3-00068u-1c for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:20 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MkYsS-1qHETk08li-00m0zo; Wed, 08 Mar 2023 14:29:14 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 24/28] linux-user/sparc: Handle coprocessor disabled trap Date: Wed, 8 Mar 2023 14:28:53 +0100 Message-Id: <20230308132857.161793-25-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:QjSEjlT2k3w0y9I6CZCQZy/QUbx6GQ5cyO+X8+G6+wmviEjBq+U 52XkN6F3W5eQze2vPB5f9N0CrrUHRveaiyhb1Sz5ZgEFf0BEerHiLkDAGiZFSWoWsDjd4yS ehaRvtXui0IMXj+/YbrIv+B4HmrHx3jBu/5tQSUbkYTswDvWIGTTFMPitHPKXys+xRE5yPN AepqqMztB/9OxewhxF4rA== UI-OutboundReport: notjunk:1;M01:P0:E5NAmAY5gBc=;V8Z3gfQXhWoSKY3pm3goizdME4c 4jCUdl2GnNIRpcD9yfvf4xyEsFgreezBGTpdpBXYPJfhASNcP2ll8/kOhTlYT64CDWa0W3pny wlir32dPbOj0N3LHDMKthD64ctrDVkAfjxLUmNTyCEDYzZzUjTaa7nu6CG3ve/nJhsucbF+E5 B6lhSYJtR9lL0gKbJkxDWOF4YWeV+AfU2CH2YJ+xytUYkn2U51y7/Igfngg3EKcwBBaIgO+vh oHlcaVGfjTngYY3VsuQ+TCyjpje+airZUK6w/4rTMd4ix5MuDTiIhcCj1BuWnMu2ItCUgdD+g If+JYMDrPMoKz3LMvoO5XtFQezRCbFFpRtQTRVldkAMZTV4hYpkTaVqKKqdjoMeVqkKTtGEp1 7x85Qce6mzmJztCHwR6wMHCtvbBncDYdVZ2ohOA4lKnR8baKdjkrxsZfMOo8J5gZBL5/HT8gJ IXCBpfrQlN/1oS9jZnpBOUM1JfNdzpQ+4mEh0xGkflodTdOjpzUXNDWQD92t/UPKH5Y1DIDJC DtorbEBkLPaXUWkJFR3lnFSGlBBMAHpM0beMlxiOExO6Ch8TsRr0YbN4Vlex3M7lQrACaaXac NRXjcweiJmpEwZ4iMVYrPhWMT01lYvIAqHE/YuaY+I6MsE4A3+Syg6tdfl8PaRqAUJnGsUVpc ljoJ9g51PvnJXziyBFsBX4a8UUx8No1K/COqwwMX6g== Received-SPF: none client-ip=212.227.17.13; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Since qemu does not implement a sparc coprocessor, all such instructions raise this trap. Because of that, we never raise the coprocessor exception trap, which would be vector 0x28. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 43f19fbd9141..bf7e10216fe1 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -311,6 +311,10 @@ void cpu_loop (CPUSPARCState *env) /* Note do_privact defers to do_privop. */ force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; +#else + case TT_NCP_INSN: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_COPROC, env->pc); + break; #endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Wed Mar 8 13:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660443 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp330009wrb; Wed, 8 Mar 2023 05:34:40 -0800 (PST) X-Google-Smtp-Source: AK7set9ru7OiHz6emQTCGAjRwKBmatnAX68+5V9CCIFK9zNLOc3G5r0Mvoc6g/gKvxEIVxcPP+eT X-Received: by 2002:a05:622a:18e:b0:3bf:9f6e:a383 with SMTP id s14-20020a05622a018e00b003bf9f6ea383mr30384686qtw.20.1678282480240; Wed, 08 Mar 2023 05:34:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282480; cv=none; d=google.com; s=arc-20160816; b=ykzGHRmQ5bJ4qh/3uHcwqtjhHbqB0DWKsIn9xK8G2xWdnuzeTOr6CWAd6AoBhzkE0f 5dAxdg7f5O39TjXRjnzd74neycnNFZj4hTvW8VIvitYIyvyORPVkx29uRp3dX76Gw+RF C6lr+XJKk/sz/bagKVoiHu0nBDDFDrDGbwVIESrevOAXDOdYwU7imOUaO10ntKuI0N/S okuZmmJoYANx9eLgdhAE3msCbzcCOzRMcLYLx79YCFMnqJfI1arnp1M6eEMGP5RNjQaJ SkHT5DVjrvPbQF16TvHx3Q1RcQ7g6gJJ4DloBJE8iFhxVV/Q30jgbzOo2DCiWmunpqhK 9hJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=wVpydR0hM+cpmp3CV/GpDG/r5hY4tIO5FEHJqwdnNkE=; b=LhceMOy2/vmaRN4UyouFGeZNBXoQ7JREGDdrNLaXqa5tS9EXknsTcooYJha5OyxXO8 WFM6SImIfHQI1NBvoaiO+jKuueiRZYR25nY8IiE/zmjdDS5SlzTYNBu5a3NLGwWlZbC3 XIY5dgBps4KmavyhDu+jJr7p8+r1uH2mDtzqUE565/gRNogps6tfz0GZfPNFVBKPP/Eu GG5SVs0tbUVy1bZzJnqelVXHWUFGSObbr+dc93/t0fVDCir4Y6gmMt2+h63EpBKpeMu7 jRmRZETgfymjaGUDf6CHI0OgtgU7uQErRPnGjVtyuFF6MeiXREflTGhANxGPv8c4Nn+e t7+g== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x12-20020a05622a000c00b003b9a4c0a48csi11526317qtw.232.2023.03.08.05.34.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:34:40 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtt1-0004D3-Eb; Wed, 08 Mar 2023 08:31:29 -0500 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 1pZtr5-0001kk-7A for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:19 -0500 Received: from mout.kundenserver.de ([212.227.17.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr2-000692-Mp for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:18 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MDy9C-1pjpTK25PI-009vM2; Wed, 08 Mar 2023 14:29:14 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 25/28] linux-user/sparc: Handle unimplemented flush trap Date: Wed, 8 Mar 2023 14:28:54 +0100 Message-Id: <20230308132857.161793-26-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:Otbx1g0NSzrg8O1qhGQStI53DAYQ75e+sOyvIYFRp0/iw1i0qwj +EHaf9NoPrH4OdVQ7/5YM541d0dXkInIH4nWCqTjTnzWZEmbzI9jnUHTgRfxA8zN0eKyG1o HWqUrJZPMIjinyrQS289b9YCaDdSWRqsmveZw8aQrHGjla6HJu6rWXx5eqY/H4oqeSMB/6t OcfO8lJIeYVDKHB+uyynQ== UI-OutboundReport: notjunk:1;M01:P0:k42t6i2XSOE=;AVZBb/+6UE5dfc2Ec9XMbOqwgOo bEARao7c/XmAbwyjtspiqrSoiTCYhRuCKcI2lNY/dbX8xBpJbnan67xTD3czl5epckuOr7+o4 IXExIhSNshqEcR8+NDxPJYYbO9X3QXLoGhmp8cAlVBs1ISJgZL/DpNbnkoZtjqdGjS5/j28dU yiNJc5NJZj/SBp2F5bM8dV+kyQLtogfCt3DAXD48Rf3MeyKYKVyUVddPO8WOee0umE9DRq+Zf BMGzunNmIxikldN6h6hKjJ0z8VuB/jCSvd2Dj9/jraMjnj+iOwfn9c+3Z6+43hdYyUVOV5VWr 1MA01utdN6+2pnq53xJzqIw5Qio9/RDodRUFDk/LHd6MrLfDzLWHcG15fd6nCeY3+Lv9hI1CD /Cm9N7tKN6O4rHv+KLhsDRPxTLwENpAFe2tyH0rQNbwnTD28Lkr+9GQw8pn+7ccr+fJPlBSFK AjMNXRsu+p46Bk0q5Dj/p5sQWNr8xDNbjH+me8PSQG5Qd9ozjG5rZPZ0Epihk4sdG8GUMl34i 78KH5074/C6oEm5kbpuqCz6hpvQKQ7ziJvezBqJT1NE3tSwAJiykEEU6YCLXTRAtlw82QiaIZ vs5cNciwhPmdHZQY2uadUrxg3k8KqcZffGX2mYhOo/bBesxcecJnQY6m0RGzW3ISJNhLrkg4k MbShtnJJzMtKciO8lK/nBWFw66U5Z6Qf8v3vj/qyQg== Received-SPF: none client-ip=212.227.17.24; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson For sparc64, TT_UNIMP_FLUSH == TT_ILL_INSN, so this is already handled. For sparc32, the kernel uses SKIP_TRAP. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-14-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index bf7e10216fe1..093358a39a4a 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -315,6 +315,9 @@ void cpu_loop (CPUSPARCState *env) case TT_NCP_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_COPROC, env->pc); break; + case TT_UNIMP_FLUSH: + next_instruction(env); + break; #endif case EXCP_ATOMIC: cpu_exec_step_atomic(cs); From patchwork Wed Mar 8 13:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660435 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329071wrb; Wed, 8 Mar 2023 05:32:56 -0800 (PST) X-Google-Smtp-Source: AK7set8ROwN/zAdvi4j1L5q6GaXhaVsdIkJkBTbO5zukMTqR9+LUuQPPy4N0+o0Xx7CkwDBl2R3r X-Received: by 2002:a05:622a:1a02:b0:3b8:5057:377b with SMTP id f2-20020a05622a1a0200b003b85057377bmr32246154qtb.65.1678282376502; Wed, 08 Mar 2023 05:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282376; cv=none; d=google.com; s=arc-20160816; b=ktQYlJFqoJ9djMwfMcHV4jgu1yXNvTEXbUuzTq7DtN+dXhgQOApBeJhTF9GrQxvjdN 8pLJyPX4NqWzf279TAPQl1zsXU40/d7jbeEavu7IHETLAhQdeDEqevOTZVsEY326Jj8v wp0U51BsMevQsWuFyHul8STUNqA+glD3r0wPGr+UzHXBvyoXQ/C3rQW6yJkvM78pBLA8 2EQf8sUhCLYvtujiQsTykWsoFX2cugVzhQAEtd6EuhUtwZ1D2fknuFobriJULEEDPlnu drnJUlZIZlAM2q1cNfs3/is0gLYzOIieUNh3ic7D4P8tdF8rGC7V8T8g2hHaKjxoJhpe Vywg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=dyUZcyqw58ajEPsQCsxwpYGwpENkrTYPLw3Q/OgGe+s=; b=csvOtYWDWXpkCN73Pjh7uvUkdmU2kwx+pUstQrU/IxEB+wKGtW9Okb3VvJBiWZH066 jz+YtcF/O3WUWNEjX5qkkKAxk7LfgIaNx3IsS3vhVg6pJ3fGJaYzuqtpDVGL3mihdw46 GRlZ+B9iNO3f7Uvb9g7t0aMfm9wsCuvffl9q1+lmddUf18rCM4gaCcpuvb/2kqNELLgS MU1YZQ9Z1FQKnXgZbOv2f5fvmOxrBJYboLLQHwaBRV95lyRcgc3n6ZGtdNGE8FhwDkwd Ez2xQs9nZhaYqW3SWVjF6pyiKNuMjCHCC5LqauL49y7nt/0IFgOPhZrDYUvNqjuMRMKT ZCYg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t8-20020a05622a180800b003bd00b830c6si12475776qtc.78.2023.03.08.05.32.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:32:56 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZttu-0004Xs-1E; Wed, 08 Mar 2023 08:32:15 -0500 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 1pZtrD-0001ql-Pv for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:35 -0500 Received: from mout.kundenserver.de ([212.227.17.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr3-00069G-66 for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:22 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MRnXY-1pykFs3thy-00TF9w; Wed, 08 Mar 2023 14:29:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 26/28] linux-user/sparc: Handle floating-point exceptions Date: Wed, 8 Mar 2023 14:28:55 +0100 Message-Id: <20230308132857.161793-27-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:cdCaLCEuPYp6LjNd40NuPkbrygQXunlN85LjOx8UtRkulL4eRbq FKWLDDz3DAZGZhlm5QRudExxwxKBjq9lGV+QyeGQMIZoXaPfM8bYtulCyANOuxr+MYNOfN6 a6Jg9ZIc34/6qyHbP2Ymme4INDwR3SUifVyLfpMsR5jjgsjUL0H4okJYu/RGWj0ivrLdCEK zY1Z9e66e/3o71x91LSkA== UI-OutboundReport: notjunk:1;M01:P0:gKuMY2h/z8M=;gBtJ6krGvV5XDr0qfqEtvX/GGTB l4OJ7ROjZ1zZ8+BBjqsi2MMQc+6ZMq32CHMA3lEEgi5T3WtIne9UEKq2MAeLYbxAF1/bYX/Ub GMN6sMtR+vVMyy+QaC/JY9K48p+0cr8ryZN1cJw4NrokWx4ehvwlS6nEjZapfxnFB0+fpT4zH 1YzJbhYrvxInzxdi/PQ3vo+7REfp4/ptEPTmJ7tDX62lP0hRP7X0rN1NtAcqZ9y25iDYifU0C /zMTmXgwdn2mpfziWleDCpgT7HK3P2xp+m2it23sRAwuD2u2nxQXhYQpI/ESVmP4pwFLjrbHD ZxcVJg4WAx3c7n3m9HoYUcsNd0wEwEBnq5fXWbg8kSPbSW7vei+Hm117OJgsN+AJp0CmO0cbe zVDgjh/twz9HPeSDYxoNBopFgBq7cbe9vMPeNe/fB4zhLqe2K6592vKM8V4dMaUF+Fv8+J+ef 6dlPgVXTYbWPg4UIzIzmLPeaeh3XyDdW1wc2CGMej3pJ8FyIw7O9SnfUoXFPmqa8MWDPDnEY+ 8YTjjt3UAn5l3vlhBO/FN2arNPh9XXzYbnZ+oKZXNlrzr/FWfMeZkSZB6scVzIFXd0PRQgt7m jX2rlzcrbW+AZ9up3ZqtZC5yA7xyCBXrYO5aaJCOmHGISXlHMbF198ZG7IKGe7eoJzU/Cdkvy c9ff09ZjHaz1NEyvGQvLyhqb/a3Dj+CGd2UxpxwDVw== Received-SPF: none client-ip=212.227.17.24; 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Raise SIGFPE for ieee exceptions. The other types, such as FSR_FTT_UNIMPFPOP, should not appear, because we enable normal emulation of missing insns at the start of sparc_cpu_realizefn(). Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-15-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 22 ++++++++++++++++++++++ target/sparc/cpu.h | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 093358a39a4a..5a8a71e976bc 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -297,6 +297,28 @@ void cpu_loop (CPUSPARCState *env) restore_window(env); break; + case TT_FP_EXCP: + { + int code = TARGET_FPE_FLTUNK; + target_ulong fsr = env->fsr; + + if ((fsr & FSR_FTT_MASK) == FSR_FTT_IEEE_EXCP) { + if (fsr & FSR_NVC) { + code = TARGET_FPE_FLTINV; + } else if (fsr & FSR_OFC) { + code = TARGET_FPE_FLTOVF; + } else if (fsr & FSR_UFC) { + code = TARGET_FPE_FLTUND; + } else if (fsr & FSR_DZC) { + code = TARGET_FPE_FLTDIV; + } else if (fsr & FSR_NXC) { + code = TARGET_FPE_FLTRES; + } + } + force_sig_fault(TARGET_SIGFPE, code, env->pc); + } + break; + case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index ed0069d0b196..fb98843dad53 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -197,8 +197,7 @@ enum { #define FSR_FTT2 (1ULL << 16) #define FSR_FTT1 (1ULL << 15) #define FSR_FTT0 (1ULL << 14) -//gcc warns about constant overflow for ~FSR_FTT_MASK -//#define FSR_FTT_MASK (FSR_FTT2 | FSR_FTT1 | FSR_FTT0) +#define FSR_FTT_MASK (FSR_FTT2 | FSR_FTT1 | FSR_FTT0) #ifdef TARGET_SPARC64 #define FSR_FTT_NMASK 0xfffffffffffe3fffULL #define FSR_FTT_CEXC_NMASK 0xfffffffffffe3fe0ULL From patchwork Wed Mar 8 13:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 660440 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp329180wrb; Wed, 8 Mar 2023 05:33:09 -0800 (PST) X-Google-Smtp-Source: AK7set+lerAZff7RU/ptFVjtKzHEcsLV9t8OsYBRgZtyr1dJF5FGT4Q4CedTFv33gSEKniCx6AHV X-Received: by 2002:a05:6214:29ea:b0:53b:38e:3782 with SMTP id jv10-20020a05621429ea00b0053b038e3782mr30921419qvb.18.1678282389485; Wed, 08 Mar 2023 05:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678282389; cv=none; d=google.com; s=arc-20160816; b=DtE4cw4QKsPj0iEo+xTNPturkL1s6P2sYyO5UVtXvvQOwPh/eN8ONic+lPd/AdV6vY 5yzsSCfldcU3JC0m1gOUlYJvFUPLUctz6jRTcuY3P/R4YHDOPSg3pe9dGx03TKBIG03l WZO0nhKVRMs1+cuY+aZb+b72zpQYuWw2Eea9J3lsyW+lbiYfGPzZfPtKaAltA84f/Aua G3GzOxW/Duexpt6UXwzzC76o1VlkMrMonhDu15cjDjG/cWfC9xg3tIBwGsNsFB0zfXsf 46CAravM9xLiZI4Ket8wLzciPC7iMNBPyGDaAi05jffvGZvcPpKYxqmYRs3BzB2LRSt+ j/Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=bV+/2eHesaRJKL7BvfTViuVs1GGlqaPgv+bBa1Xliic=; b=WwssoZg9NG4EAgoXHWPYuZkEfnIxSR1ouSEjus7OX/7qn5TGWEJdiRAhdt750halht WX7O0IbtBGBM5xyBHLTpPEpyHOUV7Wcs5O0xaHIORpBFnC1182y6eJcvBQgxjYqf2mO/ b8hUdODEqRsA6h3AzD0FIJ2nI58MY6jiWzPdHkTOCW2iP/EV80zVP5e0X+LZMHP9uA26 NSx4vKt5bqRS+GBvm+fI6EYVrbQzVB5qze8TrY3Ns0MkfmaWkuRnCOiPreJxRnkj/sAD ycMusqkm1ZYpG9LBPNqa9Eegq5r6d/S3t0br9qYpgcQZ3mSLPhehwuUKC6v588yyAZWk AgGg== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r9-20020a0c8d09000000b004e467237b6dsi12480839qvb.40.2023.03.08.05.33.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2023 05:33: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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZtsf-0003u5-Vx; Wed, 08 Mar 2023 08:30:58 -0500 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 1pZtrD-0001qg-Ng for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:35 -0500 Received: from mout.kundenserver.de ([212.227.17.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZtr3-00069P-Ai for qemu-devel@nongnu.org; Wed, 08 Mar 2023 08:29:22 -0500 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MeC1p-1qAshQ1a8F-00bJbt; Wed, 08 Mar 2023 14:29:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 27/28] linux-user/sparc: Handle tag overflow traps Date: Wed, 8 Mar 2023 14:28:56 +0100 Message-Id: <20230308132857.161793-28-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230308132857.161793-1-laurent@vivier.eu> References: <20230308132857.161793-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:fdFnxhXLd3aIYncrq/iT6mDur/NrRQ4i76oAaIfyo0F6fxW4iGv r0EdVWCS26sZED5eCQtyLkKh2PBLXNAEpbXTiZRzq1BGcslRM/zm1yv/z1rFafrbNbYpeW0 AM1A7zIR9OKl2p75E5ziFWFkqjgeKDvRRlQnfhItMUxoUs4PoubS0BGioM3BWBtApwCqQRm PywD+8X3tm2f62Y2og8zg== UI-OutboundReport: notjunk:1;M01:P0:+MdsCgA4oBY=;tV9CkY30a0Oe8eBBNfBlSABK+KJ ir9qxtS1jXyB6QUPmFK3lst065qnXoNmAdOhCEucF41GwsAeHYJvQJBJBXTC+g0uoxtSOfYQS YRrazUwm/tGyPZLGbqHb6DM2PWpey22ufP2EdsWHzmIGCBYmA5k57o6wV19UG//FScRbioFp9 1ZNHCAYhaSOEh0g6S3DEkUc1Br6RXEmnfqnTIwIkY/pXAcboHZGOE6nEg+jx9a2P0ruLG6Xg3 bLzxh88WdxbrAB98+Kdz/tta1dpqT+K92NGoaAxiWE4hQpiM8pMLZ2RhbJ+vN0hM/f674sOrT p/yQIM6kfQVGeK9MX1qsm3illbQZK0o0Etab4T88Toc2GB0mYnjwCnae6YzpQO7EbMHfacLgx 3RGA6+UUkxVfGecDFtKM8ElYd1BhdwkUKRv4Rn768CcYdIj1+PcxHIW4WTa8V/y4DtmH8EE2T 1del1klG4ACJ7XMrgSIe6CW2gaQBpRIilivaifXr3ynO2VqWNG+Qp9OGw+g562JkNg4bajY6U HC2VQCrwxi9hob/ALXiTF2WoMiHjNczMWKQC0nfCTh96qgPW1oNbjApT/7p9TbjpcMwzbLxuP qaRjnngTKMy2Ma4D+7HpkzQYRG9G3/dhQQ/OJCFx141MdMCo5gvlen0nwNaXLRkwmuJE04laf qUmhc7MyYe1wAh3aG5HeyDjiztalLJ89rPOQjw8gyA== 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_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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This trap is raised by taddcctv and tsubcctv insns. Signed-off-by: Richard Henderson Message-Id: <20230216054516.1267305-16-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/sparc/cpu_loop.c | 3 +++ linux-user/sparc/target_signal.h | 2 +- linux-user/syscall_defs.h | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 5a8a71e976bc..b36bb2574b94 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -328,6 +328,9 @@ void cpu_loop (CPUSPARCState *env) case TT_PRIV_INSN: force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); break; + case TT_TOVF: + force_sig_fault(TARGET_SIGEMT, TARGET_EMT_TAGOVF, env->pc); + break; #ifdef TARGET_SPARC64 case TT_PRIV_ACT: /* Note do_privact defers to do_privop. */ diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 87757f0c4e76..f223eb4af6a5 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -8,7 +8,7 @@ #define TARGET_SIGTRAP 5 #define TARGET_SIGABRT 6 #define TARGET_SIGIOT 6 -#define TARGET_SIGSTKFLT 7 /* actually EMT */ +#define TARGET_SIGEMT 7 #define TARGET_SIGFPE 8 #define TARGET_SIGKILL 9 #define TARGET_SIGBUS 10 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 77864de57fb6..614a1cbc8e3a 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -717,6 +717,11 @@ typedef struct target_siginfo { #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ +/* + * SIGEMT si_codes + */ +#define TARGET_EMT_TAGOVF 1 /* tag overflow */ + #include "target_resource.h" struct target_pollfd {