From nobody Sat May 18 18:27:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1678791690; cv=none; d=zohomail.com; s=zohoarc; b=XUud5CnFO1uvkUB7t3nWQTLU+GLv0qAvpCSAYhVBS/cuTtnK62xKryD0hFYF5PfGN8ZSVMC/qTrYof3erEKVJfcdJiixmsoEIrTFM4wJsx6oKpg6zj/5vPeb0/Wj85MDoL7OASFTNk+dn+/X0SJatXqx+6P28E/sqtLVKo62VBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678791690; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d42nUeWZSlSMpicJkV4sCWWStUxXxGbFNI+NE7Xy8IM=; b=awzTiwjNRRonEzS+dtT+cndrtNkadxOnWO7VpdT3fY1ruUESqQwNeeii3jhzE248gQXNrqon/LrpO7tbDZgCDBdR+jI96EdHoWnRRdDn85AC6SC4SMP64xPd3YjHN5WKbiyx7STFzyamjfdsySdDUMBPQtZeZpYcsweHNQTcks0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678791690239309.1160030838531; Tue, 14 Mar 2023 04:01:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pc2Oy-0001NM-U7; Tue, 14 Mar 2023 07:01:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pc2Oy-0001N8-6G; Tue, 14 Mar 2023 07:01:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pc2Ow-0004Sp-8I; Tue, 14 Mar 2023 07:01:07 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32E9g4oi016916; Tue, 14 Mar 2023 11:01:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paph21y72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:01:01 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32E9h53w021067; Tue, 14 Mar 2023 11:01:01 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paph21xy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:01:01 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32E6feok028628; Tue, 14 Mar 2023 11:00:38 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3p8h96mp8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:00:38 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32EB0ZMA18416344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Mar 2023 11:00:35 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34BC420040; Tue, 14 Mar 2023 11:00:35 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1B842004B; Tue, 14 Mar 2023 11:00:34 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.57.117]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 14 Mar 2023 11:00:34 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=d42nUeWZSlSMpicJkV4sCWWStUxXxGbFNI+NE7Xy8IM=; b=DEqoer4/1xDOiBa/yYOytrshD6TlqROlabYgHRjJPAoyzqNAsyJi0mAJIswIgZFwRNcK /K6wlvwENDeHc7dbIpWbfk927fFErfnC4SAs8vtWiifCbchss4jgiGfNjJ97XxgcEh3w TfLQPkb4JTaKK5bFYcwgJlhKrSWRbPCu/QbI/KtoW9XXI8cVBrE3oEbuu+/tRLofowfT 22YS7EZDv2jz+AoKL4DsyFNCygTI15DBirlFaEz24Y8SU8dYAQ5ZVh2m+DjSVX95Ns5j lHyNyoGLr6YHVnR3P+SsAIurJbkji1Zg+k5mXKwQiAiM+zzFnXsSap8JCRDUgAs+ZUIc mw== From: Ilya Leoshkevich To: Richard Henderson , David Hildenbrand , Thomas Huth Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Ilya Leoshkevich , Nina Schoetterl-Glausch Subject: [PATCH 1/2] target/s390x: Implement Early Exception Recognition Date: Tue, 14 Mar 2023 12:00:21 +0100 Message-Id: <20230314110022.184717-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314110022.184717-1-iii@linux.ibm.com> References: <20230314110022.184717-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: YyyQmgesrY7E6iVXn4HbM6CkOW17YGHa X-Proofpoint-GUID: hKNVQxSoRIe3OoQZCKBept4hLBKupeQ3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-14_04,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303140095 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1678791692328100002 Content-Type: text/plain; charset="utf-8" Generate specification exception if a reserved bit is set in the PSW mask or if the PSW address is out of bounds dictated by the addresing mode. Reported-by: Nina Schoetterl-Glausch Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson --- target/s390x/cpu.c | 26 ++++++++++++++++++++++++++ target/s390x/cpu.h | 1 + target/s390x/tcg/excp_helper.c | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index b10a8541ff8..8e6e46aa3d8 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -41,6 +41,26 @@ #define CR0_RESET 0xE0UL #define CR14_RESET 0xC2000000UL; =20 +#ifndef CONFIG_USER_ONLY +static bool is_early_exception_recognized(uint64_t mask, uint64_t addr) +{ + if (mask & PSW_MASK_RESERVED) { + return true; + } + + switch (mask & (PSW_MASK_32 | PSW_MASK_64)) { + case 0: + return addr & ~0xffffffULL; + case PSW_MASK_32: + return addr & ~0x7fffffffULL; + case PSW_MASK_32 | PSW_MASK_64: + return false; + default: /* PSW_MASK_64 */ + return true; + } +} +#endif + void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask, uint64_t addr) { #ifndef CONFIG_USER_ONLY @@ -57,6 +77,12 @@ void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask,= uint64_t addr) env->cc_op =3D (mask >> 44) & 3; =20 #ifndef CONFIG_USER_ONLY + if (is_early_exception_recognized(mask, addr)) { + env->int_pgm_ilen =3D 0; + trigger_pgm_exception(env, PGM_SPECIFICATION); + return; + } + if ((old_mask ^ mask) & PSW_MASK_PER) { s390_cpu_recompute_watchpoints(env_cpu(env)); } diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7d6d01325b2..b4de6945936 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -292,6 +292,7 @@ extern const VMStateDescription vmstate_s390_cpu; #define PSW_MASK_32 0x0000000080000000ULL #define PSW_MASK_SHORT_ADDR 0x000000007fffffffULL #define PSW_MASK_SHORT_CTRL 0xffffffff80000000ULL +#define PSW_MASK_RESERVED 0xb800007e7fffffffULL =20 #undef PSW_ASC_PRIMARY #undef PSW_ASC_ACCREG diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c index bc767f04438..a7829b1e494 100644 --- a/target/s390x/tcg/excp_helper.c +++ b/target/s390x/tcg/excp_helper.c @@ -212,7 +212,8 @@ static void do_program_interrupt(CPUS390XState *env) LowCore *lowcore; int ilen =3D env->int_pgm_ilen; =20 - assert(ilen =3D=3D 2 || ilen =3D=3D 4 || ilen =3D=3D 6); + assert((env->int_pgm_code =3D=3D PGM_SPECIFICATION && ilen =3D=3D 0) || + ilen =3D=3D 2 || ilen =3D=3D 4 || ilen =3D=3D 6); =20 switch (env->int_pgm_code) { case PGM_PER: --=20 2.39.2 From nobody Sat May 18 18:27:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1678791719; cv=none; d=zohomail.com; s=zohoarc; b=IWWk9sPtyJM9Dem5zpADBtTpo9G+2zA12Fs2CNmh9DjXA/FUSP8WRhprP4WyUx6yL2IkhnaQot1N3oT6AVPhB6qNI1smvOMJgJa2E0A51e57bWzz1Cz6rHi13Vezqi/tR5SP+woRWXZ6lcztgGB+epbK/XpUuJ4PgbmsuegHmQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678791719; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZUsZ9esCKsL3ARBcedc2Z0n9ASaWviuoKZHFbn35heI=; b=KOzXySvukire4rIoGYevC+KjLvodpP8nlhOGWaagFvcHUwpI7rBqgqwAdsy5SI4ExmLkh3tJ3+JFQOccPfpEHpUa47JEVTS22qsENYGcabHoYU0c8Vjctp8kxCPZP/AYzGzEJLdjcDj0HOKh1L6JjNhcw3vpMZc7ysCLqPHXjO8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678791719810217.9923916238622; Tue, 14 Mar 2023 04:01:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pc2Oe-0001LX-UH; Tue, 14 Mar 2023 07:00:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pc2Oc-0001Kn-Kl; Tue, 14 Mar 2023 07:00:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pc2Oa-0004Ko-VX; Tue, 14 Mar 2023 07:00:46 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32EAl8DB030675; Tue, 14 Mar 2023 11:00:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paqftg97q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:00:41 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32EAlOoB031092; Tue, 14 Mar 2023 11:00:41 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3paqftg972-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:00:41 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32E8lF5T018994; Tue, 14 Mar 2023 11:00:39 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma02fra.de.ibm.com (PPS) with ESMTPS id 3p8h96kp3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 11:00:39 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32EB0a5Y30867928 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Mar 2023 11:00:36 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B8AF2004B; Tue, 14 Mar 2023 11:00:36 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F89120040; Tue, 14 Mar 2023 11:00:36 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.57.117]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 14 Mar 2023 11:00:35 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ZUsZ9esCKsL3ARBcedc2Z0n9ASaWviuoKZHFbn35heI=; b=iUVMOX2DIW21017lwN6Ab46iZouB7Ei5bQdcHFOb0/6eULjMjO+dF1XN4NBg+zyMlKoe Aau+ZGMOzC06JuKyMd+yCaOVdk4qEX/outOc0P55UXkqfXNHPw34siL3zB8RnLry17bs 2aCqV+F6sEOvHj/CPYLfq3C4eB029i30PCIZgfyJAhpejnU0UDh7xTcOP58Ofxzt5rVk hGDSpsafoXxdqV3yf90wLpGsm/tIWweoK11dn3pquIxRHWQE+0SA1W8ivmP5cjRyCLCo Tstps8HNGf3ijORl42MMwhp+RiELFUawjAgzCGa+VHd0KsgBcQFpN6IN6qDKl0yLLmR6 tw== From: Ilya Leoshkevich To: Richard Henderson , David Hildenbrand , Thomas Huth Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 2/2] tests/tcg/s390x: Add early-exception-recognition.S Date: Tue, 14 Mar 2023 12:00:22 +0100 Message-Id: <20230314110022.184717-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314110022.184717-1-iii@linux.ibm.com> References: <20230314110022.184717-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: f_wxN19m4RA5D2OhPn2excLGm-2lBDB4 X-Proofpoint-GUID: 3_K5oEYh58TcyAhR2eStiavKVkmak9lm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-14_04,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=774 spamscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303140090 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1678791720134100001 Content-Type: text/plain; charset="utf-8" Add a small test that checks whether early exceptions are recognized and whether the correct ILC and old PSW are stored when they happen. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/early-exception-recognition.S | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/tcg/s390x/early-exception-recognition.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Make= file.softmmu-target index 725b6c598db..9d3180bbcba 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -9,3 +9,4 @@ QEMU_OPTS=3D-action panic=3Dexit-failure -kernel TESTS +=3D unaligned-lowcore TESTS +=3D bal TESTS +=3D sam +TESTS +=3D early-exception-recognition diff --git a/tests/tcg/s390x/early-exception-recognition.S b/tests/tcg/s390= x/early-exception-recognition.S new file mode 100644 index 00000000000..4e9677fea36 --- /dev/null +++ b/tests/tcg/s390x/early-exception-recognition.S @@ -0,0 +1,38 @@ +/* + * Test early exception recognition. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + .org 0x8d +ilc: + .org 0x8e +program_interruption_code: + .org 0x150 +program_old_psw: + .org 0x1D0 /* program new PSW */ + .quad 0,pgm + .org 0x200 /* lowcore padding */ + + .globl _start +_start: + lpswe bad_psw + j failure + +pgm: + chhsi program_interruption_code,0x6 /* specification exceptio= n? */ + jne failure + cli ilc,0 /* ilc zero? */ + jne failure + clc program_old_psw(16),bad_psw /* correct old PSW? */ + jne failure + lpswe success_psw +failure: + lpswe failure_psw + + .align 8 +bad_psw: + .quad 0x8000000000000000,0xfedcba9876543210 /* bit 0 set */ +success_psw: + .quad 0x2000000000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000000000000,0 /* disabled wait */ --=20 2.39.2