From patchwork Fri Mar 10 22:09:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661652 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14642lty; Fri, 10 Mar 2023 14:11:34 -0800 (PST) X-Google-Smtp-Source: AK7set8WK1PTDxo0resh71FCHelUoSdruaIVNspvvXyxxs8sGSz6xyY19AivItwNh8abbq1yDHd9 X-Received: by 2002:a05:6214:1bc7:b0:57f:5ab1:a42b with SMTP id m7-20020a0562141bc700b0057f5ab1a42bmr1061636qvc.32.1678486294105; Fri, 10 Mar 2023 14:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486294; cv=none; d=google.com; s=arc-20160816; b=vsJ22mchsafKBYG0f6CD5yHEq5XIX02R1ACnCmRJ6ghB6qOYkbJ9dw/pQbx/OIa6OV /Z+9VLMSaea1YSgmkkQL/zEnZuM2b8ZuaK38efsVcm1NgnGVSmRE4/7Ur5kV06+8Zzgw bSt5IiLYlceQJpbNmMgNfwbPqm4JM0cTpn/CM0agRri+rnZXeCRdquffO6pz1jx2Z6ki yDIQAuT5MJBRF8u3vC2vfWA7Zi8qpffyV1cflK69uBCNqND9x6evp1ZJoVJ+2Lf2ImaA Y8sc6N5VRnIwsYvZWKXGOThnWa/XcfK8iCWsyrkMwfGBipKLURIsq+dB5XDUIHShxLRZ iM8Q== 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=K3CRZhsRpBKs/PKEatJ/KaDPsKDUL9PrBxbXvqot0FcLVsLDyRsdPQtlJg4cofuzZt KzAH2ojIszvfJFLVWHRdRY1a1ZhyXtTG/YIgE1r9KdqQ6WuQxoYtvojxsyoBmoJWV/LB 6Hay3I6LsSh49FCFO1SxkxWpq0076sIANy/8UwoTuvddKYO7e/+/TIN3IdTs6Dgsa6K8 UR8L/xPhLI+iopHK6lYGBDhQwi44LbZ0jLe5Gje8WtxDkZ6ELmJwnsWmaNTQO6aJnelt HOaGFBLwP44ERiBnLZW1HtjoMH+aBaOPi85phDZYpH6mpzy55iaJrTOA2xep51zKtjor Ekng== 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 x3-20020a0ce243000000b0056ec5fa418asi555905qvl.232.2023.03.10.14.11.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:11:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; 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 1pakvn-0008Ey-72; Fri, 10 Mar 2023 17:09: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 1pakvj-0008CC-Gw for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:39 -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 1pakvh-00031W-MQ for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:39 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MSLlu-1pyyr11yZ6-00SeRP; Fri, 10 Mar 2023 23:09:35 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 14/28] linux-user/sparc: Tidy syscall trap Date: Fri, 10 Mar 2023 23:09:13 +0100 Message-Id: <20230310220927.326606-15-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:cV4az+v6TnksWP2sepxsrOEm3GVw2zULcW4XLllXVNMC8MZQQx8 2Z7SfrSJfvyULyNZTqDI/4z0eyHAFWbZa8C2+RlDRLnyenNexYsfyJceJsQhwrbExidWXIJ CRS4g7XVG7o6Bm+swKigGZV31/8ISh28cJWgGaQdR9wi9mWDk/Yb+qTgMoajTAgWD3OKnE/ maAOIieomHrAD/Hnt2CHw== UI-OutboundReport: notjunk:1;M01:P0:RxtEefxb2Pc=;mdZ5smiUfc+Tra9V+37J+JWQEZu Wntycb9iD/AbHfJKVy5KIjs2wRkpW2uOGHxvO5pW061K7fsBtNjWIpUlGVnnycuyRb1xS3Www NTicx6/kn4N6q4jzPE0LUmRKCIS8JZLNfNFpyq02WXYQbb7k4ay2u1GCkxtwTDzgR+34qAnaF Zhtm5b9mcXPJ25rlDZIPdFHjNMC1SvMnYFW4lXeYvcQ0eldK0Viy/2iqOvyYUMtLTSWMggnTr Ved3RFLW85oE48mrUoANPJwi3IM3Im9YT/Wod+LUBeN3CgSfwVT9CNRKf3eomqM58yZKu0zLl 2kZCR1ZTpF8bhrdZcLlWYLafUm07HRqtaeCMCAnFb5zywumEqHz3waaEf4W2c1dV4SQbkGU4w tbPu7wYlIFXf1/VMeyteykDtnExgQag7FG6t1hUxpnL4HNQHx5KBiZFa+vcnIaPgddsL9dtAU bEyoH3Q8sFamJI8wtGihmjtrmn/Br776kh4mKDV1Vb/wqPiFFzcjmHdG00M9trgIDv41cgXlI KDT7zJSm+HYXU/nNXGtUg0MgF2Gv7ZhLe8STNzaowMveO6sGwScrXdLrQsrk4W8p0GwVUDrT0 c6JZLrdBV5FNUyVIV/9Nzrp9yStq16BeQcCJrxP/pFf3gmGd8AiOfUz7HhIyAUSzB0pm4V0ib OvVGYeXFga2qHgoaZlxv+MvisM9Cp3e3+ILGN4a9YA== 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 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 Fri Mar 10 22:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661654 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14992lty; Fri, 10 Mar 2023 14:12:16 -0800 (PST) X-Google-Smtp-Source: AK7set/W6um6KNFkJiipngOXnW4Zbq1L0HdFEmGFRmblQfGqAmSGWIsrFUS0KjM4uBX8YsiyNKHe X-Received: by 2002:a05:6214:2505:b0:5a1:bd5d:408f with SMTP id gf5-20020a056214250500b005a1bd5d408fmr682551qvb.41.1678486336189; Fri, 10 Mar 2023 14:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486336; cv=none; d=google.com; s=arc-20160816; b=oSnKqiv/eHsu/ohMTU1aWgJeEL1++blc/+zJh48r3OweU8UPdj3KZj9P+YU1XkrlsQ 5OCKe2E/2FQ1/UcosGy/0T35iJibts5sQUlvC9aPPyE56YinkK7Sc3vZfU5cDKk+ZSrM Ih9R69JEE2sTZt7PCFND5j81oEh85+jDYmQjIONe6xGuumpvkVC1XebDdLp+AMPq9XWS DGzRoptSYjg9a/nVvikptGEzpy8113fOx0OtsHHZfC66jaQYJU1Oql0/LBPnWmfOprn4 yTjD9HyqvdsjCeAdk0OETzmZt03XAh8RJGN9ot3v9iEPnYB6peqGbedayVqXnEjaH19C SirQ== 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=VJAo86tcP1s5QHOaa7tzgbVGRlAw2rQ1ZTCLuhNwFhpwr4s9mK0QatirWL0RSkIZSs nLvgdWqkFzapriHmEG05boo+ZHZQsvQy4K6k0knHprSYDHC6ceB+tmT9KE7wmEWSXQ+x owe6UFhCsEwZzNdPOQol0u/EQ0zf1QKNlqepyTg3+BpoqKeXReF2SDWh3+yyIbhiHCYv tMnq02WXwM0DoOX7yTBWp6Sh5IW6iXyRdY/qjD039FFulOOsiQw/c9SHG1N1ebvZz0QG rXGhVoICoNXdvNHit0enCQcnuoHm8kyalWslLoUusrRqHoQbCgGuoq9ZExLDezTtYU5T J0WQ== 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 fi1-20020a0562141a4100b0056eb58eedb6si624309qvb.499.2023.03.10.14.12.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:12:16 -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 1pakvl-0008ED-Jr; Fri, 10 Mar 2023 17:09:41 -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 1pakvj-0008CS-Ph for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:39 -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 1pakvh-00031Z-P1 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:39 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mgf8s-1qD80h3ak0-00h6r1; Fri, 10 Mar 2023 23:09:36 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 15/28] linux-user/sparc: Tidy syscall error return Date: Fri, 10 Mar 2023 23:09:14 +0100 Message-Id: <20230310220927.326606-16-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:v2ycuPT5K9GEMqKTx4WI/iMX712RbjVyoHQstA4VfDsXM++Z/G5 WDFCW0n9DyN10rmyPOJ2uLPRZzTm0injlNiDC3lVoOc9S8UpNh40KnmfjsdA3Qd/0clfgxk LjEHjopgDo+5Ykeb4mqLFvDLlPeFguYg5HRxZY0J89AjBc4a6/0lq4cbDTbZ/Gqpjg8y1Yz +XVgTCJgyKuhEpFPxLc+g== UI-OutboundReport: notjunk:1;M01:P0:3JooTipO/gc=;xj8khNPqcJ6jUSMLEYETv34vxk2 N2JMK1jbUpFNwfOngGHvDWzLJx9+mX5d1S402m3jZuCqSlC2yCt+iyhLBSo0CdhVro/F9+hsD PQiO+6aNppxZckd+Tw+UGTLb07eZzgV9lVI5xLnGy9S2wD+toOgA9FT4FnOvrT8mw+sWTOJ/r AG1ragLUhO2+jMifx0yWiAuYzpbEwtgPhPvcyMMoUrOHkedY04u+VqUAHwGw4B+siI4VJ+RnB wcN98/ty8lFz8e3+H1Qcw0XsHtQ+IJdHrdrwqX67wbW5wxb9PxMYtzoCqmyvAhtzxnl2tqKn1 RbH2KUycteYfzTip3jCLISCT4SQXbQXSgvqD46hlVWWuVNfKIoqB30KDBZbbDK4Li01r8SMzm vNzWkfe+A4UQn6of1s4gGiNWGsNyMUyBY19tVNizLbBDrP7SrNr3etbZTUZLyzGki47nvaGm1 Ef9BM8ZxAVDF/4c4GkV1jZCT2RPLxKJ3RRVWebHqR/Jyba+mtUps23vUGBgVEOikI9u4YpPkH B5jNNv++0giH+yJM4JqUs7xZeTqe6QI3jts7sfG5xJNleCQSxLwYKAxTRrg/n1vr9MKbAsY+r vB3SMusfNd7uzNM9PQ8BGKYFVOPP4ryEHy9tCnwTpEJItkLd7xA6qC0H15UK/JdzIbUyM4VHu cqThf/h2IyQrL1vLxO4sqwpW2jeOi58+kdyv2JtPgg== 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 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 Fri Mar 10 22:09:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661659 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15411lty; Fri, 10 Mar 2023 14:13:03 -0800 (PST) X-Google-Smtp-Source: AK7set9JvhJ3fygxCFAHwxEaKvPlmDoPGOr/Am3xYk66PsdxH8Muhu3hsId6D6mPj49TJP3RM2BH X-Received: by 2002:ac8:7e83:0:b0:3b8:2e36:9d24 with SMTP id w3-20020ac87e83000000b003b82e369d24mr45378067qtj.50.1678486382956; Fri, 10 Mar 2023 14:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486382; cv=none; d=google.com; s=arc-20160816; b=eG9akX3am191POEMqIDbreGYhFNheYtB0MUmZztAxjS2tQvcCay11t+MqurLt4vVd5 X4hRki8HzP/Db6ok5fQX53NYZab1OqHaQ1apfjDggLcpzfgLKxX6gMtK4Y79IwDW3Si5 YxP76Ef4QTS4UHqt7puCFl9EIzPCJV+SbR3zY21DyVZe8rZGoL0fCtSbbm/EtDhDlPnG rYoJQ/0xidyiFzTTUsIyOIHp8rhIHIrkTfOHqC13EFx/tHQ0ROanScT989CNND0F8QcV 478rQL/s9Z70DUp4swEkAdmbGy9A0rQSKbZXS2reAQrZHT8BkbyLf0PcHenkUgfTit4w ifZQ== 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=VHiTdcHspxhUZAELYbMjtRt83OGydF+ElV3QCSvndkzVkYiIC1BzNQ2d4RPGyGfqOR r32D2RKM98jzhZMDoLR6F4p9pCqai0EBlDmB7DFot+/jLuicKG9F5D8zDQ2kPm3Or+PW gTk8iJ/mO97wt70Mxw62x2iiwj7rEh9+OOTaDrywARN3zI8+uq1fv1ZQSxf5Qh/UKepr QSGUH4QdEZyAuquZLyxXhMNk4pdxYs8QUaaHWaGozohADxysrCMUBBEoEyGwjZ29jd2m 3iTJ66q8JreUebXmmct5PgZf/vpNbAPJAhlXns6XOYYUOfTKwYvuqrbbsvKEOmcmx58m KBVw== 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 de28-20020a05620a371c00b00728ac20497esi730416qkb.623.2023.03.10.14.13.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:13: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 1pakvs-0008J2-Gm; Fri, 10 Mar 2023 17:09:48 -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 1pakvk-0008Cj-3C for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:40 -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 1pakvi-00031r-EC for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:39 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1PLB-1qXDKd1EBH-012oL2; Fri, 10 Mar 2023 23:09:36 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 16/28] linux-user/sparc: Use TT_TRAP for flush windows Date: Fri, 10 Mar 2023 23:09:15 +0100 Message-Id: <20230310220927.326606-17-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:3osgtKUSUE42GHakZ8Boh8BAVEX/rtvPKEe1eY0917jIuWA4uHj R65dZrqQR/7c7w66SR0utsCOPurnt2TQh4bUVDecxuQDAxR1wxXLDBGIgeqkXKNrReRtBPM qbMtL0g3TAx/ZrR8ovxNwXQM8ZOfoEkrOmabhbVkkgdQejUWZbITkO4IALqwkUIXTsUjBCx ZGkE+nGyRnc7ZO51msdCg== UI-OutboundReport: notjunk:1;M01:P0:3bvzu7Ljdl4=;DeIoEthcNAO7UbFpNjB7U730qEn H7MR6iNdmASDXuGVEaT4pHWlZ+gdZibCdtF6CVQ6vtpRfhyhfkMKMpwD8bP80MWtXGkEjZQl3 wNRHCjvm7Zt7QNp54g5SLoajlX3PEzrXhPMZt+I7Cb0vz8+PFPLxpC6rC98ihDq7y4vLTZ40J vRI8Yrc5/JsSci8Tmc9QR2Odf0ZVCHy5iWrWCWWbepE5SzA1GIwNur2+EeDEwfTDEctzEKbOM 5FyP0iZ/R0b9kaXRJIUHAeF1LilAE2t3ThhTBmeUZKYneWJh16Ptv4xzVx/VFwQPEX32nz10B /RDeviqdRBMmN+BNKcqKsv8zMjSrd3VcvirpKSD49DzePneiCcXRB5qtY+c99Qj0PnnHXBj6B QiQf505DWccPV5tTsvaOn1fG/mxJUEcMvr/TZZj55NdPpxUtwasbkFZtHDlLJl9xxBzFNkIuL kObx2vgWIpEEk9ZhlcP55yE/639dBQ2SlU/xtlwDEPnvOiz0BvXF8Ij6ljwiD3RLZ7laHDIzr jIBdS9H+OhFyavz7hZE14sV/sNNB4/FuuW1CHxsqq8NdMiON42RpWT/3of2zwxyF9OduXD3bM 5rxYo4uG9mLqaBeGC+Jn36lzDOWxeikf2f1eYZI2BRkBHNKLAKI6gPs2/RnjUtV2UWYUYtxyF bTzbf8V3dHMSJTPcEdxz/5F52WkaaVal+JvzXmjZqg== 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 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 Fri Mar 10 22:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661656 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15175lty; Fri, 10 Mar 2023 14:12:35 -0800 (PST) X-Google-Smtp-Source: AK7set+w9YyjsP01oSRE+zdRJ4qrmdSDxM37/D5lrenyoHg3OAg0ciRjq71wc3OweB8YpBT7YAzz X-Received: by 2002:a05:6214:20a8:b0:56e:fdff:29f9 with SMTP id 8-20020a05621420a800b0056efdff29f9mr988685qvd.18.1678486355492; Fri, 10 Mar 2023 14:12:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486355; cv=none; d=google.com; s=arc-20160816; b=e9+F6auB28bXNPQgKSJkH0LLP/eUMmmZv3zqQBGxwSQAQ/xwAt+TLpbd8hwNibjXOS mCP1LLuwdDemcmYdmAd2IJRcTP8eW62u41Oh8DorTmA2kWJKy4jZ4Q7gOtuTpnK+9vBq A4H9rP6JvW5I0aM6yIBm41nwUYDAX/yap8o25a60mqpvm63BxcGE87qAKoEv0cYPInHZ /ZrYt+PgLJWXdMXUHdmt2MPz5bbsOdzXQRZa0A4ZMXcEQA8MJ9N3+6uNej1v77Yv3q5m 7lzfW19xFwMAUZ+Msmjw1XNIm+kofMkH3VnFzFMZMs0kyvZCj2jTggpLbzvxY6JFopkc cxwg== 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=NhLlvFZxqvi8akE1MzYNOy2sREnDyqdygqt42isnipSC9wTD3SmmAraoTLorBPPCfm N9rc5NAGuKAEjx1QffoXMt7fMYJ1QnCpNOVJntZaRhXxPwA7xZa/dqnC3aQ6P3cp8RE6 ZrN86nqWGa7zDWww1SOrywVlKMwArFVZAj/MpYXDRbcN6qW8bJMFSgJxZhVfP6fKeqfk sC9ErE4rt7FZ/NhRGzoSIMQ6F+ty8qkVS/eRCMwkyeut6+E1nKfR8S/NhOKSRmM2SL9J I60XyaYx/hijqHVnqTrMmwcmwIvKj7mvokUCAjny4q6B79cH4mk4SYzqj35FMLSU3pZq ZtXA== 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 h2-20020a05620a244200b00738dd5f9352si829415qkn.6.2023.03.10.14.12.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:12:35 -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 1pakvm-0008Ef-KA; Fri, 10 Mar 2023 17:09:42 -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 1pakvk-0008DR-M5 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:40 -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 1pakvi-000323-Rw for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:40 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MadGG-1q73Tm3BIQ-00cAdN; Fri, 10 Mar 2023 23:09:36 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 17/28] linux-user/sparc: Tidy window spill/fill traps Date: Fri, 10 Mar 2023 23:09:16 +0100 Message-Id: <20230310220927.326606-18-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:QKXZmhRh7Ff57c68Uxrbc8j4mgAps2R99gyUwljWVZHe4DuKx/n Gav/ZM+dowHOq6tg/uO/vKWwgD6B113qNc3wHcJiAoZLZHnC0cjjhgy+t5xIPqd+S5LJwej EuPThXIu61LHrSpUL8xT/nW99LQGKGEqZGUKr5RwPugZ5wG0mlUAwHBLFIVERyDQdedWnuw V9jUelLhySZZ9MUADbzqA== UI-OutboundReport: notjunk:1;M01:P0:+w9c/4tFQXg=;++KJsyfqjG+gJNv1HaGAJ5UYO1Y eZBHOHdCdS/ma26lpKH80QAINYQO+Eqi9y1NaAjWIjO3BjyAL3DT4u6YXb9EUK+BrcuBB8kQv PbGvyQG+6FVFWkOgtIvIugiMuxa4ln887gzUxDsj2wruo1B+jVWr/l48LqyNAUTR01jZ+ASSK sF/jObxrJa448j+xL3ZYs+CpSFJPFn7pUDjiq0HPao66VK0qV/uJRb4zpqwrozG8uqLAhjlfL y1AiguqGm7B0luUasjJjnHBvGtdcNJdN4TEF7s/fQjOAj3VPE6xZVJ5BShTVC5+YXc/B0Ex0V /t2cbNAY4n9ykR6biLRnNBGayftrLobTJZ3kgClp4j3BvBrJKXkyWU3kk2ycgpxmaUz1yWhcL 8dtozJ+crhEcXqb1wkDIsWNNBnxb5ot271std4c3LqfvmHmydsADkAYhD8mSSYNwCAkuGlFIX BnjDvTWyrRv2YUK+8HowXmoSySUYYlXK1DFSZqJTk45gIHP1Rj83+BkRcQQSr1YuR59OnlLz/ pa9ZT59r01KY+1qm2oarqyt7gXVrauz3C3Bb0bTmNUwwe88BRd1ZraTnhxNqCYvp5HVguC4pQ 24b5anJxUyOoYqaFUx8XUahnBYcLhZ3sTC3dfEBoCvwOOdRMgQ6wwRhRDRJMi84VKafp9QT9h gGxaqm2nDBRw3DjZLB3da5eYkHVnbXkXhb+Ki/KnvQ== 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 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 Fri Mar 10 22:09:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661650 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14440lty; Fri, 10 Mar 2023 14:11:12 -0800 (PST) X-Google-Smtp-Source: AK7set9skMKVpllh+0A+9Loa8bFB+Silx/aWEGfqim3hxVAhTSzREMlgzHXTdzvo2GpeIgZgK42X X-Received: by 2002:ac8:5f07:0:b0:3bf:d5e4:308c with SMTP id x7-20020ac85f07000000b003bfd5e4308cmr44102571qta.46.1678486272364; Fri, 10 Mar 2023 14:11:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486272; cv=none; d=google.com; s=arc-20160816; b=Qxck25IA0ricHjCB0VqWrwHc1bNCMWluPXeXFqt3cHnnxXUTkZoy/dbos5vzmU6wq4 izlGjx9jhM7U7MlgO9dFw8ri1JYpbp82Xr43wwpfSxDF+Uym5awwbYoSunQSvbLGUEpx VtCSDvgef4quycIdGRiu/HrmfUxhgb4xvR/xtG58SPIh8F4Xpx3LNnSlLHAXXKHmZrK3 GWpKXiCqhbzoC/2zhxstLcVvHNS7orateSUli/gWrBY7WUEqUO2APMIoUaWmxB1HqnYS yxj8+G37b973ozQy2jajoX7WmC5VXssmbfAPK/9Lv3JdShj4kEnbaQMpE+CEjnjzNAxx j1bw== 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=ROG3fSFojVA+c7ycZGdHeZL928YRLwNTKEtFFk4YalrkGPLDtt6RaMKFEBb0JKQWuM RdM1eWwW1KoWbs1BvGvUu0Z7Um0WSLGx5RtTM6VFoEhGeqnX+FzrH8kwCM8EabNtYVva iqgs1dWN/Gx+RPMBOwveZ5jdnnL+CoEnVm5zJQEaQQITUcudfB4a1+ErnqqPHAf4PoKX ueCQ6IALb4S4dB6eZVNw0hP5Xhoc8VBAhfE9drFaZxgoa4BPmBIS9ERsCEJbtTGaxYon LZq1at5Mfj362xTphxKU0+e9IBJGoDq/d9qqFrqwnsnoPnTN4lX9bKXJ2HtvEUQN4uVW SdTQ== 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 n19-20020a05622a11d300b003ba1a35fbd8si748375qtk.756.2023.03.10.14.11.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:11:12 -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 1pakvn-0008FX-Vn; Fri, 10 Mar 2023 17:09: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 1pakvl-0008Dn-23 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:41 -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 1pakvj-00032G-4b for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:40 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MLhwM-1psQL30eEy-00Hcsd; Fri, 10 Mar 2023 23:09:37 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 18/28] linux-user/sparc: Fix sparc64_{get, set}_context traps Date: Fri, 10 Mar 2023 23:09:17 +0100 Message-Id: <20230310220927.326606-19-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:69K/jYCgXPORz8wGvUZOLXHUrD1vBufjW2pwVwb/vk2qscrHw01 Fvnj8dj2VCxOeaeNGSixKk6OagguznlN2SwM+ph243ukEd4O7oGseHVitBN7qdXsvZ0pAnp L8AiFqg7gNdPm4m1jLkoEeqKbkP8oPMvAa0sNqgZt92nD3RFlww6x9Xq4CWGAgZcE5MkwGt fgCUrcVDzdd1ocDfKhXJQ== UI-OutboundReport: notjunk:1;M01:P0:wsY8nqk0a7I=;+yzeElQtxfv66R9pRSxHxpXj/l2 HgtwlO/dimfAERn1FM59ocUvsv56tnfSuwqSdKw8ap/ZYxXMd21kN7dXWBhrIQR166CggpFxy ZDIt1Fe5+c479c7OmiSLZJzPHdEwu61CEjU36bi9rjC4cK6/NRfN+BDQ0AGYax7OfaxRgRO/S 3vJQ0KoQ1lf+kfjLzqyRVUHYgBVFWVYN4RPmILqIQmesbiA3sfUzbjtjdudbv6Bii/+0Gwo7j DjJW81B5UGfS8tdrdLvsU68wYgGqn3WPQY+X1n6jLdBL9MJ+I9exqfyAKD3Weyf+iKiodIUEM aspK0fx8GVrQtm2qFk78fMNm/SxNg+FuFUzv1pah132F0QXFKtJj82O0+h94Sj4pVmLeYGtYI hEEPeIgrxfTGrELW/arOQwwdBF2hRUGi9tZ1KzVdfVKkpgLqixoYgPmH3id6zfP4Y3kPTS5r7 84eE1f03cFNe5p29RozhI9HfikqNHEguNMsNB/a9c2PnAPYpljYMVMKV7fe1vLKHlKrAEDU5l Uh5z2d+kY//NY8aQC8fdV2xQfSxVjRFQxgdP7fR6S957oHJtEUHks9sjcq3nuqY67t3kHkB/F YSGfd54MK15qGM8VHz6KGTCrsun/8NLus+GXHAUg5k/FGqESuEQmvHFQojGQExKHuy3ThmBZV oFJ3X1aIggTdzDT1N3awLKuc3YsPDqJ76tEHJAyY7g== 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 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 Fri Mar 10 22:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661655 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15120lty; Fri, 10 Mar 2023 14:12:30 -0800 (PST) X-Google-Smtp-Source: AK7set+Tb2eVcwLPsSpmSwR+ZC72/qAc0ejQgMiZBckb/rJR+l9lYNIH/dDYdBzx8OIB6t8pdDb/ X-Received: by 2002:ac8:7f84:0:b0:3bf:d9ee:8822 with SMTP id z4-20020ac87f84000000b003bfd9ee8822mr10311990qtj.36.1678486350086; Fri, 10 Mar 2023 14:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486350; cv=none; d=google.com; s=arc-20160816; b=zDMJ9MKwrNORbp2Sb0ub1RrrPr31nBH9Po01k8sWoYinDkosXnczZ/pPl+dGX76l57 9KZppzbKEeEMqUNvHNOBy3RHElD6minAsMGPOJ1aHtfUnzhf29VRHC1cdN+lvEVMbOmW uXCk9wsDbFfm849ajFKFR2rNYIWWV0YByMviszFFvCfMflUn/tAIbzI900i0IvV/hFxw Tk3g0xMHUQzohZCE345nyAO1R/Ev57y2r+4fgDUal5ughg1JhPWDasDKqpxG8Y28PPE4 Bl0NXL4AzqFpQD1EOQXKG0uafWJNnNCk9fI2GRm6TDFf8m2mVgIDPxM8m2/soL+F53QZ Eyhg== 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=Md/3TvScSbc2T8xhC8zS5G/eEakYAWtC+6p5s2mx0fpjdU9RU/oRsZfJP1x6X5EGKD Y3R5a6iKq0jkTyg07Fhh5GQoZMbzmujX9UDmyA5gp7YXNXAZlRx0+sDG7KVyP6B9rtB3 fINceMdQRJgAkCTyFbG0E9lVt/uf9jh5H+sdy6QPa+Hn06IB7AHGwYb9H1sZT9ozStdF LCwYs78WeDlpCjDeqdQknNw8gIPjlckOoFAmAfPUtbQkh+qk+PziV5rBZPf9FaDxfbm9 3ULV6wWCrOLVw4p5RW8kfrjY2ARumtJRJAqVd38jWEpsWfNirPfg6eocidnLSaZXbg5a TEsw== 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 o9-20020a05622a008900b003bfef95515asi794026qtw.43.2023.03.10.14.12.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:12:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; 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 1pakvo-0008Fr-7O; Fri, 10 Mar 2023 17:09: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 1pakvm-0008EX-DO for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:42 -0500 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvk-000331-Ol for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:42 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MAOa3-1pgUDh1yLj-00BxOH; Fri, 10 Mar 2023 23:09:38 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 19/28] linux-user/sparc: Handle software breakpoint trap Date: Fri, 10 Mar 2023 23:09:18 +0100 Message-Id: <20230310220927.326606-20-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:uinLufA9+QpEWx0rvu0QzlvVtOyW5M/ZpPMPDssj6w3j2U8+/Nd lvV84qdaMRnaUVxmCMYAKkZPd5thDkzNJZYmZDuFsGiIgAZG1iGYmpOhJWGd5zRZeB1B/Xb Pc33dbQdlio7XkKY/zVecwCOZRMRz2q5j8qWapLJ2Nkwv1/CnKkMPgNAJGF9wtX2onkdQ2F uqGbk0ErITuDGqwRk+o3w== UI-OutboundReport: notjunk:1;M01:P0:xdQqFgzZDHw=;CMDBuahdiGdndJ+3eP6z3YhNoA+ luUtUXUSGE1xK2MFiRCwj4yPaUlLxW/Ws8fHDxAq7fRsXxSDRiV/0Z1QlAmbrX+uGixkXA38Z JBKUqFm0VCBtUFFEJkzusiui6ZCGnCpzJiwWP2rsAwchRFXtG6WokDBUAnHOjaUcrJkoKt37/ xxwZb9xzSxpd/BWfKN5F0cerwykI27ZQKLFrfEahdAHZ0dtjCDB4xa5ao+biYt5Iz8uZXxXC1 1migLNT8Gg1it1T+6++bZADeoZGWdNQNDcntEjC5kkDOvCb3EXXdsl82jXp4V3koqHKinOmMD FKi4Aao14gllsAdSaH4GLkd3JY+tQyOUmsUQ3uvoTJeNs9u8j1HXxgzvebuIVKsMIdmpxwh2W skvjq49Z1czTYs5fq2Tu1gVmSKWuESLckpysZvLnwOvSTqN28Xc130eXTSWxkTYCExGXcSqvN OyNM+YIVbY8alpNA5nij1khx2kabzxjcBmTBIHAoJ3AhCYWPZHRIvEmhDAiO3ttTOH3irRg1l xGnFYC+WC4zmkE1nfyHW5DKgnRO8FVKijdacyLJYtpAU92xm4dcdKpeqNlru7aGe5Tdto+OiR tIrNct4NoeXIY6W+0jkp5qq4twdRyzjydl1Q3DcBz5s630YFUco7bVV5ILM+CqnOy4RYOrzPz 77C2zh9lQl9QD+U1XeKhvy3LP3dkdzO8MHXOA1JB6w== Received-SPF: none client-ip=212.227.126.134; 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 Fri Mar 10 22:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661657 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15192lty; Fri, 10 Mar 2023 14:12:36 -0800 (PST) X-Google-Smtp-Source: AK7set+PeORT+cNQ4sKPzx9OQlfbv20YdL9MlIYWFkNeTc+vVv7QZR5J3QoO9gc1dKxoobVuomnE X-Received: by 2002:a05:6214:1941:b0:56e:ae9f:a503 with SMTP id q1-20020a056214194100b0056eae9fa503mr1158510qvk.31.1678486356301; Fri, 10 Mar 2023 14:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486356; cv=none; d=google.com; s=arc-20160816; b=YLvwFiNUENDQNo2XFG/GY4DkgwXPFcVrQ+1CXP7ei8EAO8dpt1dAlQ0Jy+ejHAUtH8 2IKsYO9SQw7gQZtcMiIGA5g60rUDNzguUe2ot9/fu2WhJuWmaYQtelufryS/tHJWcykb lHVhT4Cs2Cm+eylaFTXx969Jk8AI5Fz9vG5sN4oMrKg8Wp0Zu8kyN0vbY17xCKSwZ7m4 pIz4Wdk5CL+50FcyBZQTfoANvgTvFSuIodgSuk7QbwIXB3m5a4423pkYVt5IXvVQw3Rs f0n1TvDhSM/KDmZXshL8BSUFYeVjKBgny/8E8KZ37EuDEvBK5f92He8VW8TC75xwjpU9 4LUQ== 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=GwIgCmaYEiy9PaUQYtsQ6vZwvc2tElfjqO8Nco6hSWs1ZMZc0TmSuu2vjRyy8a07R5 NvW91mhxfPcIHYuQSbwSloyk/B/KhktgxGQRZzLF9F69NPjYWgzGcFe6lu7x6aPrAKqX JSM1ZXHWnA7RlwLC+RXyydXvF4gwhfzsOy2islov+sqd2cqJBxVFk7vBE4OxhKnFqbiu 8rPQy9PJK+FjML+0OqCkG0w/YFpk/cIVZt5q7j027yAQWu5vTdGDNXRkKuBSjcIkeBVW 5F+qiKyAG3HLNYM7lTUTCeYVZvdiH3obQOpdKDQBO2bP1c4AyG+V73eqUniS13xp0EqZ EcZw== 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 d29-20020a0cb2dd000000b00570f8c4a64asi488680qvf.538.2023.03.10.14.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; 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 1pakvo-0008GV-SF; Fri, 10 Mar 2023 17:09: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 1pakvm-0008EY-Df for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:42 -0500 Received: from mout.kundenserver.de ([212.227.126.133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvk-00033C-Rp for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:42 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mr8zO-1qNY8q3bTq-00oHwe; Fri, 10 Mar 2023 23:09:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 20/28] linux-user/sparc: Handle division by zero traps Date: Fri, 10 Mar 2023 23:09:19 +0100 Message-Id: <20230310220927.326606-21-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:o2groeTZ8+ZVcXX/xdZJp5rwLZURwetlvvjb05fhozql/0czbYv 5h1hK0x9wncC5Z9xcQysK8IUCvSITmoq1Qe4Yseduvc5k0DdJZizm5wB8selnKc0DLgaqVh 81+W5GkcIp/HKW+P6Qyl3LydKaSlleOHnKVCknKkWpJOl1cWe777hjs0FqDY3XUxyfJhK4O lAtJhjUJRU7Kk0Tqvt0Pg== UI-OutboundReport: notjunk:1;M01:P0:ah29MGxD33I=;a6SswT9F2eocKXfWVFmZIJLsrTc m7GlqVp73QhJ6IvZ+IKc3nvYEc0dx1DbNlmjMpwYNwDjLAMf59bcN70NL7V0AXQ9JMSmFWI+7 6ZoLnfH7kZtiKpl3J/3AXjemxND/EMwJuB0+/n7gMI+aTQCxy6p8//TCedMyOyl7w872lakRK WUuUiSJoZPbQCBonVAheRuRyfFmhF4eIPTwCsIvPBL/Jn6+LL0pEJK/XEZ+GT2O+xUfl/Degv ThLfEyy/f0X5siv4hD3ztUnF2KUfXjIX+rvQt/nFPddbwWgDntVeegLILytCA9E6mOHskCdic LEN2PTucJZ/kUfW6bDse7+ya85Crhfm+t8yE0JhAJfXeeGr7VmMZZLa4TuUxcKoyWsQNRFIZU lZEW62TnK/dpSKnx5Q2JVY86N3o3XU+trY9lxDQ5+DRxV/DsacReqX1JKBwDTbz198AjCyj8T 8ts/9Hbm8nBf5aOrUgLwX9vNcHxo+m70IP61552POXwiWPgwkLtceDYhjvSmva3UEUvwUbcIy fLnkTkJvYhEkclGByDj6nL7YfYn1PHfj2ydPBe0s9tkfILalz6EZMbw4TVfKqg0/8gnqy/J0S ZlcgZP5uve3AJTYE5a2pYm1jm+DNNPNs/w24Ngn6ERTaLyPdwgWazTKP/bMx3uhBMY//b/vcM qNg/a0DmY8oco4Biqi8tnS3CDNYE62Us9ZpIaAxN1A== Received-SPF: none client-ip=212.227.126.133; 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 Fri Mar 10 22:09:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661662 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15632lty; Fri, 10 Mar 2023 14:13:38 -0800 (PST) X-Google-Smtp-Source: AK7set8pVMAujTfOkC8oFkpCGSWa9547WdMAdY6Ei2KjlNy+2M+J+5l4sA8BSo4d2vLsA7CG0qYs X-Received: by 2002:a05:622a:1052:b0:3bf:c675:3b65 with SMTP id f18-20020a05622a105200b003bfc6753b65mr12249758qte.44.1678486418582; Fri, 10 Mar 2023 14:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486418; cv=none; d=google.com; s=arc-20160816; b=NNlFW4rd+Jjz04qi9ilhd8/nV3ezpDYVQ2Tro1N6brDG5c9v6A+K4aSVm1tKTAVw4A 3wOkBlTrA8Q4mIOvj33LFwBRP37iFQzOZymvUaIVuatcgDakQ0iEXQ3U0rnb3GuTBqvQ u4qXOANFej8AOcU6UPoV0/Ob0BnCXRSK4dh+yIUv9BmxLugyF41z5aprGzSYROfKtySq ouLVYmSNu56fnNMdwf0DiApiMtuQkh0h715CH2qziNHAxFjn98WIG5kW0ZNAXHukTGeX ixhw0PvOWqCPmBPHqh8bAevUqT02G1KZSXF6cS3g4Fpso/jI45Cp+ePP6cCuH4GYQtsz fReA== 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=Qsbf2GEazYmgsexcLJx6OWoNuGdZN6X38YTEFOu0cQQES1412Wgz8DiJd0v2yB0Snz oDwMxgX3egGP3uVmR4iBw/xK4fkoMI+WZfPeEzxUhKV/e31cQmtFct3C6f+9bOfwtQji Jp5U58HbIDZhsqVBDM+rUor8HfqRevmorvw4+vVI1gmG/gEujo9NyxCHl36rCioOf92+ PB8NaN6bfx3D9RvyFSBuAFc8VMSMtlipDWm5H6a6lbO9+lKb7YnIfhvSqWio5McuUThX pGdxccjbdRX/AcurUFfx8RQ3eaTxlZDU5L37pGwvttUtg3zwbK8C4c7jchERLGB08T4g OSwQ== 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 t2-20020a37aa02000000b00743995aef85si314894qke.230.2023.03.10.14.13.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:13:38 -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 1pakvr-0008I9-62; Fri, 10 Mar 2023 17:09:47 -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 1pakvn-0008FR-QF for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from mout.kundenserver.de ([212.227.126.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvl-00033M-Ja for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N3KkM-1qZhEf117q-010L9g; Fri, 10 Mar 2023 23:09:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 21/28] linux-user/sparc: Handle getcc, setcc, getpsr traps Date: Fri, 10 Mar 2023 23:09:20 +0100 Message-Id: <20230310220927.326606-22-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:VHzsuxxPPKWyfOtCIGXTKlpnoif4oOTx6r8dnvKBJsoUhW/Xib1 iUBCnfxLEAB5zq2fxl8UrwrwRrHTsHO/eboCQ0wg/X5/MeHKYRPjqcDVfuqmGWFpw/95Hpa jVEFKrsGWnTh1KRRE2xItM2STRJb6pfzwBao/7pw8Selb7Twc3BUGKLk1MqaqKif3sdg3Zz qBbHwPoTUQ7oEgbECz8lw== UI-OutboundReport: notjunk:1;M01:P0:iP4dggLz/Ho=;RqsK83/RCo/DQMua3FTulhXvx0E IBDNR4R3l9x/iVB9CB5guzZzBjspHrNWvj0QgeimnHUekrpJDBGS15lbDrZ61PCobGP6qrXTN bDoM/lbVhzEho9DNgnZGc4bAZe1aqFQ1z/u/fxPEyL9gwOBHxNGJC+md6wdwoaQf4A+KuIaKU xzyqsl4Lc4JuEOOo+o4mxdvwgBpMkbVSmkLMfYA1LZxbHof4e/seUEEC09Hb0JXoaaO9CULfO bM+OPHsQBe6XfmH68plLb/55kzPAjRLDEeEBVZuKQip5U4/Kj7OTobazLtz6r2Nmx7mwx1BE5 Y0MrJQUI59OnRbekWerdPnW5SMkz3PlWRl3bzb64fU/W9fxzOBYq7Vp5XpeVaI2h583lxTSbl cqfH5mv0SkiYAS2LsZG2nzsL1qyShCHTYsP13UNXtOJR1nrXjcFCOfcNPRIaeo9UEdAWSFYp2 /4eRw2NnamAkkouV8PX+Zta7OSqENXI/VH4ZDBhmrD1i+hLeDZ//55UnEKTY1QWbjbxgfiVjk ee0tPBCjt5x35b8Ca2DsYJIxdOPkEznHH4XQu0MJXfipPlJ4C6PyGT7EdTGm0iCNbSw/t60UR qdwQuytc7iUuumNnFCqX6TZuoxVq7IqSm/gATRQ30YXMpmyoNYd+IfrQM8o/HwSoeEW0A0NC5 iLSBvUvuez1lCWaR9RsGaGWoflWG53Uj6NNOw6fjzA== Received-SPF: none client-ip=212.227.126.131; 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 Fri Mar 10 22:09:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661651 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14447lty; Fri, 10 Mar 2023 14:11:13 -0800 (PST) X-Google-Smtp-Source: AK7set9rr56GBDXR4YSsjrP60bgqnjexpyft2q5TAOHgojLmi5ZSIApASLqVoQRkXFdmoF14qd4e X-Received: by 2002:a05:6214:da5:b0:56f:796e:c3a5 with SMTP id h5-20020a0562140da500b0056f796ec3a5mr1294641qvh.4.1678486273313; Fri, 10 Mar 2023 14:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486273; cv=none; d=google.com; s=arc-20160816; b=oUqk1syM5NsZWwU7tLXUnXnTKhZ2JswaKAp01kl+M4MGtuGA5+PI9MBEz3eVIG6iRI HEvMVKKF6CUUkKtkFIuLkW7nzPenOYksGPUP8+7bGo2OPfaHCl1yZYkBKUmGQ2yELJke faRfdGFMs0WTN7goz8lmEsRfJEXQ4NOmDwzFu8L+4T0119WzwzoOwc1q9jcYSzjdtlLe Bch9ZjXKt0+8WoWdQtxgpEgB9KpYQ9kSGNER3cwMPnvKJ46T3qcSw12+oapcQechp2Xt E+4MscYgM0+KzHwCHhnoLIJP5vVPI7cks1rKnWJzBluInsfSFGMgcuRX4ZLZClumiDN3 gJBQ== 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=oF5/3rJBXwNZpM6jO7hiDzHM+Hch/l9U/io3qzRr8jonACaFWmUs7RL8EjuGyp92+P avJ+Csz+Ozl5xegmn5eU7iFPhv8aAx1WXderTs+LJ/xNup4faOWHdNcY/4lrEKyK2ce+ Z0bfO2LlRx0hI2J4RxSeqYywSWfCXXl4ncJvoTcWV4kBvUYZXrle17wEV2/HaZbjztn8 Czv3YKiFSrgW+J9tCrxRPZSb4VXZYgWDdRwAztj8T2dffxL9VubH09uBWDCTYDmbxGs/ EVevr5qQIChEYdddjlweFistUwvH5JHd8WN+K9RF6Dbrcg7AZlz2DaKPodRgqhTp54o5 s3/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 w9-20020a05620a424900b00722cc4470eesi673895qko.450.2023.03.10.14.11.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:11: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 1pakvq-0008I8-NO; Fri, 10 Mar 2023 17:09:46 -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 1pakvn-0008FP-NQ for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvl-00033Z-Jw for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MMGAg-1psyZR2eFK-00JGYq; Fri, 10 Mar 2023 23:09:39 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 22/28] linux-user/sparc: Handle priviledged opcode trap Date: Fri, 10 Mar 2023 23:09:21 +0100 Message-Id: <20230310220927.326606-23-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:P4ONyuy7N0jy4CWnfH799ipb6/iB8eLiOxaqw5I/3U0l8KdcpMB MLP7pf/taNgSwnLq1zhXx3YTrqm6j6r50T0NG0l/KFc1CXgdaOE61SSxClimcFMVt/sHYpu oCe56XVJj6X9/XuG1ZO7h4M8fjFaDGXWQxjeUDd9hAx0+5l2weljiKVoLwFyj+rFmR+BlDs t4y7JL/m2VlYyflIilkZw== UI-OutboundReport: notjunk:1;M01:P0:+348JhsZYXg=;m3VI980DQbhz2WEZJ7A+hs6emRy l/h8YK4c1UU1Y0XPxUe2796kOheZCxiJImTIDktRY0VnjjKSgaiYfrZ4bsECtDrAAp7qBvCEI CPiOuKjrcCTSFw4vZO1z2RoCQC1m8NRdNQFwaHs4BrjRt7PiIxmRHJaA9EKfGEsuvdR4yUU1n UZjTwvyp6JMMxJ6zEoQ2OKIS67gl6Ux78ribOuVN7TJSC9KLGTy6NsYTOYv/BlYJjuHsvXq6M 1g+cVLuzwsrbVeAPABvTIvflwIthvf/TschlODbWeYryAHTa04EpBcHGsrhafWtqRBvTELW8U dSfNO97SHjGHFBQokYYRjdno4Qn54K3QnYh7tfSQBTF07UHgsHIVmxuWiwH/o/kIYYsPyfqIv M5jx7Tkn3Ozuq/jMx0uyivk08kAgodpzCEFYGmsTa9kP2FAoum+UgaKlyrO54z6zvsa4xIGoe wiwqkIGFub2U3bnxbtlNIn8BK2W0JtRH6SfesJwKQj3feNZ/up5RZTdOCg1tBKOXwF9VuEsGv TPx08kGXCaT9p3efiXgmj+cvAJ3pD1apzXUTFetJGazvtp+0DNNOmPykmmXgQhUq/OeTbnqym UYTesNyzaCyvHLelrRhZPIYXlej+NXrT1d0RW8w/Hc1SWV9s/bnL1alDTqEJ7LUwoArVfasQ9 BLr76MiDQ9KQ5n1FVYSJ2k6b3mKpvGUvEjAcem8PGQ== Received-SPF: none client-ip=212.227.126.134; 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 Fri Mar 10 22:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661653 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp14817lty; Fri, 10 Mar 2023 14:11:54 -0800 (PST) X-Google-Smtp-Source: AK7set8D447/MKVQhJRA26fbS457fDC7kyeNRo+4HB9hTdKFdjzcRacnNsg9W+oXXV+NhjukfJgg X-Received: by 2002:a05:622a:7:b0:3bf:daae:7ec9 with SMTP id x7-20020a05622a000700b003bfdaae7ec9mr16413280qtw.43.1678486314090; Fri, 10 Mar 2023 14:11:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486314; cv=none; d=google.com; s=arc-20160816; b=mq3wBAdBPFGXVQ5eKazBbqDzLlH3oalXeJpijIclkYSwBTVS2bUUB9tTJ0geHk3Ezf wqwj81irbSJq4L6DssKOHNLJpJClFytIrRJohtGSKKSgU5Zd/ct1KsbYlL9oESsFaEph IKOMQKJLtHx0tCFYklJ3Z+Qs8Q6YeWHDNc4UdFFxJl1ehoqKw8SoUAYepmfUngYuzm+A FayqJzUCQX59n0a9BAQ6JDF8ivxBFgWDE+t9pGiGyft5jCqTxgFVLox/oCeIa7NZZ4Fz DRHA2TisTgzm7sFaFBM8B8yZPT6ok9EcoL9GGpkhZotgI3Ry9IGwWI8nkR5d/ndiYCMu ywPA== 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=mLHaWzxe6/2cX2yC/bdrv/5NZaSOqktZHc/XKq3x0rGZqlr1j0QEntD1gS5vikZFQD xCbWFQczyFqdvmICHRXnzp8WoSkTxVfr4+hPE1ZB0CbDBYkqt6b8wyHHo8DvyWUDjxCP 2q7ejYdRg9RZe2ZCjkX3cJUkbu53OHPxLYAZvOugckgTLUHrWd9Fss93bD/ZQSs2MyBp hG4sw21fHI5vZwH69uBgSpDAv4s3p+2cgixFQcQlQvKn+Rg/VBjbFhRGA5gxEOgF0Wvk 2KQIlHiA55NeTThgkNBpEa8W7T7gK8PCXUKFoRKOL1W/wCOcFWilzdZ1eyXkyBaVtgJR Ripg== 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 u13-20020a05620a454d00b0074357d0b312si801439qkp.188.2023.03.10.14.11.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:11:54 -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 1pakvt-0008Jb-8K; Fri, 10 Mar 2023 17:09: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 1pakvn-0008FQ-PB for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from mout.kundenserver.de ([212.227.126.135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvm-00033r-2a for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N63mC-1qcSOi05G4-016NpG; Fri, 10 Mar 2023 23:09:40 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 23/28] linux-user/sparc: Handle privilidged action trap Date: Fri, 10 Mar 2023 23:09:22 +0100 Message-Id: <20230310220927.326606-24-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:8BJjg9GKKN+ZES0CWZFB+QptCwjTaxKXKEC9uK8uWe86U9qn6Yp /0KQaVY0+BljQGzMJYPVdAW/XJ/k6gqqnkgr8RhAFQnh8jjhqmseg8s1LsLxlDgPc+87tQm VAqwGzFigomyHwids9Keu0Z/MN0zoApz5oTKbBoVOCbq+hPxIMgrDvt9Orbb8N5qyTAqY0T F+VSphYSizgN028kBVaFA== UI-OutboundReport: notjunk:1;M01:P0:n72FCPrgKjY=;nY8N0nOPS5Gz/yab84uSjm34wFZ YcUZ0/ClylupTDuSly4cq+Rh4LiBz0sy9wLcU4FjllUQC6695LQamCpCvS1wYvFzVeWlEmP+z kRH9pv8Pq+nvaLPsG7M74NiY0GaT7PU1Xd1VEWSkIaXS5CMcWgQF5va4ORcZV7LcsRoK8L7zO CpeIHXvk+u+9vciprDqGnIrBZ3Qmdoj1BFC03he2QR4mXISVnoqaaMSB1FtAXojMYfbfJeVb5 S0Vbh68Rs0w3SoPSIMAFbc88IV0MS7R/ziaeguSW3LSyVk2tGQbVhV+qIj6mqcYlw322nKHoI 2CEe0bjccHcn8IzHEzRix1puz/VtjCD1OfendHo/U1dbwaAvBaOMdx5NEn2qERK5QQWdhCGcK sizsmZT8lSIdKSWTzf27gii/05Ssq8GWP6MZFsYQiG6AW646jlXlwZGFQP8e5awlOnir3YhLF 0w0rq7QQLzk7qAxxx0eVtAbVaFOe/smBfQHp0YA+Yt3Bon8fBgX16tHUCTCagqDOmho+YSZ6y X93PcYEilcMWR4iLIjzuQn776I6skufqmzY1UI7K965NLSDeqrBRUg7Srf7LjTBjbQjkobaqz p89sPgw5TSqG4eSFRhshvkVvzQ3iHcn5x5QK3jDqsB7/CnBhmD/DIIGlALupI4tx+8HH72ZGR f/pOAG6JJLqcsgpp8QMbPQOsTGKD5nY3b0jvn4O+Og== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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 Fri Mar 10 22:09:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661661 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15477lty; Fri, 10 Mar 2023 14:13:16 -0800 (PST) X-Google-Smtp-Source: AK7set9ywqI1hscJTlTRtg4NItKZtgw5QikJcgSmws0odF7NEKbyeJ0Pn5+qhFBOsGZBSvR0LaLu X-Received: by 2002:a05:6214:1d01:b0:56e:a07b:f4d0 with SMTP id e1-20020a0562141d0100b0056ea07bf4d0mr1237354qvd.23.1678486395840; Fri, 10 Mar 2023 14:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486395; cv=none; d=google.com; s=arc-20160816; b=k2+MDryOL+vdfrmzPjoIFFQBZi+EZdeRwAncLK3QGo6JoBKhiu52MeStGsQLN/5gut RPLFM/bvgkI66mJ8n2bF5BREXyvwbTtMuljMaqselytozXI0Ug3kdf0EoFcIQCCZJfYA iTfZM6EGyDN1p+16usyP3nZHEUi4PcTdICy9JkWAz3GzSktra87ezHgob+jgX8aAmnAM xNyo1S6LkGCtsLgVzL9LieAcZ4cegIeQCSS/A8Vmgtg3A2rvuvKDar3QR8WNruE+RVMU Hs5LALBzVkNtNlxzRc8cpajzM/yKLsQB948Gvy9vaNIXp2AUaeGjdayQ0zXujaDAl+2W nBXQ== 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=rcYwReEJu/DF48JsRDvIAiEOnFfxRHn6rz5rQQOZbVpItBgWiZ3IAIUO6JX9VWFvNG 2+/VlToB98uWi/wTE7K0WG3mTHiKpUxiG97KiDrRj4z1raIcrOxOa8wryj9Jv3lts0iC XYl0FOrmZrvYznz9e7xmZUODw6NvNwq8e6pURW/j/1vW6hdkI5b1HIW7c0lOthd3zXLV UZADUKT0ODcYsnMu+8DRk2/119BzSLf/pJ9t/PvXJTASYR0Zcp//U8FoosEL/mealDZH 9Ng0kBYfEBMIel5JjbOPKMAr4EUK9KP0aBTEmLFh+dh0VSA2VrYwU2K20bSmGl5M3E/W MzYQ== 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-20020a0c8d09000000b0056e9df88b38si551188qvb.386.2023.03.10.14.13.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:13:15 -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 1pakvr-0008IA-9Q; Fri, 10 Mar 2023 17:09:47 -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 1pakvo-0008Ff-0Y for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:44 -0500 Received: from mout.kundenserver.de ([212.227.126.135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvm-000343-Aw for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:43 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MT9v5-1pzG5j1liJ-00UaAb; Fri, 10 Mar 2023 23:09:40 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 24/28] linux-user/sparc: Handle coprocessor disabled trap Date: Fri, 10 Mar 2023 23:09:23 +0100 Message-Id: <20230310220927.326606-25-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:9TX+eZuuOY4xjQjv8PKaO/zt5j3kT7yGZMA2ZGRHc9IMReKSOsE VzB3Jro5JzhD5wnEff/kQATHeJzSLnbZ8lsjhi2xUkmsreMvQyCd+pKqP1eYA4GXo9S3pzr fdTecH+DOmHkq3Xgp+AokrTJIKOf6SV+kTpYolli0WFZEIc6lsyY3TXJ6iaD3HohR3hPSMx aJFTg9cHqVoYWY+2h4hKQ== UI-OutboundReport: notjunk:1;M01:P0:1PMoYEuiGq0=;OBE+Hn38qeorioRzNk85qvoC0zc G++hIYmXenpSdgTIj5NTGIS969lZ7nGIht6mN/Pf+xyvVF9Q7Raz5Olgdf9jRPj1lC5OmyM4F vpPovjdZJSkLVEx8ohSauG8fDJqTnKSgZBa3NMmOJTXupgLu/qt7yFFhYir/Of8HFZOxMRAOo 4I8s5gPu0u3Sr0Sd9FrAwZeqjZwpJn68J9KUmRj35rUYLL5f3TCtkr1336CHq1PUV4i0IavPt +6DP560z27ij1c9VCBjIREyB9MC1n0kVSXC98MfMhCj3bLHpk4jBvtoEMA4CFZe7NJg3kmdBZ Das6MOPaHGpHt0ph3s/Tb7fzTTVi65o6/v6ZENwGRRiRIRfQITS1s46syWnpGq+I8M1I3DqpE nVEd4zb2OYhILYstdWqqoM7iNyQENORxKuOCfh8uo7O3lcuCEwuV4OOwgKOsq0DvBEEMwQcML 96p2w11FbvyOOYQunqfX+Jpnsecucj8GnrdQ79kr7gr4vKGZeGXg2YAwNQi4xOGO5uRFJtg0s ZcTWNReF+dn01IwWpBY9yA6ijafJQRSIsmQpQEKKSlV09EYxaokBVGDMAMAyiTDgnsnD8J4jb fiAgk5NaH9Afo7flVauHxZCKf13x1gg4QqeaNBWbNVUMBgNqcNCrepfQAKMB7sxJRe8pHtdCe hR4EwyqWkqu8F3sfBaYnSF4ydM4vtbZ8dvwLCE7mng== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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 Fri Mar 10 22:09:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661658 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15299lty; Fri, 10 Mar 2023 14:12:49 -0800 (PST) X-Google-Smtp-Source: AK7set+yABs9vLgbef5cB9e3d4igZHqaXvFNdc2jDGWIqSVX5IlwqNZDuJYr6B+0KdqsmRUIHlGl X-Received: by 2002:a05:6214:27c1:b0:56e:a6c6:445a with SMTP id ge1-20020a05621427c100b0056ea6c6445amr993629qvb.31.1678486369469; Fri, 10 Mar 2023 14:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486369; cv=none; d=google.com; s=arc-20160816; b=DGKGbFKl+FTMd7+TkLKrtptmOKvaqXNRLYe93xyDR9+AxMrmyl9F4gpVSa7hm1ewH5 tmBRGgg18xZrzVv5dleyX3yJc2oyJb2NnOTveSehFpvp1sv2rQPxO+NceUkd038I88fG QwTExiURmbV1sx/9XiYD6JdRRcX/uIKmMY1jZXDRbFGKyzjk6ap6pGoVynkJWSVthvqB KklGi28MMD94ouSlptj+6BmqwXUwVvuILWXT1Pan53U+9J0F8w5Fj7hmSXn6IcJcYfdA Cags6XT2qz181Cga9WRk28BBfZrDTa7nJG1kLSYUYAHy9EIeYKgurB4p8QojOxTkKRNi tGpA== 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=QBp928B5FdyPN4yHYY2mwEeX0LVURkutccDSkSvXH6/B52NAbaHo5C+et7n8RL2SN/ 9/z4Zl2DbI03sruSk/sulUr7FgzP93yUoBpY5Mjca8UbMHJ8xdw0QHfTDLUYRJ3bWQZH F/v73pAwaW0FFRBI5k2KkuBBMIQcbsbgARsfk+c2pro1lRqR0IZzBbeQWYzhig1+RKeq v+9T4nh6EYduI4scW42h1KQ/0DC7yQXno9om8PM+GxjhnyCRiaimkZhdu5sTdae2nPDw yvpAmIWMsmaUfrwSJpmQuWT1cit/a45VnNIcwIyazWUuVksB/Y5WgULKcqhvmN0NYxdz RVDQ== 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 e24-20020a0caa58000000b0056e9fc0d4b9si559357qvb.286.2023.03.10.14.12.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:12:49 -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 1pakvs-0008JF-MC; Fri, 10 Mar 2023 17:09:48 -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 1pakvp-0008Gp-2I for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:45 -0500 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvm-00034E-RY for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:44 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MZCrZ-1q5KdR3Q0X-00V74J; Fri, 10 Mar 2023 23:09:40 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 25/28] linux-user/sparc: Handle unimplemented flush trap Date: Fri, 10 Mar 2023 23:09:24 +0100 Message-Id: <20230310220927.326606-26-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:qBqa4sXS9ldltBNv57y74uGX6DZK3Y4mUJFJkHx4S5tYcPav4Kb z0tykp8ghHjv2pKPOtGi02uko6sAV9afc/+cLEJZq5GrwOHFGij1I3sl6sLjIk9vrnZlxw2 248VA2d+ZQMJO1SZQODd8gJ+uhlqxG0ymvCfIncRb5XXYBQ3U0lIHjLmGm3nzudlm7ZcGnY yZPY3zcpBA51/HmqDvopw== UI-OutboundReport: notjunk:1;M01:P0:9jYbuyek/ew=;X+RIAcT83fDjR9narXVEUlQ6uoj q5VNhwwGtPWjaf9NeoqObJH4CNHPFLuYPC95w/qHFNJ9S6gn0LGOSm1+7G1JFvQUx1l6L3G9j BLwnyX/drFgw8g6aSa39aP8zvWj91mi9d4bOzVyC0KwiLfYTQtsQ0ZtHvdJ7azB1h07hYwLTS x4r1aqNOhWT4KsJ5LN7jfWCnYnCXKzAddWuRm8U5oeJwHYIRKcayHGhYgTW5PBmt0y3UtpvaF lM+K82OH6Ghg3GF+tpRN7SvHWkwiBkvVxT3pyk5fXfZwRShoBtjE4SJUkQ2ZJB+xx3DVOQ3Jb VE/aMeE+bAjIgJkZstE4oPN4H4N6o4xWDYirHdFPeVWDszNMBMyiSuJZfDxbi9CrOlcEIBLvv sbp39K8AGw38wEy8vHsBGtzqTp5rrE6iVabqTv8trHZZKHBIRrMmTW1ldOzK4jDeABBrDggOe TAZqmiciBGR5o69u1eVHFKDT80wUWdM/8m4uGq6w7rsl6SDbDyoVeq0H6g3HWg5bJdO9uGvC7 u0max07kYx+1G+I/KgqUSwUIRUBru3/h5SIazwJsWjYaghJMUfFFmtmoZz6OFPEKHgDAV8Y5Z wE8/KIjlCghv37gCcy7QOcUIDECDIR+V33OB6ix4ST8R210gxetQDcLr++WJYaKgBhOcgn302 idn2jOBmUaUwiS4wd3gU2oDJTRVF+wbZytvGfiYEpg== Received-SPF: none client-ip=212.227.126.134; 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 Fri Mar 10 22:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661663 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15711lty; Fri, 10 Mar 2023 14:13:46 -0800 (PST) X-Google-Smtp-Source: AK7set+bJJTyIC9zUWLbKCxcypMUTVTHryrzyX8GCFIRdrG9PxdlBFDrsD6ordbuUnJpKHlFGQCV X-Received: by 2002:a05:6214:224a:b0:56b:f061:c3c6 with SMTP id c10-20020a056214224a00b0056bf061c3c6mr1051539qvc.33.1678486425828; Fri, 10 Mar 2023 14:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486425; cv=none; d=google.com; s=arc-20160816; b=ENk1Ye2anopAguY3Deqq5DIVe4N1EEoexTenMzDtXqs9TZDay/Ysz5wZPuTMhvMC0I Kjg0Dngh5dvyFteS5KrutRCHEq3un0OrQDXfNIbH3e+n/yu8aHh2603AjYFWCpZk5Kcc 5U9XlBnrFEnSVj62BKEQQFVRa2KheBTkJRrYZ37zCBWtjMhkK3FleTiwrvVEdQ8gnE1p BOZE6KuGdB0p4BcHXpUY4PttQgpj5xRiRTqEQ2WMrE6SR6mOKngHfjrbDKqTh7aaOL4S vI1RcA4eqP0gG2gFFe6oXrnq1LDkNMebsHYdHuo3AqjOeW0ryHRzD1uwzgDPaJSFVqmI YFFw== 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=eQGUoakVeg8Z9hu8UqaZaiWol/g4dHWHTMmsXQlxuxcUnZy3PGNtIUJY6oFjOMPzv7 gIhya0t40LalwxDILz2xh6vcxrpVyULV8lyxcNxRgy/DqfmBy42kod94DZEWmT8uj+bA VyqrZvIPeR0H5HgWIZ1AmcYcQPT7hhax8hxQtE/eXOYgzVe/FKwroNJiL74K/0nkhQNd JBOrRSRmJOvsZ3IhtN1p7Dqu8iHMN20+91d2SZTmcdOn0WZEuVcQis82l/gP4UKOj6a5 W3oQ9ZzJlv+rgn5nqPWvS/gSFErcNqEAK4m+Mn3bURkEtVNmtoQbhrWMKt505a91oKM2 XjBg== 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 204-20020a3706d5000000b007207a179ca6si609828qkg.73.2023.03.10.14.13.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:13:45 -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 1pakvs-0008JH-N3; Fri, 10 Mar 2023 17:09:48 -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 1pakvp-0008Gq-31 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:45 -0500 Received: from mout.kundenserver.de ([212.227.126.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvn-00034M-4x for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:44 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MvKGv-1qRD3k0ter-00rET9; Fri, 10 Mar 2023 23:09:41 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 26/28] linux-user/sparc: Handle floating-point exceptions Date: Fri, 10 Mar 2023 23:09:25 +0100 Message-Id: <20230310220927.326606-27-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:4P9Zsn7G8HSfHDsvdt0KtNizKfMoOCm/eELvFsgqzdfKLA5o1tg Ir5k8FDWW8vRgIEQxdT3grF5Q40hUyvir+wrWCVO2DUEl/Ml9EUHGYcmgR9eTZemVriZU0x 3iAF+fEcA5LjebEWODkbkyvZWG2W40uAEBjTAbVW4E9de/AWATdaiObMH1jCMQqhr8OUIhS 6ZbSVYPhecQwdzkQAuKkA== UI-OutboundReport: notjunk:1;M01:P0:T2yJJb6gBZg=;fOqjSSzcPA0hnDQqZUY3FYNbwvS SaC8GvjHFs61FHeXh+EYovzAqcet0VlG+FqRY8ySRbJYO/yGuH8T0kNfcTOU62gHuldjhqTZv 0Sb4ymrjmJUMcTLumv8oE8d5KHqNiWTmwpChfpqtG5YUdYhyO1QQJMD+FFOEwHUmkfh2I9MnS xUDUTWwtSgapDX04/5vxuYBYzQU/GqXl1qm/gmzeNozIPwgK4z+pg5cEMQ8P0AVlXFu2CgGjo o6Rsko4CnDmPORyiMzIBR2dwaVTL6bNt93ATwUl7RETtCUCWVNw+RkbKyUYNKtzns+aGTWxyZ UGHuKxZklVKGKLNEP85AkNmR1rCKSluSyEepNZk2ub+6CIyQSvIzEwnLGnT+J0fO3WhIjgGeB per3Y7P/ZOSRTsIs66zKAdxRtn3q0QVAvLNDpzRTF1AiIfMWNxKKThhZXO29VPvaxQfIIjSsK H4/HlnhLBeWPGb1vj8zs/GDFj8q2b9d1ej5sMzhoAq+ZICd6MEjVFMRFugljSTjG3wFGw75Zm s4TEoTYz0p2bUaPgywD9TErByC//80A6YFnxq+KIyUw/xyZzhcJXtoO1VjwnbGLr5xXiy0SmE X4NF96hQ72gTpYnz0dH5y0MXBuwVDgW5wnlYUa6JxXRvW//wmmw0hY614WDYoAW5Q9V8ObUi8 B45MHw5zZ3bmFlX8Prg3Av4dNEcpo7ZSwuYBD0lrmQ== Received-SPF: none client-ip=212.227.126.131; 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 Fri Mar 10 22:09:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 661660 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:1b90:b0:222:2e2e:b2c3 with SMTP id e16csp15430lty; Fri, 10 Mar 2023 14:13:06 -0800 (PST) X-Google-Smtp-Source: AK7set/Kq12oAqU2i4cn5UJjvh/wV3nMFuY9MJcBtaUyc4+8n5DMIdR7xz+1KbByfFnT47IvnbTE X-Received: by 2002:a05:6214:2027:b0:56e:b690:9bc5 with SMTP id 7-20020a056214202700b0056eb6909bc5mr1227445qvf.19.1678486385800; Fri, 10 Mar 2023 14:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678486385; cv=none; d=google.com; s=arc-20160816; b=hh5a8A8cC5kBjuG5ONgSjwSwamPzZvbm8cXAAixcWaX1yxThgEFRgylvXTstHO0hwd PuPUDaVwmmBQuGWr7aTOKZHUrEs4pFaDi1+0yH1s3mnc1nGovjPtS5oOkJO+l5eDtVGm lliVwqhODlv4NJwkdY6Uvl6jrVKTfAxgn4dzqR8i1AybAAqug6zPHTQr/iGvXx5//BhA /mCHp3XxT0O+jjHoE6BjZiw7ykv+xOOyWb2laWMkz3tpipJmbc64H9ORJzlkD71kamRR rRu7M9pCcclMfwmnbxWTrlcOIo9RrIh+EYsqLCRjHAxKD/YyUZ1Yeo0yhkIuPJy5Ud9e th2g== 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=fqhdRCmqIjiAEdDUWgMqv47R19qGUS0MJ1xpQ6K1jwyeLCtzeBkJC3XrmlxPI/Mj92 6UOQwLFqxd/XMuETRovBeWdK6dJMzI3+kj4r1ImwleeiLYgt5uOQDsmPw8wTZRMuHoqj /bkzihEXtBsT4rbx3utgZjDkQtyU5vS63YpSZr7jeYfCGh5imXYW8QOMNSiZLt7MoU+j ZiNFK9vZ6q/1tXK+PHHnU3HU2tFLJzwFmVf4VM6bM+QHjUuISJ6ZQ/yhRA9ObDsm1kfL Dz3P7XTZ1azUQYkPtsOnLS+5X8hcqtAOSj2SVHfrFIH7VbjRjlxg2RuQt1ApO3vwj2Gn s00g== 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 l16-20020a0ce510000000b0056eb97aaa5bsi573474qvm.299.2023.03.10.14.13.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 14:13:05 -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 1pakvr-0008ID-SJ; Fri, 10 Mar 2023 17:09:47 -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 1pakvp-0008Hq-KF for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:45 -0500 Received: from mout.kundenserver.de ([212.227.126.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pakvn-00034c-RS for qemu-devel@nongnu.org; Fri, 10 Mar 2023 17:09:45 -0500 Received: from quad ([82.64.211.94]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N1g3U-1qY2Xt2XtY-012074; Fri, 10 Mar 2023 23:09:41 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Richard Henderson Subject: [PULL 27/28] linux-user/sparc: Handle tag overflow traps Date: Fri, 10 Mar 2023 23:09:26 +0100 Message-Id: <20230310220927.326606-28-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310220927.326606-1-laurent@vivier.eu> References: <20230310220927.326606-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:OcfT3VyEztuO+dGE7DGlwnBMGNK02Fiqz9rjRj6prHOlyNKK0hK /8zByGLU+59nK4N5YQ+E5zMcVNtHYgevCjroLEyxNKkOyehqwBMlTxBZrWieg6u2BLSMOM1 LynNX9dopUT9q15GfKPXpT2iENu4sj5KaofJu/4LcStpqnX9cDSvr7iml5w2OLyWa5zW77T 5lfuSBuaxNhN9XuG28QlA== UI-OutboundReport: notjunk:1;M01:P0:EW9VIB3n9YM=;Q72xUPAAtKMJ5xERba8/38J7DXv gCmGx5FZxDBnSVmDbnAyHc2rrfslZFw5xahoH6hnAKsRcXTcB8hv3VRwTIezPv6HT+BcIrRUT uYWp4nKQ9MGKHjlsmUwXDUM5OxTPUF/VykptXd4Tdin4dchX8i/5PUoe+44B0u5YqaE++vYl8 wjwu/qTHdMJnukU6GShyrcF4KGFyP1RHf/CJ6mLE+Jo+S2ytOCIhGwuWvE6sP7sxgaXCQEDA8 4g9+lxqBe11xGxVtiTyiiPCXJL4Gej9RkxI3vLaOsPdUz9eR3Bme3j0kk6tICH6Aahv7ySo7k qEkqwGrhUxpTsC46x/VbCeJM0LmC1/f4aKRVq1Z33pH77r/yoquugu1Xpgh46cxS7VrDfaBGI mJ4Bn0b7qv76TrsXKDf59WfIKgYk+R5dms/1661PuuYffSiYD/hekKoJRU96NtIZYLxEYKkcU vIyfq83uIREhyelBVUPhT8lVtwPQlcs529DynY7f3SuUAWr+XN8QllmCJavOCqEfJq/qtiorJ gqsXbwzfK6XhwoXh+2vI2s+aPdlv8NTGeJISjAlLZeJqy6lrSaTy+v4jVtnITnhoni23qlTT0 Fkfev0r4WlfvFWR694yMCumz+FoMTjzvUVTTeuCY3taW48YHlUiqDwFjkLH7ncOpZ5EvmcZ1w 9ggO7B37mM3s3/YvrxI0FKU0QaQz3u8sRaZ85HlSCQ== Received-SPF: none client-ip=212.227.126.130; 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 {