From patchwork Thu Feb 2 00:51:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649641 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609602pva; Wed, 1 Feb 2023 16:54:00 -0800 (PST) X-Google-Smtp-Source: AK7set8XDIEG/64ubuhXFJMyHS6IDuRn1h9FDUbsZ6oDXEHvbSFihO3/atI+ojgqsYvBLBM13Mst X-Received: by 2002:ac8:5989:0:b0:3b8:5810:5634 with SMTP id e9-20020ac85989000000b003b858105634mr7004021qte.8.1675299239922; Wed, 01 Feb 2023 16:53:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299239; cv=none; d=google.com; s=arc-20160816; b=nC4DOVP1pNiHK/uGubHBwFFUx56plGPZe/Oxv4X38IKbKb1dRcNqIWWZEd09YoE5ZI x3cv3roGbRUiA+7TESZESB3BOwmI7gISdOJnbVRmAzWBP0/VbpmA3vzPmjSdHNdHeXb8 kKpBkxYWjtaophtYle5QIMqZ7SGxh0wVQILMRON/D+Z6xzfMAhv99YcMZNVNTkn1xSpd 58QqoDnWUwXGMvNnHytv0gzPI/poTJ4yskVKxlZiUHhA7iq36Q+0krHmcaTbF3kIvYoF M1aUP5shiQAsIUxzbFtEWXJBXtTOhE6fYTmyCugB6/60H3+9mJD8nvDiUk4LrB8K/r7+ EPMg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0NlXg86UHyXHALJd4CNrXKqdR3YhnMuvIdL7EfthOjo=; b=NrxRMf0m9LI8VLZQiycQWVyBd256Vo+9F6qshOSbUUM+IrMXGkpVi8kkkeYbER/5gy XEnJ0qSW0BkErBwVf/5hql6agSp86NVSrT0sVFK+knTJp3CBTupNkmPq0gTnz//QL5Pz z0CIOD+H0itoGBT6+5EOfgXDl8wWrwKCudu6YYkEaoQRd/cFgZsXTk2pJtHjHrG6IlOo K7Sxe9BGCPOOrGWXSbS5msqrqPBKdcn5pliRl2z4seSO+00s6T6fQMWlYktejxwUHlbX uyGi6zbXgYWcLm9qd9zg+sJCrnqx+bhGW/JcdTlT9mAL1wAfNiHxzuoZ4MM8JYkgKYwd hkoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EWXTppJc; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pc41-20020a05620a842900b0071afd81d55bsi7916488qkn.536.2023.02.01.16.53.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=EWXTppJc; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpn-0005zA-5m; Wed, 01 Feb 2023 19:52:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNNpl-0005yH-0r for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:13 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpj-0000OW-Dq for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:12 -0500 Received: by mail-pl1-x633.google.com with SMTP id d3so270874plr.10 for ; Wed, 01 Feb 2023 16:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0NlXg86UHyXHALJd4CNrXKqdR3YhnMuvIdL7EfthOjo=; b=EWXTppJcRBEzev53O9g0l9etB9YMbLO90jmFC1wOnQqMkq0TgXVsPun8yhL2UUAuzo hWQYGxTtNSHpQ1iF4HrKNaIh22ie1ug4E+lEWt3mlv6eq1xWNKGlfZMqcWG/znC1ws1v ULTtODWbHfGq9YJEIFwIaquk9HV5sGLae4ceQaeam5paDnYjq+1zrkzow1UnhofBNQr6 JoEMZj9c+sJA801DRktJXk8ERjA75Wuv8NZ0xRIlIFep2HnDTma6uiPKAIwLcHq9WNbr U8aobKq+M32DTVyRKAQNPPlIQCWPzoIbBCxF0JRFlFwIlVYzupv2Ku5YzjdNsSvu3An7 Ph1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0NlXg86UHyXHALJd4CNrXKqdR3YhnMuvIdL7EfthOjo=; b=kpTGK4dDLFP1CkdiRPaTggP/WXQevJC4miN18ERsdWPiaCkrNg/isozSEsuNWUWeFq GQhq/rsovDhYO1bcjuhZV7RWD6T/ToMV0QBn7C4ItIHoHjL6rAvSW64zmaThESb4/Xx5 e5+DaPJrhD1IRCPx2uVvuLLGMhkyKLbJ3IBdyXaYq3N4YBg/K722dWccTKs3s5P6OfFf R6PmaBHBTQSUdlApCKL2E9y4gs7dS84F4NOwBC7vYfF096lwEtdbmWqc1BZu4+tDK8KC zEB3OftIh7xw6BGVnufshC2TxOlwVU9jeLwEggs0DIpPmdBl1D6604/jIaSpLgZxR4Vx kP3Q== X-Gm-Message-State: AO0yUKXqpDuOK8lMM6BONo3KS/7X1iWyG7lWzLhkrQw1QrntRlfcNmya HZ193KC7hdsMe+ciyHwK3ERg+aQOGlu3BkWp X-Received: by 2002:a17:903:234f:b0:194:4b98:42c8 with SMTP id c15-20020a170903234f00b001944b9842c8mr5512643plh.28.1675299130093; Wed, 01 Feb 2023 16:52:10 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 01/14] linux-user/sparc: Raise SIGILL for all unhandled software traps Date: Wed, 1 Feb 2023 14:51:51 -1000 Message-Id: <20230202005204.2055899-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 The linux kernel's trap tables vector all unassigned trap numbers to BAD_TRAP, which then raises SIGILL. Reported-by: Ilya Leoshkevich Signed-off-by: Richard Henderson Tested-by: Ilya Leoshkevich --- linux-user/sparc/cpu_loop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 434c90a55f..c120c42278 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -248,6 +248,14 @@ void cpu_loop (CPUSPARCState *env) cpu_exec_step_atomic(cs); break; default: + /* + * Most software trap numbers vector to BAD_TRAP. + * Handle anything not explicitly matched above. + */ + if (trapnr >= TT_TRAP && trapnr <= TT_TRAP + 0x7f) { + force_sig_fault(TARGET_SIGILL, ILL_ILLTRP, env->pc); + break; + } fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr); cpu_dump_state(cs, stderr, 0); exit(EXIT_FAILURE); From patchwork Thu Feb 2 00:51:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649633 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609200pva; Wed, 1 Feb 2023 16:52:46 -0800 (PST) X-Google-Smtp-Source: AK7set9d7M9VKzi6bkkveNfVh83/E59op84P68FP97kEF+dJGBuydEVxuJAP2HsvUGdkcw+VDAwA X-Received: by 2002:ac8:5dcd:0:b0:3b8:5057:3776 with SMTP id e13-20020ac85dcd000000b003b850573776mr8350181qtx.13.1675299166376; Wed, 01 Feb 2023 16:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299166; cv=none; d=google.com; s=arc-20160816; b=rjYmU4RuBogJLOCfy7AYSYGco1gMi86dP32BOFZisxw/P+uALHlcsfcsJshsB3VAPn Mpv4pe/q2IUch35Vnbbi3G0urcgKteB9NSvk+1C2Z3OxHikLFMeHWMXCGGKy7LDM2KHS PIIQm79zzr+LBikWUYCwh2l1R0iQQ/y/VPDWVbIVkVldLOV3nykpE7HkV9d01BDkT8MO lqbpzTJHwVZ1uebG2Wm47gBV+YlPvzMiRBrf+wBYiTlqeUALKq5+ffYAvoDfpoSDuEoH 66gi6a50pQ17kF7gHgibZegS7gZjJr0LyZXXVexdxoJd1W5EkcD/aKhzPa/cbuz3bg0V hU+w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UYdAcIsSiQ4fxqXbfF/P4rINlyMeoGQOg1RWsaI41p8=; b=RQxR8U2mHaK3zO+4moGSMlWG14VJw8Wi3UJGekaX3bAnFIvR2GZ2FLfRV4Uuky7BEs KflBqGSanTG0/xTAVstDoP0TS1t2qjSmuxqK46sQKraZkViGGTZj8ZIsKC8fFqwA/zVx DE3NOCD2N/D19PBRnbrpwg4zAhY9dIJ7r5D1td5QgWdAWiIQLHQw4U/H7t0DCZJEG0+U YJ4Y8pttBT+luAVIoW0wtosiyg1Pbi408YnZa0jvEdCGzqHRhn3nTNZ27yD46WFtw0mV Tmhg+9TxO99GlxBf3qwrTdYXrm/sNvj43lZzHbHDekFwMtP9H3ANxrf2/EapeKa5Vyln nPmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uyY+/2XZ"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e10-20020a05622a110a00b003b9b1ebad56si3921357qty.669.2023.02.01.16.52.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:52:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b="uyY+/2XZ"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpo-0005zF-7T; Wed, 01 Feb 2023 19:52:16 -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 1pNNpm-0005yh-GA for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:14 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpk-0000Of-Uy for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:14 -0500 Received: by mail-pl1-x631.google.com with SMTP id 5so299729plo.3 for ; Wed, 01 Feb 2023 16:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UYdAcIsSiQ4fxqXbfF/P4rINlyMeoGQOg1RWsaI41p8=; b=uyY+/2XZp4/KHzW5RN7FPJQIrALQ5pJtmKV0bkdjHShkzGaevux5XDjBFcWtP/QdCU aRaq52nXrRjeHLp3OH6pX65ZdwhoLn+IMl8ho7BuWxAT8YcRp1hKOYGamQKwtouu8C3h DNVknC8KJkGxTR6mBZjAh7FjbBi5gc9+NhS70GNqerr7qdOK9p+hOvO6DZUlnr4Zqt4W wgOXZG+ATsp9VOqQ7rnur+fvCQhckeDek1ICpu7Tr790bodshP/8bhxKXvXHrxX0f26M I7wU/6QDfQqNbZyYLYzRbjZeOUS6+mJXtDxIV7t9OJv2HxZZSBIBlxtGFPCcFMMvrcVG PO0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UYdAcIsSiQ4fxqXbfF/P4rINlyMeoGQOg1RWsaI41p8=; b=D4q4RDwcJSjPi2NKQuasd2d7Ctl9E5WmytRWlURx3UOyie1ekwJS2zzu5nYFjZDwUu yduG+E8Z1XetOAztiS5xeW32qRg4Lp3mMRLzQC8xnXzaXURubRKm0dBZ+dSwM3GnJu/7 +LwmEBEyyE7lfqY+MP/cgd3tus06JAZY7w9i+wEbFsqkW4BRxAJAGMEAeM88emIhY/wZ XcjfkTQSiDB9q7Vc3SsuBTSO8tvsLuQ1fnpkIFkPcMA1VO3BoyNnG/lR3jXs+dQqb4MP 8mXIiVfKyiWPZjj8gxnqj03W+MzYhtGQMyzYM17S7uRaPTDeW7uWCRssfvW+yxz+5HVa l3Ag== X-Gm-Message-State: AO0yUKWJt80jHTQO85yycZJXIcoOTqPPAWvc2/vvhpC2Ms+4KTnjKto1 Wgk3o5q4YGIaxer9YQTo/dPjPgKQHpkPBDpL X-Received: by 2002:a17:902:d2c9:b0:198:b284:c2f4 with SMTP id n9-20020a170902d2c900b00198b284c2f4mr4288696plc.61.1675299131699; Wed, 01 Feb 2023 16:52:11 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 02/14] linux-user/sparc: Tidy syscall trap Date: Wed, 1 Feb 2023 14:51:52 -1000 Message-Id: <20230202005204.2055899-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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, as also seen in the adjacent code. We do not implement multiple abis, so treat this as !defined(CONFIG_COMPAT), which vectors this case to BTRAP. This was presumably a typo for 0x111, which is the "old" linux64 syscall number. Both old and new linux64 syscalls traps vector to LINUX_64BIT_SYSCALL_TRAP. Signed-off-by: Richard Henderson --- linux-user/sparc/cpu_loop.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index c120c42278..18d5c24af1 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -167,12 +167,11 @@ void cpu_loop (CPUSPARCState *env) } switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x88: - case 0x90: +#ifdef TARGET_SPARC64 + case TT_TRAP + 0x11: /* tl0_oldlinux64 */ + case TT_TRAP + 0x6d: /* tl0_linux64 */ #else - case 0x110: - case 0x16d: + case TT_TRAP + 0x10: /* t_linux */ #endif ret = do_syscall (env, env->gregs[1], env->regwptr[0], env->regwptr[1], From patchwork Thu Feb 2 00:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649646 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609697pva; Wed, 1 Feb 2023 16:54:18 -0800 (PST) X-Google-Smtp-Source: AK7set9GOyFYnrn00KRXkTs5+joQTCpYEEFm/9EzFDmcp91cZPwTNtElMMQfr/f2qZznzXD7Fs5P X-Received: by 2002:ac8:4e47:0:b0:3b9:b817:e9a8 with SMTP id e7-20020ac84e47000000b003b9b817e9a8mr8329278qtw.27.1675299258500; Wed, 01 Feb 2023 16:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299258; cv=none; d=google.com; s=arc-20160816; b=Or6ocNjaaMnEPRHgfD+hzYX9VSMJPbzP8DcjiucWl75oGg8F0py3x3QWZ29GOGuq74 xZtMsb6T8Lo9ic/KtZrZ/z+xPGUUwoHdc6fetia2DqqMuvYP9ytl0Pk7tS9xOQPyj9cz irpetK+r4vreEg7C9pJDZ5sNQZN/vrXToH4XYPXvy4ytV6odsiaOnOcravqiTOxjwXTo ypYVdEkWeQPEGgksvExTkZpkpSTq8Ts0OYpfr3tNrSZrHqKUw5AOBEusioWOUJux5y7w MW08Qaeue4WN6mAK7sJd+jIH+zwdk2ib7euaIHotwa+qKpNsYKtiDEH4YryPPmuuazjv +Gdw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JZR6v1mutzuyGZ2hYhsQ0hkbJ/my9Uu96+Z1L/w+T3g=; b=k6Ats8nWbo27dmh3BFvJLyGDWfGq00iEkdjlJKzn6gB1nBvwpXSFQ96KLjmTYVI3hj b5lBDtvwwhWwW+uSbyxpGCd/UIM9E8Os37Mmn16GFGA/CmlEjTSmoJXRqvDHtjkVwxS6 Rk9iPTZHHgRNxwO1ztmjHgZewGkc5U8+5CUo+ORLpWYDhEyBhNI+E+TJueeTP6qG2gJi eTIWl7tPw5XwMgiXDVCY5j5erefl4ErnTD51yvRdC3/ml6ZLRLZaqRtlBkW+WbYnp5Kw xDhWYEPB5tKVQCGaRtQopcVRKXsnsvkuyxGKu2jbctagav0Pkv7jPFn54q4EiniYX2Y5 +xUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=veDlFeYB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q20-20020a05622a04d400b003b6953fbb9asi11673628qtx.348.2023.02.01.16.54.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=veDlFeYB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpq-0005zZ-6m; Wed, 01 Feb 2023 19:52:18 -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 1pNNpo-0005zQ-Fc for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:16 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpn-0000Ov-09 for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:16 -0500 Received: by mail-pl1-x630.google.com with SMTP id r8so304890pls.2 for ; Wed, 01 Feb 2023 16:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JZR6v1mutzuyGZ2hYhsQ0hkbJ/my9Uu96+Z1L/w+T3g=; b=veDlFeYBi1ccUlByKu9vxh9AcIEoYIbOME+Toqr+rMi1sjlIa0F+TbQSzJEUOsIszc myulYZAdmGljYQQLxvAZVlDuyShie7fHdqDdgjkvsKk6liUkoB3LkxC1hMM0bOgutAzc EOvWyzh1QamwS4fnKqn31AmW/zPn8+BYXLm4sQZp9zKVaFO74UOwGJzlrCk10zSSpitE 7vZ74MoSQunBnTIipn2Yd4lNddfTjLTIw7kBJjTYs1hvgwkgQ6Dnr+SrWMj91B9uA/wy yel21H/OEldnE9VrT9ptamANJA1SnW344jHqZp7qK0RM+WgP6EGw2WyDEbj0v2BauPAF rAQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JZR6v1mutzuyGZ2hYhsQ0hkbJ/my9Uu96+Z1L/w+T3g=; b=i5G/OK/VRp9nmtpYEPBNNyGJ2HJd6F5YNcfYg0DwjGBnK+Jn3VyRNRzkHmAZxEPh03 0h2ZxFjbL1/ZR5gRG4kRbfXcL84PYQ2bNbFUOyKPTrztM/+I03I6joYRXLrM+zGTFWLA dDRHg4WeJ9HPM9q+/gdhflU69V62ydiKtuCNLjmauhlJn3nxl7/quDfQGGwY7Ub95wI9 +1KFCgsTByjQlZJJoXiiw++Al4F9e7BchcJHsngD1H1J6fL2v0bRJuO5NMIf2fJNkaFa NPhLupc88dwkyU9fCOvitHwB//8HSkiuBPTrqk0e+h1mC6fTJkTP6uhvyL7cc5azFd5O UVSg== X-Gm-Message-State: AO0yUKW1aj20jifyFYLlE+acepoJjITqwHBkfH/bR02ZZ9tAs0e6mBPM Qlx/tDbXpbH4xzhlddJxD2C6dsOEt9cow5oW X-Received: by 2002:a17:902:c992:b0:198:9597:9934 with SMTP id g18-20020a170902c99200b0019895979934mr3488470plc.68.1675299133733; Wed, 01 Feb 2023 16:52:13 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 03/14] linux-user/sparc: Use TT_TRAP for flush windows Date: Wed, 1 Feb 2023 14:51:53 -1000 Message-Id: <20230202005204.2055899-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 The v9 and pre-v9 code can be unified with this macro. Signed-off-by: Richard Henderson --- 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 18d5c24af1..a94bffc583 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -200,15 +200,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 Thu Feb 2 00:51:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649640 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609591pva; Wed, 1 Feb 2023 16:53:59 -0800 (PST) X-Google-Smtp-Source: AK7set+U3riGvtcK96CTxP/fPw1P7cmvFVpchio/IXYPE5H4eygg+v1mRh+KCTxJ43fMP6HKx0As X-Received: by 2002:a0c:b284:0:b0:557:a5c5:7dfd with SMTP id r4-20020a0cb284000000b00557a5c57dfdmr684620qve.21.1675299238860; Wed, 01 Feb 2023 16:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299238; cv=none; d=google.com; s=arc-20160816; b=JN/fkl+dnFgAytkXxG4jflIM31J3thUExFDCEIiikfPFitWp6qdW+u4HGkRrxMOTaG Q/fGJB7SaLp6jnC8Jipis3oBWqxDNotm6UwCLyfJE2HNeiqS6zCLOL9beb1j8IOXrKtH uEeiF0RO5N+pZhO/LrUzFYBrH3EROCnmx3IrcAaRNwU3879sF8S3pSKiw0WbwvoZ5m+5 f4P3HhW5RWrO4d6+y4JlywUbcFf+MhJGDyXPScs85Gs9aRgwNBKAC+35cEHrSHbZSfkq Z4/94NeBhbodzO+A4+BFV7wpMFRJA2V/1FKWGRpjhnrsZXK9czgmMObORtBjVL/Iha+1 yoKw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=89UUaeY0rrKedYNMf8jAgL7z2598RbZiMA1VfAZ8r+I=; b=zpkkDdXjLyyg90nAj4vs3DfSDy1DU80z9vkFfjY/kN1v2w8pNvbjnkAKGPxKT7ba/F iGfEJnIspprw75+mc8mQfZDWIKtF0SQOfa9PZZJAfErT4CE6AVOe+kvq+Mh7lRwJ5Oyl dU3cAqW5WiUwNVraisGMhYLYeXRxGgfqfw41ktfW3b0sZ5lk9AoSpqACMlAQQJZm2F5q 8WtuyXhFqDrCddcHXkqh+R76sRcGNsWew3h+UCYcZyQasEC9OmYONulTVcz47QUKr5e6 FcRcQ77Zca4VFDu2iJ+bHCaDkHTqYaFgwbhPz+JnUHIk+eR6dP2b0A73WzCFrz5+EFeY u4xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3AqVJa3; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b37-20020a05620a272500b0071949756240si9313985qkp.615.2023.02.01.16.53.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3AqVJa3; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpr-000606-PP; Wed, 01 Feb 2023 19:52:19 -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 1pNNpq-0005zg-DG for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:18 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpo-0000P6-LD for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:18 -0500 Received: by mail-pj1-x102a.google.com with SMTP id e8-20020a17090a9a8800b0022c387f0f93so4033194pjp.3 for ; Wed, 01 Feb 2023 16:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=89UUaeY0rrKedYNMf8jAgL7z2598RbZiMA1VfAZ8r+I=; b=W3AqVJa3EyhuH3IiE4Dlqu974rTnJiX4yKGX0JHI4gR/0avYMUrBJMBATPaCV9BBkM NEs85dsBrMI0vZfqoydIm6LzjO0tc1gRFlQMNjQjL96pLI57BG9zArMrOXtroKxvG5pj NK/5LGguZ68N4iYf2gF/r+ofwYhEzfJAJBjgwJXij7lIobHAeKcB86PL1MRTVkqSL+zd aadKLm2fraR+COmnYH3Z/K1GKYN+pNvHPh5Bj7g+dJK+t0lgudrqe0+5SZRSRbpmsIVf 49/7YWS6g3NwxmhuBPwG1sM0nb1AU9JiSopYSeRAdUxznTlR/p6/nWGp9Bb5OeSdcxQV Vu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=89UUaeY0rrKedYNMf8jAgL7z2598RbZiMA1VfAZ8r+I=; b=yf+egGH8X2jnsXqto/8Jc5qErNouyhV+phcjctkbAdNeSrODYc/nItNVspsmPTmErt Q2tcZS4kI0f20qNKyERldYVr4JKC7yKDXr4IgwxjrMzb3m5a/8WTQ44TVi2hwBrZ+jFF beN92O0AUdOA7n2ICUWCpWSoHTLkeVVDCqyiEcwiFRubagw3biZfGRKLuPv8NjUf244W YmEKMGjznfbr5aCQka3meGQt1XyS/LNlddtItCx6GF6UNVvpN3EOMJZwiwVlyxT5X7Et FgzOXw0NHokr/32rNdmQBUGCZRXq49jotLOtv4+HW/BlWn/Qpj+TwIlvL9NRpwiBwQg5 cxwA== X-Gm-Message-State: AO0yUKVgS2lny8mnzpK6nsV7Aedi5W32DRbCpVVdRGGsq4/P8sDXIUM7 wgXObHNVOdUiRXLk1P/IikmjpYid9YaSz8u0 X-Received: by 2002:a17:903:283:b0:198:96d2:9181 with SMTP id j3-20020a170903028300b0019896d29181mr544014plr.56.1675299135348; Wed, 01 Feb 2023 16:52:15 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 04/14] linux-user/sparc: Tidy window spill/fill traps Date: Wed, 1 Feb 2023 14:51:54 -1000 Message-Id: <20230202005204.2055899-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 Add some macros to localize the hw difference between v9 and pre-v9. Signed-off-by: Richard Henderson --- 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 a94bffc583..efc0fa64d5 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -149,6 +149,15 @@ static void flush_windows(CPUSPARCState *env) #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); @@ -208,20 +217,14 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; -#ifndef TARGET_SPARC64 - case TT_WIN_OVF: /* window overflow */ + case TARGET_TT_SPILL: /* window overflow */ save_window(env); break; - case TT_WIN_UNF: /* window underflow */ - restore_window(env); - break; -#else - case 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 Thu Feb 2 00:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649639 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609588pva; Wed, 1 Feb 2023 16:53:58 -0800 (PST) X-Google-Smtp-Source: AK7set8GsytI/iGHh6bBd30GizBC3cKWxwYIRir9yF+1/ImsUAvDEtk0r9E4WUbkT0Nj/Nlj7C1z X-Received: by 2002:ac8:5f52:0:b0:3b9:bdb0:7aa1 with SMTP id y18-20020ac85f52000000b003b9bdb07aa1mr5648910qta.41.1675299238461; Wed, 01 Feb 2023 16:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299238; cv=none; d=google.com; s=arc-20160816; b=Ne9zLsZHgo9GIroL4bmBvHNlPTCNOouverejUYzJ9hJZHOt+0laZRQjzyh8R2dwYPQ gF05X8Qrt3uxTAE7vM48xnCF8p20751a95cb8mOx0EOEWPFRM+pNCidhb8OnM2U8H3fF zkVW7EXb2+dSfvD2cZ3u+1MDlfAbP5a6aZ3myjVGWJCn6ZrU4GfzLefUHr7NFB+R26sz al4kJvJRC0oott1dW/9IDPFdODfLW5cowQFbd/VSvLbE8Y60WIjEoghsY5eUxKvM90Ob FdPtSt3sxVRDSmHB95DMq8DEGAZ4ENqaMWjvj0LqW05xt4RZL+et9E2QvP+DA9/SM0iD kIqQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ow3wENU3re+t6rHOFJyfUAaWZx2l8P7stWpbA0l+Q3A=; b=DBNsZn4e5qFSsL0BDM++7zjK395Vh/tRitLWDOAlisKfHdPO4zq0NrW/b5GOVAECMR eLsn0sCiXfvz/RSb15TPcSUHaBLU0kYiU3xNgZMjUK97JyfGzTIVHsIQdOwE5z4Ex9rz OhqZ5+bP2SkY1BSMTqmsduADUkwKEBj4PujMAYg+zHyDx07ioVnDX20seCj6nkorzQls KQGlaA/WS2vEM6gCHfMG1bWCLudTR8oYrareRXqMywPA2IMpn8FNCvh9R3BbHM8tnSMm OrH8L+22fJXNwVfWqNjAiarLfa7mZP3kmjTTX7mG9lOMfxa/iFphe0OaBi2oqypXCeE8 UTZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jfy1TUH5; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m8-20020a05622a054800b003adad7a9d50si11590775qtx.628.2023.02.01.16.53.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jfy1TUH5; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpt-00060Y-4X; Wed, 01 Feb 2023 19:52:21 -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 1pNNps-00060M-1U for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:20 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpq-0000PX-El for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:19 -0500 Received: by mail-pl1-x632.google.com with SMTP id b5so290393plz.5 for ; Wed, 01 Feb 2023 16:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ow3wENU3re+t6rHOFJyfUAaWZx2l8P7stWpbA0l+Q3A=; b=Jfy1TUH59hfVsGM0a86hOYcoJ9r2E8fayGJ8ciLiC0bSynywWBW7CKoT1kdtwtop6g HtmDD+6GieiLU+7XbxSy/gTsWamrK3y4S8J0MtqmhRaZmKQKEq6m3aN1RCZNTfjruRS7 P3QvhhL2199nJg30M4TlfGe0oNxDDkytPkvik1/YQGSrQG3a3zxBwgYiiheipt65FPVt e6XyuDTp2yLLbRUOOb4B9ltUj292oxerOIJXeOtLOCuiYlCUHyyxPbYouAyxTX2dsEiH jtPt5djjIuXBQ4YxcNPHBoTDzY4rnsPxVA4D4zkWsGbJBZoJxMaGJBmuYgD3cCaBrxPE rHrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ow3wENU3re+t6rHOFJyfUAaWZx2l8P7stWpbA0l+Q3A=; b=uampcCPUHarP+oK15GCqpwOlcQqYDTRYepGiVoNbJ1qB52Jw2V/7CmB8bh/lwtzlwv O1u8kaKin3ifqKbZve8nFQkcCx9ttxSFdY0iF1lQrCcDGmk80UWVyaNfcwbfweez0Fx1 nIODLOm36jwiJ7Fp+8wEOkKuL43bvRdyv49ADxdBDGQQQocww9mDRedIG5g5vonftzkB TChMl4p/t7O0T0NIWN5yQ4goetNZ0WFg35rW+15H7NOuQ5Tmz6onJYi+hm0Nw8ZeJ1Km 72s8apT04WTq2HSstpD/9yFRQIwJpSNLOPd2a2VeGTxP7Vmm05QK7ZrpLFzuYnLxZ/zP NaXQ== X-Gm-Message-State: AO0yUKWKE8FP6T/gnTzJVv/+wLDN32AZiAKwwDAEZ81PlNk2g841Gu5R gbzcHKgXxSwmR2xjJ7eJua+Pse+3PJwZI+QV X-Received: by 2002:a17:902:f252:b0:196:768a:a9ae with SMTP id j18-20020a170902f25200b00196768aa9aemr3396299plc.47.1675299137019; Wed, 01 Feb 2023 16:52:17 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 05/14] linux-user/sparc: Fix sparc64_{get,set}_context traps Date: Wed, 1 Feb 2023 14:51:55 -1000 Message-Id: <20230202005204.2055899-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- linux-user/sparc/cpu_loop.c | 23 +++++++++++------------ linux-user/sparc/signal.c | 36 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index efc0fa64d5..493845fe76 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -217,6 +217,17 @@ void cpu_loop (CPUSPARCState *env) env->npc = env->npc + 4; break; +#ifdef TARGET_SPARC64 + case TT_TRAP + 0x6e: + flush_windows(env); + sparc64_get_context(env); + break; + case TT_TRAP + 0x6f: + flush_windows(env); + sparc64_set_context(env); + break; +#endif + case TARGET_TT_SPILL: /* window overflow */ save_window(env); break; @@ -224,18 +235,6 @@ void cpu_loop (CPUSPARCState *env) restore_window(env); break; -#ifdef TARGET_SPARC64 -#ifndef TARGET_ABI32 - case 0x16e: - flush_windows(env); - sparc64_get_context(env); - break; - case 0x16f: - flush_windows(env); - sparc64_set_context(env); - break; -#endif -#endif 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 b501750fe0..2be9000b9e 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 Thu Feb 2 00:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649636 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609438pva; Wed, 1 Feb 2023 16:53:27 -0800 (PST) X-Google-Smtp-Source: AK7set9ISQiR1Qef5E3HLhdbaeMyc2cAIqYp3HHwQmIKM6RdiML/LPUXwjnGBwQ4y/gyMd8Gn2Us X-Received: by 2002:a05:622a:413:b0:3b8:6ae9:b10d with SMTP id n19-20020a05622a041300b003b86ae9b10dmr8545581qtx.2.1675299207669; Wed, 01 Feb 2023 16:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299207; cv=none; d=google.com; s=arc-20160816; b=bUlWJYUUlPBD/3Tm2/Pn4dQWDxr9bIKKerBwARt9vXwc8poDLDCp2irwV6VW4HQA3T fzgm5bwjkmZPLcw9gchicKRpxCG3oe+lrkeEVdesXFsq2VC0yO2/ExAnXHKn/wx/v2dP wb5SZvSJgv+o8CbmcTn4uBtZttvDph4fYpuNcvygh7+3KhBFjiwrlMqRvmLqdt0Blby8 aSfShZ6tKVvgUl4Qo3lDuk47CXpkcUmQSAbBK4/hjfR1KrLrMnT3TMSMzqyTLAnF1hg9 dlCmC+YG1WlGIqJIaX35oPdKjp9BDqi2Zdh251qAA+9XbsQfeH5jYNKSeMqKitR9tS60 a3qw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OkmjatRg9OxEuhuzHdWmE9IfcduIdOzoC0jbgvrF6fo=; b=VYNXe7Qulkn8jmWyLmRqRjsDSxkx9QrJzk7MgNSPfAj0lL15hg88ojPGfbG3tSpacb ESn/kfTuClgTCwr47so9cR9qxRb0iqnQPPRUNQBzk1O8TsUcRwWFm8Gwj9vdBpoP2L9b uuKgqB9PLyWpFR/ejx5yKp0U2Y4aW3xaCTHSRQnW4BDXxhuMoUZpAZ4cIxTkEcHposyb Lrs5W9fjiF8EtLQOqciYh1K6qt1Br34Afvob0ONTROK+E0eNvNvwjEEkR629hHKz/eNj Lmp2wkLTH2kjUdqKWfQGvGE0YRO42leZ/mWqY1ImnEB7DhwD2pzXS1VoVzzX7/kFP9RS wf4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g5tcX4sa; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q8-20020a05622a04c800b003ab73b7bb06si10524566qtx.488.2023.02.01.16.53.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:27 -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; dkim=pass header.i=@linaro.org header.s=google header.b=g5tcX4sa; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpu-00060u-OG; Wed, 01 Feb 2023 19:52:22 -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 1pNNpt-00060l-HJ for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:21 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNps-0000Pm-0u for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:21 -0500 Received: by mail-pl1-x62b.google.com with SMTP id k13so334741plg.0 for ; Wed, 01 Feb 2023 16:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OkmjatRg9OxEuhuzHdWmE9IfcduIdOzoC0jbgvrF6fo=; b=g5tcX4sa0d+dYrQOiHYR+5f7vmbqAYswxTthUtFvnGB04HGmSKVLI3Oh0kxiU9rJJL GC0yQV1+ADE/zHLDTynR12H7MAYyakK/7bqfRIPyReFwZKN6fAj8N28dJgMlfGSwBruL h33Z0dzrZ0P9c8aTFPYfMGwJYdgWT/hg/DVFQMJFr6VG3kBCGPB+GFEsMCi/vkMdeRCt gd5bQhkVmcW/dgq1pJ8gd4pmXshf8R6/7/uTmOCRyvrW5d2I7jIWkeFuWBBBAht6f5fR tO2biHiHmPtL7LvxlnGc/OrEA5vCLxMT2NeS5C6b3bfVQG5WIKvUr6yc/bcCKuCquKPV jQUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OkmjatRg9OxEuhuzHdWmE9IfcduIdOzoC0jbgvrF6fo=; b=LmwFJeQRfOLQX/VqsZwy32TsxBidK3UKV7I3gomptxa9R3SX5PG3TleVT6Y4acFtl4 m90S7Jmc/RaTKZLLoM4RPJk9ofHTfBqNecJM+0FtgpNhiTvnlRA/D0GmmyOcGkuo5mma JS0RkrCZwTrHhhatlM9AqepU6YeY6XABjIOL2K6rj6BFPJrvlSUZq7CPctICvq3rZH56 tqsAvKSMfUc7BFzqrR9TzMVr2BZgQmpJbiRBQMEM947q3p5E+TeSktLuSSrMg9j4Nk1B vMaOddeUIaZYtyjS5vqg6Re3jVKYEizpTQPTQWqKrmItyd/lBoGFOWD7He4xoqFrobR3 HS0g== X-Gm-Message-State: AO0yUKVwrLXrmWvNqO7o2CoGAYXEVeNQJTWNDMCBeQfEXPa73Wce17ie a+mkzxmEebx1Qs/Wet+DcNC4qiVg4cmok6cP X-Received: by 2002:a17:902:cf08:b0:194:a6e0:3ba with SMTP id i8-20020a170902cf0800b00194a6e003bamr4933377plg.54.1675299138665; Wed, 01 Feb 2023 16:52:18 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 06/14] linux-user/sparc: Handle software breakpoint trap Date: Wed, 1 Feb 2023 14:51:56 -1000 Message-Id: <20230202005204.2055899-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 This is 'ta 1' for both v9 and pre-v9. Signed-off-by: Richard Henderson --- 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 493845fe76..573d97c60b 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -210,6 +210,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 */ @@ -241,9 +246,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 Thu Feb 2 00:51:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649643 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609686pva; Wed, 1 Feb 2023 16:54:16 -0800 (PST) X-Google-Smtp-Source: AK7set/fMV+DLSKg5IMsQXT3b1SGHgeQxhw60+MrOJ3IT0vyXxqK1CxdFrX8opE4ME60qaM4yRju X-Received: by 2002:a05:622a:14c9:b0:3b8:b14a:59f3 with SMTP id u9-20020a05622a14c900b003b8b14a59f3mr1093192qtx.63.1675299256093; Wed, 01 Feb 2023 16:54:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299256; cv=none; d=google.com; s=arc-20160816; b=qNTilTyaj/yezirA/LaqlByo/WlHofwqdeWN4w2zxRT+S1OsmbNSmfe6J6spO7RrkR NOlCevsmw0km6wG/9DQeHVarufYzmNPtMu4f1tR+3ukL8CQN4SMMTyNCwy1OYt/ru1Zr /mG83o1D3GYnyuJQFuInigcn+CI3weFXq9qWv3W25Dq4F/keaz6KMz85ucME3w/ZO0po wLgUv5AxS5pDd3MvNk1Pj/8nNfqUnLx9tXw2KI6jgGDbhs1k00aG8iyu9796wTtTOLK2 GwatPVN6U4ZXmdV/8Nzj9inkdMuKfA9optd6Mvb8uxyfTjuVIaWR/GuWh4y65rCvpCiA xL4Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B4jgsV9G6+y0a5q4tkqKuMYyQTrPsge9HTujb3pFb78=; b=Z4PMXPj1JPhPWQWttD3LknzO2VXNgx58X13R64ELn4eX9S59WVvlJr5vXqVkbA8JUk bukb5QpYaBAdw5wQKPrDtNfeDOnzMYke5vnCm+jKPXEARBhzIL6pdJR2wruJcvSTXLM9 2Z6xpqE+Vl9G3CjD1t6+rI77bzF6FxRxdb9snhkXGo9F+bt+mXFDpGikFaMhKOwY6S4Z vp/KQICMPSCnKEhmPdT+aGpiOEF0pKdpnQ1+0F3MYuKpnihx+RR0MuOGR3+4mkEbxMJ1 ihk9PACCR6ciZXhbDKXrEnlvo/Xg68czHmD9XX08kP1EFs4ivqIQB011Dt/G2vIfTXxi SelA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oyGat0RZ; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e17-20020ac85dd1000000b003b6a1b09eacsi11221621qtx.659.2023.02.01.16.54.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54: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; dkim=pass header.i=@linaro.org header.s=google header.b=oyGat0RZ; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpv-00061J-UG; Wed, 01 Feb 2023 19:52:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNNpv-00060v-8g for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:23 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpt-0000Q5-Lm for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:22 -0500 Received: by mail-pj1-x102e.google.com with SMTP id cq16-20020a17090af99000b0022c9791ac39so4035515pjb.4 for ; Wed, 01 Feb 2023 16:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B4jgsV9G6+y0a5q4tkqKuMYyQTrPsge9HTujb3pFb78=; b=oyGat0RZYbBMgrafQwlMAk+EzPaep1cTa3gPHJNzSfJ143bzHIbQerH1v2bzSETwI4 p15LNFW/A67VSelmLiN9M5Tbdbu3Pbd2tTGTb+8xCNOHsZTzXls0bnLEYnjhyoFcbR9m X0bOK4jHZjzjQhL2PVtI9nT5BdXviyG3xP0IvVD+EuiEpeoQozYANfgnqKjLwjCbPkNZ TsXailbg/lcPWOjDf2XiJ4rAHrd3qNT8cEp06zPDXI7QzMW3QCxdmK2Rv29nIPgu60tW GvclfVt9EdZCf1OfLbApH9lS7YKTxHxeafepixGv9FFwRgN7fyvogvTsHWLGwEIt+jDw 7Q6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B4jgsV9G6+y0a5q4tkqKuMYyQTrPsge9HTujb3pFb78=; b=kYLAKLuagXWDOfBk3347RF8gf+zyOmxmIQN0m3cQ1zKxZ6/hNLB6wNr0/yZwboBkOY hIqoj3YaPnTPlSFwtF/qo5VSG/Uk4us3Y2i6J4B09UDC3zrEpuSaaQB97wViFEd3BeOQ SAX49XJit1l15roB8kc8W3zWWp/irayPGkuYBR6ymXKh0LzvD537EjxwvHGUAaLfInCz gNu6+aXfqM8sPxAIhxeHphC11wKLyDIIP0E9jC7amnaKMx+cIG3j8eBm8QRIydvPeSsS Yo4Fmd93a3kQhiuVIc4WFwL7ZFX3BiZ7QiwC3Bryby4yiGc4mZpUKNKe7012gLtQ9/l3 ZPHA== X-Gm-Message-State: AO0yUKWYXU/6qZQKK40J8bWY5rTsEcxo3VZjjlOd/tsYrUOMfM7aAcU5 omM7hfBEi9qpJOAO28jMbYz0qpGV5WSjNSXF X-Received: by 2002:a17:902:ea0a:b0:196:b66:eb74 with SMTP id s10-20020a170902ea0a00b001960b66eb74mr641603plg.57.1675299140441; Wed, 01 Feb 2023 16:52:20 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 07/14] linux-user/sparc: Handle division by zero traps Date: Wed, 1 Feb 2023 14:51:57 -1000 Message-Id: <20230202005204.2055899-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- 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 573d97c60b..398418174f 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -215,6 +215,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 Thu Feb 2 00:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649645 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609693pva; Wed, 1 Feb 2023 16:54:18 -0800 (PST) X-Google-Smtp-Source: AK7set9tfL7DF70c+ihm+z8h32WBQ+/T1weaRFjbcyZAd+dXMSOA6FD5adPvuIsZq1nztcAZw4ex X-Received: by 2002:ac8:4e47:0:b0:3b9:b817:e9a8 with SMTP id e7-20020ac84e47000000b003b9b817e9a8mr8329238qtw.27.1675299258019; Wed, 01 Feb 2023 16:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299258; cv=none; d=google.com; s=arc-20160816; b=slgAXOpedHXjdTRW8OEUAet2j7k7CXuTNYGNMwn26/jpZEV3RDMPKRMMGOZ5bAzNcw E/zA9V0KB8tNpa/pSgOnI2IwIa4pathS+bhHrFQCD7u9zMgAL4FIL3S7c/1eZu9TcHUz VVRsl/xyHylHhVdXlYTSB/3RPlVGRLc+I3dJk5TbwnSGF5k80BS8KbRdB4aPglcPufEs L3pQw7Zrddy2wYCBnYhrtpAKSuaUiPXR7qmhnINg7JIYe81mfAwHA99cI0AEa/Q8PD92 I+ABPr7amb8H5OWZzcwFXGIkyZWNab5IFNaChq0OWHg8ukk9vi5kK8JihN6hfmjuggNL AhZg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7p89/1SscirMpmVjsVuG7CRSn1YGBHWjDAFStdyXspc=; b=Fi33QEPw3397f9x2J3+hN1JVNxDrTdZOOhEyDrfRz2E2Snj+F/6Gn9MX4GR64znHnA L2pa4cG0ldlVnATUJv7jtZ8Hie+3rnzqT8PFFthazdfLSL1TafAglsAQc5iQ+6PyQZ/7 Mk/imijME5G7vxxd8iv9DCqVK9DfNx42kmewK7jiPciZILc97oJSnmnrX72jP4/HQpvp syGXVHtH6LXpxZpffvKGZmc/j4z1jynEEyBJjxQ/+LRvM00kmtfcFKIvulM56t2RuPIx CVcBKwIPPbGT8H/+fVvOZsmSfJzWbIvvhCh+CfFMNA8u3Ch5kcunmiV8cov8khDmYBgz Cypw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VeLDJeeF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ea7-20020a05620a488700b006fc2467a95esi890688qkb.337.2023.02.01.16.54.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=VeLDJeeF; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNpy-00067W-H4; Wed, 01 Feb 2023 19:52:26 -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 1pNNpw-00061g-VF for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:24 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpv-0000QM-9O for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:24 -0500 Received: by mail-pl1-x62f.google.com with SMTP id jh15so279372plb.8 for ; Wed, 01 Feb 2023 16:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7p89/1SscirMpmVjsVuG7CRSn1YGBHWjDAFStdyXspc=; b=VeLDJeeFGoovUH+Cmgb7vAgJ4dSqjAn0GL7kb64hFDLz2y9m8IP/fDOjs4s++j1Xkd PrF9IRlht5UUD1RFSuMUtqpht/rzZ9O95nMkLNfVaiiNVuVRJrn80DfP0+Onz03hipPF VbRlPGviaHjvsEe14wtC3RCLHBMT1713+BZ+qMUcZuu/GGeZRHdVLL6YJWDsDtz8uKoM 3Us/us+EsHV+r4z7quIL5TU9t8bu7AkELkmBrk4hudzi+S0pxlWZ4fpBytqJc7s81Gj6 isjcKr3Ga4q/6Vj/KdOJwkW18FKQ8einGYg7cDJOmyPT40dd3dDdHZtMLx7TxN5nNpf8 jS+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7p89/1SscirMpmVjsVuG7CRSn1YGBHWjDAFStdyXspc=; b=1CiNJj/U35XgkeeuP3sNuHqVT4GkI4LHCZCg66EUJhUCtBQFh5/iOikY+g2M1iKltt nlBK8vockEILe616AGW8T5BY/ntNcRXv+DjUfC3UtW5SSH87Qxq8r+OnIOYxQ1a/5hFh Mk5V38bAuXgP72vl0fmEWQlzx++iaGxMe9q9EuKlc3gpynU3fI0qHl/bYixvq1FxHhhP EFo1YH6YpcbWwqKiGZGvDgLKH6R6nadf615TRbSVTr5ZWV3GwQBvPJts7U15Acfces9h PLBEx6/HTbr/qoYo0aZUi/RJtnK+GDlOtas1xPZod+m3aK7Dot3PLrhwhdxEmxIGSCAn 8zmA== X-Gm-Message-State: AO0yUKXk6k9rOPvJG6Le8rTZ9um9RsVG/eYXWvclTcZDhMRGeyKk/rUl IZ5L/5pCmWGjOESPnHzd2WbR3wujkpA4DXKb X-Received: by 2002:a17:903:2342:b0:196:595b:2580 with SMTP id c2-20020a170903234200b00196595b2580mr6019358plh.0.1675299142047; Wed, 01 Feb 2023 16:52:22 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 08/14] linux-user/sparc: Handle getcc, setcc, getpsr traps Date: Wed, 1 Feb 2023 14:51:58 -1000 Message-Id: <20230202005204.2055899-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 These are really only meaningful for sparc32, but they're still present for backward compatibility for sparc64. Signed-off-by: Richard Henderson --- 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 398418174f..370eb4e1a1 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 v9 and pre-v9 hw traps. */ #ifdef TARGET_SPARC64 #define TARGET_TT_SPILL TT_SPILL @@ -222,9 +267,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 Thu Feb 2 00:51:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649638 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609507pva; Wed, 1 Feb 2023 16:53:41 -0800 (PST) X-Google-Smtp-Source: AK7set+xEaTnNSJnOzf8G44LwcpU+oGOceNpmrlfolAJbk66nAdB+pavr0LaFfTh0cnSK48B9eA0 X-Received: by 2002:a05:622a:1003:b0:3b6:309e:dfdb with SMTP id d3-20020a05622a100300b003b6309edfdbmr7882683qte.22.1675299221255; Wed, 01 Feb 2023 16:53:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299221; cv=none; d=google.com; s=arc-20160816; b=MIBN6kwzMuJxkRz06RMnv+bIHOMQUyOHmHwgLCZ5x8EaryoHT6M5peuHHTng0jZIqq eVnXZr78lJppukwfotzUrRC2U5vIOx88VISq/cEqYzF4m7+yJnuYjXL1fG7xk9w9hLOm tbsMvA7otRIebWcMcx6eQsSVyxwdRwwPXD3jyWnARgvE2m2pDz5qIASXkQr7ubVvcEKe GEkUYt9lRwBFhsDzL6wfmuINPQ3DNS0gkYIbg01kO6b4LzJHorzkoICi0FyVllwO3JGJ fkz1T2g2wWAZlLLOtHQcd2VhWP6P0ZNbu82S6k5mKtqN7VdAvAFVs5hZISCC7o7KRpy8 7bqw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uGDFqs4b4PgNASJU8FaMgpzRM7ATeSa1LZg6XuMJWq4=; b=D/dyVshU6fM7D7CCRbauavpclVsjFAb5X/ioNcxwgjUfS1SNUo5olo5TA4o5zTD7jK Y9oznRlJEiuAgPq3hiRRrns4LnnKa+gzfVSS8/vgpJfl5PE5qUICsiNrh7gFP6d7/vBv dwDXqB7pRlTTNcIrESKNjqGNEyYSUuyTx8ElhNZJeLAZMIULnyA7TQZ0w4AJcGFkXXw4 9jk5WGdo51A7jtOu7ZEdWLIEw8VXRJ2Zr6Ssfd/gas09MHDLD0whrqtNuIAB+XnmJZs7 aI1eiu6ziMwAfJdQyT2AodzBYNMEmDv+HuXW9GgPuRZ7EMd6CYmjTIgRQmlQJnbExO/3 Pjbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XgR40jcA; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n10-20020a05622a040a00b003b68e9d252csi1117678qtx.585.2023.02.01.16.53.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=XgR40jcA; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq0-0006BM-Ik; Wed, 01 Feb 2023 19:52:28 -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 1pNNpy-00068l-UG for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:27 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpx-0000Qm-Af for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:26 -0500 Received: by mail-pj1-x1033.google.com with SMTP id j5so413154pjn.5 for ; Wed, 01 Feb 2023 16:52:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uGDFqs4b4PgNASJU8FaMgpzRM7ATeSa1LZg6XuMJWq4=; b=XgR40jcADklJL6xzlRwWYBJvIOmZY1CAbII19wDLzTILhZ3hqpjXdQs6xVKJRBi1ND DAXt7EeAIbNCOMzcxiLzceRBtFrWxbdUNkcJT9pxerFiqS8E/VmU9V413SJM0bnUhKNf ef2SoD/ciAV7GgBX0a797ExWDB5AD41gkNnPrTtW8v+ti/4TehckS8QpI+5JkG8rS5jk O4TQJLgcnNJhEmdMVQ+8Tz/C9GJ/+BqJz0h/b6uyGl7kyrcVSm1G7fFZ7fVYgx478Uac CL2DvRGN9kHwk/+8QTVkdT+fqagmHmcYxpNCzIvEKA+cTwzkvIw7jE3Xv/so+pI11Tj9 PN8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uGDFqs4b4PgNASJU8FaMgpzRM7ATeSa1LZg6XuMJWq4=; b=x6S2MGaCfEMzpB8B4MdHioI8N9kBLrogs6kRdGeoVV/FlvFWS5S+K2so1hwXtOSi9i Fz6MTfidtv4nynju04IjFDaSacG93QH3n1ixdgi1HkSgd61mmA6mXGmnxydcO1zvuYZL e9wVgbj4p9JTEXtm7ghr8qpegNB1iqAWoqmXea6WHQoEmrn2UZy0+d1Et7o9ed676XbA SwPega2v0UxH0C22zGtV29rMidJzfqHpOiALURcW0IGj3jrQaEPArmxO7Psly5Vg5ZGk 1RniIZQhgq5Z33+YqK5LEdR3/6IrEH/U7wdZxSwfev+RLHZygm07swMoob+Z+zI1N34Z Zx0g== X-Gm-Message-State: AO0yUKWlkvpeV9masEt98O+bVTsT6fvPKxHcSe2pdLtjrKnA3y8TWjfN vvMaM+PRsrgpX9gAzu+0/3lEY9d1ZyGQ7pbm X-Received: by 2002:a17:902:e5cb:b0:196:86c2:ee60 with SMTP id u11-20020a170902e5cb00b0019686c2ee60mr6283202plf.15.1675299144131; Wed, 01 Feb 2023 16:52:24 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 09/14] linux-user/sparc: Handle priviledged opcode trap Date: Wed, 1 Feb 2023 14:51:59 -1000 Message-Id: <20230202005204.2055899-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- 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 370eb4e1a1..3af791455f 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -307,6 +307,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 Thu Feb 2 00:52:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649635 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609432pva; Wed, 1 Feb 2023 16:53:27 -0800 (PST) X-Google-Smtp-Source: AK7set/Yn0TouzetMIul7Ks/S5PFy/FMxVvoZ/KUaLyUXRljVn9r9e5jbwofs77HFAJeRIKdwu70 X-Received: by 2002:ac8:5bc1:0:b0:3b8:5aa7:626f with SMTP id b1-20020ac85bc1000000b003b85aa7626fmr7178161qtb.19.1675299206882; Wed, 01 Feb 2023 16:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299206; cv=none; d=google.com; s=arc-20160816; b=Wu7/4IGeBp+LsnrT45R48u5BHo6frezx9oLodg/MdW+eHqdonE/jGC5yTAGvpPGmYR 96nnXOkDbnxQ7y6zZR0ZbfqT0RDFd2LCAwqOs7iRPxE66kHYXsAws9EMMjRK1N94jAWP dWKTo8XYyzIvP5gvfoeGrX778KsO3rODx8ODaf8uUd9chh9KXEZNp4V6t8gHI0rLy5/t itirIDwLcdXpKMeRJtJk/CVZO9JQtCeAw+OXOBoU6P2QMPNS53xlD3bnBzWHCYBVtZ24 ezjTXY2vkMyPSq6RARZLRMReMYWl8QpmeLigPR4mcamDe78CVVVs/Z/ABeJenGd2PFDa 9ntg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8D+STpvePJyIt+1ZL+zvip2U4CwOQ4PGaTgGIJkXneY=; b=e0rwQRrwvRdpeaM/4chkatxy3mOnygjOoPabYUiRGSL6ryoI1cPn46qMo+fxD5cR24 mc8Sc5mSdV9tdndGz2WKstQZwRh/VEFns/mKdsaiQWCoSsNZeyaM9OZPLfG1fBeGMuom BUve7d+y8DK5e9q+bcP+omCtCJdFa2KN4grB/Xb9T9KapOk1OoqIooIGpX3l1psaSJyN JjLz6aicewju+9ociewMgV4m8MbJ9kKvytKR7Io5txlD9lZf5aD3hrrBTzdweTv1+lVN 5dcpQ495w55LdQMOd+FoM4eVW6qn4NGslTkPvFo/nwYs7JEmSWZUOXhX7g2UmF8zvMOX RADg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r2YP/8OD"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e4-20020ac84e44000000b003b80fdd3cdasi10741900qtw.608.2023.02.01.16.53.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53:26 -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; dkim=pass header.i=@linaro.org header.s=google header.b="r2YP/8OD"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq2-0006C2-GZ; Wed, 01 Feb 2023 19:52:30 -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 1pNNq0-0006BV-Rh for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:28 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNpz-0000R1-7D for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:28 -0500 Received: by mail-pj1-x1032.google.com with SMTP id rm7-20020a17090b3ec700b0022c05558d22so292057pjb.5 for ; Wed, 01 Feb 2023 16:52:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8D+STpvePJyIt+1ZL+zvip2U4CwOQ4PGaTgGIJkXneY=; b=r2YP/8ODNxT97xGRNbIYK7Ls/PEsQrKjOfKE5wURY26z2rasXld1CTYy9AHHB2cztc yJgb1D6iwd+M+DCYgjGx2KIq7lyGyLXNW8s9hHcyi/nMXOg0Lt2lk8DBYaLTltsMeuu+ rXLk2ufc+LpO9MdP6l1EEKO2rVp0S9JLGWiCfm+0Ys5iuQOAF+K/VzidGW2w6KzfH+6q 5huJ6AqnPHgGogtSFNThe9eyI5SY6kRfwT1nF/M3F/TFxpPPkAGli0ib6FHyzWOj+LSz rjts5IX5T0AEG2gH3hVTIQBxsdp4w9UyUMTJ6Ba5vPZwCIKP9y9pTq8zK2jbfjcni8q5 BvqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8D+STpvePJyIt+1ZL+zvip2U4CwOQ4PGaTgGIJkXneY=; b=BMfdbSTYihFp7LyVccb5KCQLyNRVaudC1K0BbSdhPjyeGoR3+U9cw2HobckpZ3XlK/ S28RB0cQTJfbXdpoUnBusCfQ41vFhA81RjygRtCvfAgYHkpmce70qwBqUrFHvGvsabJV A6rEza6ENXiSmcPrBN4q7aBox6Ml1l9Ap0IL64RDK4ch2B5vEiSWPUQrE267SYDfKm2E wIdouIJKVnmAwVO+f01OjF3fGKt5xNjJaufYIDeB5r9e5DdqXhV86cECtZ6ksyn6oqcC UaKQeSS3WXSf5njoaDSqLzhXWWoBrNNlZDiK0viVZ64rgxa8VgoaVCPKOKF81hGZMWNV KAHw== X-Gm-Message-State: AO0yUKUGQAezLRgcfZs9obZyxUxBdkPrfhfFzXS4c6+JC1xvePPpebZf h6qNOrbAW5rEEO9s0uF/mMXG5KPIAoPF7rHE X-Received: by 2002:a17:902:d4ce:b0:198:c335:ae95 with SMTP id o14-20020a170902d4ce00b00198c335ae95mr688414plg.0.1675299145934; Wed, 01 Feb 2023 16:52:25 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 10/14] linux-user/sparc: Handle privilidged action trap Date: Wed, 1 Feb 2023 14:52:00 -1000 Message-Id: <20230202005204.2055899-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 This is raised by using an %asi < 0x80 in user-mode. Signed-off-by: Richard Henderson --- 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 3af791455f..42e92ef859 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -310,6 +310,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 Thu Feb 2 00:52:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649642 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609625pva; Wed, 1 Feb 2023 16:54:05 -0800 (PST) X-Google-Smtp-Source: AK7set9N+SKv2/5FlyOBkEKvvuSDrsUtQfXWvYePmGIpvTNQ4BM1X2NaGHV0KBG9FB+7OCurf//l X-Received: by 2002:a05:622a:607:b0:3b8:330c:c966 with SMTP id z7-20020a05622a060700b003b8330cc966mr7020134qta.51.1675299244845; Wed, 01 Feb 2023 16:54:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299244; cv=none; d=google.com; s=arc-20160816; b=K5LwxGOeXicxML9rmbPXrOhSNyFmDvBtVXV/oXom6RIL+Jfnqn+69kF0iatTsJJ8b5 H60JLPgJaEhItI6IdIht6WVSUNfuS7vIXZYh/kJnzJtnGDFoBq19yzxii+Bk8D/ZahV1 42Z2dQA7tZShQvyArMLERqzAxHYGDSa7VuusvtHDI5UchWvP8ofumx0FjRW2oNjqpKVt ILmp/+s7sbUSJMzQOOoMkN6ih4UPmVvN0Cj0rNFrWLIw5LWN93MkiF9hEHJpHHkvdB/U tu8b0YO+CljAA60AhjNuctubIP8uTf3V+yKHFwscKDr4nyqLWGo/9BPasPWLKUcSRly3 tYnw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EFLcl0DGfL7ktN784kj4RpjY2aQN3i68UXxSw9t0+sU=; b=KZjo+bLvAAORbQzpDwczCiky2QUxO8lgDOrjWK3QdHrDRHQkeZJ2SYYVWp+lgWWyKw Vb5H/V6iU7zi/alt519RNOeXxJnYxqegAZrvtBd32VgxVQ2H4PnH7tu2wzqpidtjwA8i eFJcN2BYo4TU4xbwB9ZCkN5k2GbOpJcXBmSa71v3coiTSrDzLkDrUYjc+UyFz+9sn71n yy/U5PWk170t/h3f1Yymc3b3Ml/dc7As/X6h3UaUV3IQAkfJhiNOFB9N2d3XSCb0qKRC ebu7lTUoHi8SqDrU0meVdbFa+kACJcGXVHdMBdUIDd+Ok18H1vT12RH9+gfN8FJTF+Gq dZ+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LTHPaJTo; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m5-20020aed27c5000000b003b86c04d598si5055450qtg.723.2023.02.01.16.54.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LTHPaJTo; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq3-0006Cb-GT; Wed, 01 Feb 2023 19:52:31 -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 1pNNq2-0006Bx-BQ for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:30 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNq0-0000RF-Nm for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:30 -0500 Received: by mail-pj1-x1033.google.com with SMTP id on9-20020a17090b1d0900b002300a96b358so322140pjb.1 for ; Wed, 01 Feb 2023 16:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EFLcl0DGfL7ktN784kj4RpjY2aQN3i68UXxSw9t0+sU=; b=LTHPaJToAbmJ9qdCP0Z43xztt4mj7zGNbTB1iCGdIq1O6me0v0VATYBvHuwHhSa2S5 vpPhr/4K1t2vwmC1Pp4BtoFtyLzsppxSoLTicAETvLdodIzXllZxRS8/+zw9B31ykV8Y zdSCAvnDDK662tj/Fi7QJoIXWCMtWeHHLief98Gz1JuVtrgb/HMB21ruwibRixsh0Iz/ ERtO06aAGZFL4KcbGLZSrHo8728++a+/gPOZIve5iveHEUuivtne+IFm7y5S8qKqtOJH y/STMkAHOpO9kOG0T5s6vXuw4CqNVZhPkBswDVMWpYW27k9zOYG1xObFkmOAdI+P5u4r QnlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EFLcl0DGfL7ktN784kj4RpjY2aQN3i68UXxSw9t0+sU=; b=c5MDi5WuiamBp9U/T+tdIq5lmWJvMlvrX6/yDBDemT/i5zA9CrmjcqF6RZWpdVT+Mo 9q6pwkMQBMC78an2oYPIFSe0hrBWPLfFG6ebctPnJwslfn/X04Q1zLTBQXjW1EI5FjQu OWtkLtrVtravYh5yfZXrCIOX8zYZQJKqmjCwbwovzy+0O/OjajntH7JQKZevwyueGffo G0f3qrC4yVggSMnz1wBmpuF3YBt5K/N0Ym4586+tRM+7jLYnADPbIhXLNzy1ESTtwXPP K/R1zKADYJwTX++qApM+DzdAWOU2Hj/BpR4hd8HKWs1fY6hAF5w76JRcioiB7SUvlryB ri6Q== X-Gm-Message-State: AO0yUKV8khNhKACtjjZySUbrf3lGNiG4TTHemJxlKFSedFSkCKzWwUY2 PyRglETWaAWLA+hAahYi2zOcZP+ll0buywsS X-Received: by 2002:a17:902:c7d2:b0:196:7669:2585 with SMTP id r18-20020a170902c7d200b0019676692585mr3031232pla.57.1675299147519; Wed, 01 Feb 2023 16:52:27 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 11/14] linux-user/sparc: Handle coprocessor disabled trap Date: Wed, 1 Feb 2023 14:52:01 -1000 Message-Id: <20230202005204.2055899-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- 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 42e92ef859..8985d10ba1 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -315,6 +315,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 Thu Feb 2 00:52:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649637 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609447pva; Wed, 1 Feb 2023 16:53:30 -0800 (PST) X-Google-Smtp-Source: AK7set88ShSXnOxTG0OGX0Bc83QCfwP51P2WB9FwxXyDpzoIYAUsbyBlsFjAG0+Otnwqs64uSWdD X-Received: by 2002:a0c:a81a:0:b0:534:fe5d:d145 with SMTP id w26-20020a0ca81a000000b00534fe5dd145mr6376485qva.24.1675299210381; Wed, 01 Feb 2023 16:53:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299210; cv=none; d=google.com; s=arc-20160816; b=p02vCKTiYR/7lMWd0D3QTJuLYxH+r1xI9q52jsuzNG01pqZFVrp/MP+Us6FluuDouQ uinZsjdARLilzM5bna/GtlVmqYdALZP4O02pPpZOyVpIsxXDBVP852CxG0YuEPcLWTke hWrlEpyEFAhdGnxNBN1oOt6g3kD5uMkq8REt24I9uxf1fTJ89OnTj9q5+Y9YykeSIqh8 1laXmQjtbTzmHV2IWgG+ZEDYvXeZyVyhBUSpBlv0JCv4X6HYciuviKpl9LCYrFOMFRKY KIchz35vHpwPU9S2nvN2KA+++11mnC1oRF3TR4QVBaYe5e97lQpcKfTmTsiHEQLD8SrO AWDg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RdzwGHvCCpIE8PYLpMnsIE7Dp6ielJFRJs6AnQClDEk=; b=V18IjPRXSUwFMvx0Hdua+lgnlLo/abteQ3Qhbchwe/sUT+1ofm0r7RMZ+S1CVbMq6C WYJcOctkiLwRH5BwalSW3BiTC8Tspycg82TCs49oD1qmsyvLi2VcttZ0vyft6QKwq8r3 ZXdsbfcABi2HXFqkHMKE1SCXLH8DoSJZok4zU4tjShUex1gaFgJ5uAPgYuIOL9AYozaN P2emn5GiNTb+HzzpEPGxxWPZ5rwDJ5cc/kRIdqIGZSEzY0nzk4IyLFgixDDMe9hti/O/ wW6Qf/pJIl5kbU+aVemVIrleLpxqyqWAvL/TvVCDEMFp5JhgQspRBECoTjEPzd23QDKI nwQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RR3MtTnB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z20-20020a0cf014000000b004acd6af5b16si10723580qvk.435.2023.02.01.16.53.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:53: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; dkim=pass header.i=@linaro.org header.s=google header.b=RR3MtTnB; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq9-0006O7-NY; Wed, 01 Feb 2023 19:52:37 -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 1pNNq7-0006Ig-En for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:35 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNq2-0000RV-CN for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:35 -0500 Received: by mail-pj1-x1033.google.com with SMTP id c10-20020a17090a1d0a00b0022e63a94799so4056274pjd.2 for ; Wed, 01 Feb 2023 16:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RdzwGHvCCpIE8PYLpMnsIE7Dp6ielJFRJs6AnQClDEk=; b=RR3MtTnBkWvPMgTo8VIzSjsbqJRy/ANHq5ju2gmCxPxDrTy81/Wh9G1ku3hJdNZl7Q OMKFVO5N7OpIyHrGnLV5ABfcFYBWCTTlVxYrJSVxVrugfyNBpoLjmyjFYZU3HOlil3Rt Jz1A7lViCZNjJXQ06EBSRRwlnAdfxew1dW4uQFcEWiowVSfeddCYUUNfawDTeQtmk41y 1vQ2zsH1WWGFXSEspjwDwqpMQ8AswFKpw0miUYvOaHZcE4nk26T5PrJaUHBvZN2jJ/wg 1KPO3+o217SVd/8U7DTcG+Su3ECRIdsgKGNuiC/PkAppvzcdQoaPJ54KvbHVgckiYM+C 4GHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RdzwGHvCCpIE8PYLpMnsIE7Dp6ielJFRJs6AnQClDEk=; b=l616l+Zt6JhP3dzM/ccphTbMK20B8Zmd1E4WPa4xoyG88NZQ2Ao4A3Qz037z2VD9uI nV/6PGwAe506ISqb106BYdAlF6iKKNk2Wf9vq75T2Kbam4wfFzDmcCF6VdK3CxKc//9+ LXGMYwr5DXXdUWcvAEHWHARMrSWvLYdk/v/xAPyHcaMRi/K4XG5zRUn3r/NjPjMPdrOa ssUoUYJSOxLWDWK5KeGG4byAoE+Qbs/WqXbmhxjFzdNpoziWGrOH9rNKOxIOXb/4NJW2 QeWhqB6bdB0PFbY8hn70KOINdzClayAMouoVAu5Km7qmK0yEapDW8Rc/ue75JMDPte8i 4O7A== X-Gm-Message-State: AO0yUKUWBSSwvCsLodC3ur3OpovuF5c/FTeQQRYMNxwJ4Uveu14+4z6+ UHWnH/38KKToIG0oHRfF6MnCEwQEaUyKX0Fn X-Received: by 2002:a17:903:1111:b0:196:6ec4:52db with SMTP id n17-20020a170903111100b001966ec452dbmr5623283plh.51.1675299149049; Wed, 01 Feb 2023 16:52:29 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 12/14] linux-user/sparc: Handle unimplemented flush trap Date: Wed, 1 Feb 2023 14:52:02 -1000 Message-Id: <20230202005204.2055899-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- 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 8985d10ba1..7ba543983a 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -319,6 +319,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 Thu Feb 2 00:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649647 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609717pva; Wed, 1 Feb 2023 16:54:21 -0800 (PST) X-Google-Smtp-Source: AK7set/jh5DoYAImz7q8PJM6+XliZl0eqGEWiCexwH18zX2M6R3pwuCKkAb6RdWES+O+ojR4V3uk X-Received: by 2002:a05:622a:14e:b0:3b8:694e:4b5b with SMTP id v14-20020a05622a014e00b003b8694e4b5bmr8103756qtw.1.1675299260893; Wed, 01 Feb 2023 16:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299260; cv=none; d=google.com; s=arc-20160816; b=FPnMOhj2mB1EpxBmcJn20i+BzbHQY6lGWId5Xh1KIjNeSUTMnS2URhu0Kc2Gb+Yq4g 6LDS+afvcBD0EWnA+OXdzUHa4tkxoTWWLkEexzykikcg8dz4UJzqw0hJenu1HR8Gi3FW xRkwlcCW53f5dVtcB3iFZV3gBahMC7Ao3ZNafSgT/G0tUoVXCoZFCw7TnGUXlOF2DgTD /gdrsodIIZwVcBxn3nRaHnC/IM/lkdg4j3ziy6nWpVYCJLfQ5KaQevpqmNfFBJTwmkcV AEOxqiJHRICVHw6psndn/WGeZWlirFkVENLa6QUEMQn2F9pIm2rtLMg8r07xs1IiGYQk PnVg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=99mKRPmhuKoadjBj2q33vILsr06N7+B7c/sSXSWRdhI=; b=MLkm2JsCQDnpBLXkbdOX6URKrYwA0g+nQrTYXY9tzWrIEH//TVC7M7eqG4H5TFlu8I 9F96l6GFz6+T5oJ8QN2Vnk+CRp0uPrhliT0fh+mqK8dK5oCcYC7BRbcUYiBRqUyAbGoJ tyusGkzBmIRIVs15uONNvJDVMHbCtmRyf/b6ZpjWEdt0pz/M8YQ7aTWHpCt27+iHGinu lqT/6Bzilo9gBSKr5VAXjBd6yOmhjIcHXqum25yhyXuSku/bl9zCcuh/TzUzYfDYApE0 i4OZcJ81CcaG95MN+I1KP+4pG9TTvj3MI5QTudgJgzzMriNPqU5vifIfyoToPWZpw0VP grcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HY/n1Ql+"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id oo22-20020a05620a531600b00720fdb50988si5249628qkn.746.2023.02.01.16.54.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b="HY/n1Ql+"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq7-0006I4-4G; Wed, 01 Feb 2023 19:52:35 -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 1pNNq5-0006DC-Km for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:33 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNq4-0000Rw-2p for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:33 -0500 Received: by mail-pj1-x1029.google.com with SMTP id c10-20020a17090a1d0a00b0022e63a94799so4056324pjd.2 for ; Wed, 01 Feb 2023 16:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=99mKRPmhuKoadjBj2q33vILsr06N7+B7c/sSXSWRdhI=; b=HY/n1Ql+PQ8SLcDNHlfymT7uyflmPdTfAGyScmHtSw3qJJ7acvSgFVg2gf8Efigz1T txyzOd8pTBFqH+Wx+yKjWY6/1gBKMBMvsRn8b066RPYInL/GYd/Ah8KtagPGmMgz8SSo q4GDLEU2m2PumgpIPWl9SaUIwvz+1M+khEVq8QmSl15SLmPww3a7wzZbLUV3s2UEnTzU cBbdf5IsURiVnNNux6ODmujduW7AvlklVUXomBuo0xQhB9YdcsiHyOmxNveRw5FdFbgi QZnnGq3FdeVkyQScbaUHgFxsP6UHXzuOW7RYFAPr8Do0zdJipZ4txaL3SYNk1nKGEAb2 PYgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=99mKRPmhuKoadjBj2q33vILsr06N7+B7c/sSXSWRdhI=; b=iOOW5miHY4Hc33jZjJh28+ojkGpoY04LWZ3n2xXcHeEirfK/Kw7beguGHjqT/5s7aX rmJ1U6Phlufy3x0DJyyPDs4ZEqoKlUAYZHOL415ZjVOz3Q/5BC86RDP8v/Kc+iuVHHik PGJRMFTDLiYMbvtrQ/OBXvS5pyBkgyUMmRP4MB+alVT8rXqYcofz8k3rB8g+E+K2KDft xdqVmDnixYjzR9UHQZTPIpcu5i1csA6qvywtEGJGJLEv050Qsx0dz2jr2d7Z2OTQdC/1 e1FAzE6w82yuzN2t6QC+ttT0kd8VQAgWRWu09dbp+AlqCTuvz8D+//NfIIVPwrpkWe1l hqOQ== X-Gm-Message-State: AO0yUKUPIjDbeAXXGYq/GpA6GCvHLyvUxqAd2CMnXzGMx0c/WdMIxe2s O5lmTmXhaY5u/uUH1EHGeUzrt25hhWs/uY3b X-Received: by 2002:a17:902:db0a:b0:196:11b1:101d with SMTP id m10-20020a170902db0a00b0019611b1101dmr6291152plx.28.1675299150748; Wed, 01 Feb 2023 16:52:30 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 13/14] linux-user/sparc: Handle floating-point exceptions Date: Wed, 1 Feb 2023 14:52:03 -1000 Message-Id: <20230202005204.2055899-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 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 --- target/sparc/cpu.h | 3 +-- linux-user/sparc/cpu_loop.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index e478c5eb16..ae8de606d5 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 diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 7ba543983a..18109f545d 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -301,6 +301,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; From patchwork Thu Feb 2 00:52:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 649644 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp609683pva; Wed, 1 Feb 2023 16:54:16 -0800 (PST) X-Google-Smtp-Source: AK7set9mta3BrooC83+/cow6GB8YHCh0TMaVUWpnc0M01Uj/zQc3v9pCByDByOv9U6qnJ0rSAivD X-Received: by 2002:a05:622a:11d0:b0:3b9:b9ae:1476 with SMTP id n16-20020a05622a11d000b003b9b9ae1476mr6931863qtk.40.1675299255826; Wed, 01 Feb 2023 16:54:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675299255; cv=none; d=google.com; s=arc-20160816; b=auz5MTsP1kvqSe+EpN6HQXWQsi/Lk/pJ1r5TAEYo30tddjNQ8DMcHDYJE4w/lH3Q2T Urc3LN308lGIjrWadDH8xUqewjfjcAV2HBoSznAtc652y0wOpZTBCOyUoVo4x5j0iHd3 DdXkpWRXCzMMEFfiLH8XtYGaUoUDgXDaHRo7HKB8tlFRTTjE0j6Ty1qxOBgfBex9EZ9M 0BZTDuFdwHPl/fh+cC6rIPXAxXIyMQgA+o9KoD5IDoEMggHqQx7GcLjkOuBSCer/2XZg RmwPwWhC0n4XibowlqCEZGapfabKqNqozMraTqdHIA/kPdhCBhR5fqZnQYhGz7v7fnmD WTPw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gcAn+/dc308N0zwxzCUYCpv71yRhEWzbzgA9/jFvtIs=; b=v1BuANSQznYLUVWW5HlQwvTVbQb6pQFt81dw18KZomeeG7qeiBl0xijreWchi1gFxR si4sXLAsaaqhSLCldveJk3zx+TQIYrDqV7rzXipP3oTvSylXddMaeNheJ3u8/MNUSTxS oRzAttdupfq9YZYCzzaLmBLPWskSvllJGK691HfTaW3jMPmPZu7MLjmRGYoPr2ZKdgmt k1SWPUYMRKE5gwbdK6ikGD23a9YIpKqG87eCVfzUwqCKkqZnxe3blLq4a9/24t/FcP99 j9gZQl/eIoZ4zMxOWTi6Vk8ITZ998w4HTBXF8ZOJuSZy1lIQsaybrgMjZQGpQYYVk+z8 LfKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MxSDyZLR; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z185-20020a37b0c2000000b007023e5ce511si10798984qke.679.2023.02.01.16.54.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Feb 2023 16:54: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; dkim=pass header.i=@linaro.org header.s=google header.b=MxSDyZLR; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNNq8-0006Jv-3D; Wed, 01 Feb 2023 19:52:36 -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 1pNNq6-0006Hu-Rh for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:34 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNNq5-0000RF-14 for qemu-devel@nongnu.org; Wed, 01 Feb 2023 19:52:34 -0500 Received: by mail-pj1-x1033.google.com with SMTP id on9-20020a17090b1d0900b002300a96b358so322284pjb.1 for ; Wed, 01 Feb 2023 16:52:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gcAn+/dc308N0zwxzCUYCpv71yRhEWzbzgA9/jFvtIs=; b=MxSDyZLRWVcCa+F5RrmWPgD4dEzSpMnCRLBUcSqdvjE357NSl6yi5ar+w7g44ReWiK y+WNGc/Ttkjfqf10/8kAfrAmzgbcERJfJgQ+0TayC+G9uMPz1YDQ7gBEYuVcpipO9qKD xI+xjDiJuxCl6PTeObAzyo4ECz6M1OipohfumGu97ErQuS3a3tBlZef4weGCnlMhBcfW COAEKgT/uLq3oLKxrwGl+A19IXhDbdHzHgDz4u1j2NDCl4OtqDs3fnPmviuTuffZeasV 1+1nJVduAfob/AAIJJUEPrrKW/mXuEhqAXzeTAxXKkZk5pf+sW3KlVmc/+itLVOywXp0 zSWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gcAn+/dc308N0zwxzCUYCpv71yRhEWzbzgA9/jFvtIs=; b=zQKVxSbyk2M7JrlSikOqHOzntveoJ7R9rwfLCvtJFRJKmpOSLBercg0Q+cHJffgUh3 Eo07HjY00BeOPPDVZRYvjFh/IjKpSoeLAJqg0tFEPBGa1Co8Lqi8/X/QHWtAaBJ3axUB RZfa1OBfvJQJzoyCNszS3C2o+LmmdK6Yglvok1dGcYgytFPiwoHumBAxdM6Hsrvb/xyY 36N1nBonm5hJVdf2a77ohrF3qButapW374T9314TUOX+zM6WjaXMgVnUCW4bCUgNCsbT TlYp4pVX3L/UszAII1UUXZMR/bWnwNZeAV2mKHri+xToYXyCavCWsX0FF4R1HIo1g9tW k0Gg== X-Gm-Message-State: AO0yUKWY3U4W7WmKs720HkNY95L5X+CoH0c+mqYOxQZ9qSmkUfyXfBTh Pwz2B6EBeOGCD99J96kYgcMbeGNvjiU8jGzU X-Received: by 2002:a17:903:120b:b0:196:89bc:7100 with SMTP id l11-20020a170903120b00b0019689bc7100mr5822839plh.16.1675299152345; Wed, 01 Feb 2023 16:52:32 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id z3-20020a1709028f8300b00192cf87ed25sm12391334plo.35.2023.02.01.16.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 16:52:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, laurent@vivier.eu, iii@linux.ibm.com Subject: [PATCH 14/14] linux-user/sparc: Handle tag overflow traps Date: Wed, 1 Feb 2023 14:52:04 -1000 Message-Id: <20230202005204.2055899-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202005204.2055899-1-richard.henderson@linaro.org> References: <20230202005204.2055899-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 This trap is raised by taddcctv and tsubcctv insns. Signed-off-by: Richard Henderson --- linux-user/sparc/target_signal.h | 2 +- linux-user/syscall_defs.h | 5 +++++ linux-user/sparc/cpu_loop.c | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index 87757f0c4e..f223eb4af6 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 77864de57f..614a1cbc8e 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 { diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 18109f545d..0b19f47876 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -332,6 +332,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. */