From patchwork Sat Apr 22 00:58:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1772185 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Rcpi9Yu3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q3Chz2NVKz23tD for ; Sat, 22 Apr 2023 10:59:29 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pq1a7-0006tN-CL; Fri, 21 Apr 2023 20:58:27 -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 1pq1a3-0006qm-9k; Fri, 21 Apr 2023 20:58:23 -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 1pq1a1-0003Sn-4v; Fri, 21 Apr 2023 20:58:22 -0400 Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33M0Bhqx031091; Sat, 22 Apr 2023 00:58:18 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=cEESlChjvEWAucaoZNX+UJXbOCp247z6Xa9Z2wCP3SE=; b=Rcpi9Yu3j9XWXitqs3XkiJJFYxdnLcdAA5JoNOEpLRPDbOEnSb5lpUvX/6zhdQy1hiav /4xQlLE6h9JqxOuvNAxypEWSFmGmtVBRETwfEEX30ZH2zQs/PbeagCNxrbSxkBqnSNMS Bm+hZAMlmbkgnbJsGHQUm+zNipjKK3WPNhe3JsPUrfhR0BgtUrgHK1pzMNhVld/bClJS Sd+e0oy3rXIdrwQs72Kym7PT5hDLgrWPIi5mxGIpWUIHN/znpjKf8gMb/6oKtJIjOuZV T+5YtfAbPN34oe7wlkNViyrSoXdkUL0+LURq+lPfIO7QeokCe6c+sl9ki5tPCce0UOsz Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q3xp3vus3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:18 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33M0wHVw030047; Sat, 22 Apr 2023 00:58:17 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q3xp3vurj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:17 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33LNw7BG013858; Sat, 22 Apr 2023 00:58:15 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3pykj6bkk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:14 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33M0wC0q58720616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Apr 2023 00:58:12 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A38C2004B; Sat, 22 Apr 2023 00:58:12 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1785320043; Sat, 22 Apr 2023 00:58:12 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.0.177]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 22 Apr 2023 00:58:12 +0000 (GMT) From: Ilya Leoshkevich To: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , David Hildenbrand Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH 1/2] tests/tcg/multiarch: Make the system memory test work on big-endian Date: Sat, 22 Apr 2023 02:58:07 +0200 Message-Id: <20230422005808.1773015-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230422005808.1773015-1-iii@linux.ibm.com> References: <20230422005808.1773015-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: N0T4QcoRLDBotvNElRmWdJSy2qdV8FpL X-Proofpoint-ORIG-GUID: yQ4av4wwTf6jutUeDLTrT3IjrP-Qcfbw 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-04-21_08,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304220003 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make sure values are stored in memory as little-endian regardless of the host endianness. Signed-off-by: Ilya Leoshkevich --- tests/tcg/multiarch/system/memory.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c index 214f7d4f54b..8ef6666b440 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -121,6 +121,9 @@ static void init_test_data_u16(int offset) for (i = 0; i < max; i++) { uint8_t low = count++, high = count++; word = BYTE_SHIFT(high, 1) | BYTE_SHIFT(low, 0); +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap16(word); +#endif *ptr++ = word; pdot(i); } @@ -142,6 +145,9 @@ static void init_test_data_u32(int offset) uint8_t b4 = count++, b3 = count++; uint8_t b2 = count++, b1 = count++; word = BYTE_SHIFT(b1, 3) | BYTE_SHIFT(b2, 2) | BYTE_SHIFT(b3, 1) | b4; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap32(word); +#endif *ptr++ = word; pdot(i); } @@ -167,6 +173,9 @@ static void init_test_data_u64(int offset) word = BYTE_SHIFT(b1, 7) | BYTE_SHIFT(b2, 6) | BYTE_SHIFT(b3, 5) | BYTE_SHIFT(b4, 4) | BYTE_SHIFT(b5, 3) | BYTE_SHIFT(b6, 2) | BYTE_SHIFT(b7, 1) | b8; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap64(word); +#endif *ptr++ = word; pdot(i); } @@ -184,6 +193,9 @@ static bool read_test_data_u16(int offset) for (i = 0; i < max; i++) { uint8_t high, low; word = *ptr++; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap16(word); +#endif high = (word >> 8) & 0xff; low = word & 0xff; if (high < low && high != 0) { @@ -210,6 +222,9 @@ static bool read_test_data_u32(int offset) uint8_t b1, b2, b3, b4; int zeros = 0; word = *ptr++; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap32(word); +#endif b1 = word >> 24 & 0xff; b2 = word >> 16 & 0xff; @@ -251,6 +266,9 @@ static bool read_test_data_u64(int offset) uint8_t b1, b2, b3, b4, b5, b6, b7, b8; int zeros = 0; word = *ptr++; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + word = __builtin_bswap64(word); +#endif b1 = ((uint64_t) (word >> 56)) & 0xff; b2 = ((uint64_t) (word >> 48)) & 0xff; @@ -376,6 +394,9 @@ static bool read_test_data_s16(int offset, bool neg_first) for (i = 0; i < max; i++) { int32_t data = *ptr++; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + data = __builtin_bswap16(data); +#endif if (neg_first && data < 0) { pdot(i); @@ -401,6 +422,9 @@ static bool read_test_data_s32(int offset, bool neg_first) for (i = 0; i < max; i++) { int64_t data = *ptr++; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + data = __builtin_bswap32(data); +#endif if (neg_first && data < 0) { pdot(i); From patchwork Sat Apr 22 00:58:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1772187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=NvX6KhBA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q3Chz2v9rz23tr for ; Sat, 22 Apr 2023 10:59:29 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pq1a7-0006tL-CT; Fri, 21 Apr 2023 20:58:27 -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 1pq1a4-0006s1-Bb; Fri, 21 Apr 2023 20:58:24 -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 1pq1a2-0003TE-Mn; Fri, 21 Apr 2023 20:58:24 -0400 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33M0TiGT021176; Sat, 22 Apr 2023 00:58:20 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=rRz/ZIF6xvzM76k+fMKPNYsj+kdArOIUr5MBA0XQaMk=; b=NvX6KhBAuWyYodlmd1hTQoX+1orTAVWKQM4r4a2zGQ1nl0RToNHHwx9v5gydx78Zqjlb s01LyrrR0KbstR7QHlRXYMIO3ZCiOg3ZYj4o8yZjakmeJK1oHavUDeL3JbqxnsVyfYOJ lDyzrOLkn4oIJCDQYVb3eFIwnzFOWsPHuDSVEGaq1AUJ2T9VYux0cmheWJO3X5gkF6/e dlVLy7Dl/M5yfq34xcEHmpTwroGGw/efFlmO+LfTAyBBUaNbL+SR7k+dn+7tyFjlZh6y ovEFDdWtvMQ/AUVCXoWef4m1X6OmJ90l/I3q5xP5qLDxmYkEy/M+Jo8WXEYNBnfG+ExJ 2A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q42rgvaht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:19 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33M0kPhI002448; Sat, 22 Apr 2023 00:58:19 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q42rgvagy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:18 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33M0rm67020908; Sat, 22 Apr 2023 00:58:16 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3pyk6fmb2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 22 Apr 2023 00:58:16 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33M0wEkk20447790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 22 Apr 2023 00:58:14 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E834B20040; Sat, 22 Apr 2023 00:58:13 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7CF9F2004B; Sat, 22 Apr 2023 00:58:13 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.0.177]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 22 Apr 2023 00:58:13 +0000 (GMT) From: Ilya Leoshkevich To: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , David Hildenbrand Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich Subject: [PATCH 2/2] tests/tcg/s390x: Enable the multiarch system tests Date: Sat, 22 Apr 2023 02:58:08 +0200 Message-Id: <20230422005808.1773015-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230422005808.1773015-1-iii@linux.ibm.com> References: <20230422005808.1773015-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 2d9PIAF-6fZKCDdN2kUGP5PzJQPFR_-h X-Proofpoint-ORIG-GUID: 8E84Q_u0sEY8nHkOXVxNL2mFouGwlmgA 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-04-21_08,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304220003 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Multiarch tests are written in C and need support for printing characters. Instead of implementing the runtime from scratch, just reuse the pc-bios/s390-ccw one. Run tests with -nographic in order to enable SCLP (enable this for the existing tests as well, since it does not hurt). Use the default linker script for the new tests. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 37 +++++++++++++++++-------- tests/tcg/s390x/console.c | 12 ++++++++ tests/tcg/s390x/head64.S | 31 +++++++++++++++++++++ 3 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 tests/tcg/s390x/console.c create mode 100644 tests/tcg/s390x/head64.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Makefile.softmmu-target index 3e7f72abcdc..2c42526e9cd 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -1,25 +1,40 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x VPATH+=$(S390X_SRC) -QEMU_OPTS=-action panic=exit-failure -kernel +QEMU_OPTS=-action panic=exit-failure -nographic -kernel LINK_SCRIPT=$(S390X_SRC)/softmmu.ld -LDFLAGS=-nostdlib -static -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none +CFLAGS+=-ggdb -O0 +LDFLAGS=-nostdlib -static %.o: %.S $(CC) -march=z13 -m64 -c $< -o $@ +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -march=z13 -m64 -c $< -o $@ + %: %.o $(LINK_SCRIPT) $(CC) $< -o $@ $(LDFLAGS) -TESTS += unaligned-lowcore -TESTS += bal -TESTS += sam -TESTS += lpsw -TESTS += lpswe-early -TESTS += ssm-early -TESTS += stosm-early -TESTS += exrl-ssm-early +ASM_TESTS = \ + bal \ + exrl-ssm-early \ + sam \ + lpsw \ + lpswe-early \ + ssm-early \ + stosm-early \ + unaligned-lowcore include $(S390X_SRC)/pgm-specification.mak $(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o $(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o -TESTS += $(PGM_SPECIFICATION_TESTS) +ASM_TESTS += $(PGM_SPECIFICATION_TESTS) + +$(ASM_TESTS): LDFLAGS += -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none +TESTS += $(ASM_TESTS) + +S390X_MULTIARCH_RUNTIME_OBJS = head64.o console.o $(MINILIB_OBJS) +$(MULTIARCH_TESTS): $(S390X_MULTIARCH_RUNTIME_OBJS) +$(MULTIARCH_TESTS): LDFLAGS += $(S390X_MULTIARCH_RUNTIME_OBJS) +$(MULTIARCH_TESTS): CFLAGS += $(MINILIB_INC) +memory: CFLAGS += -DCHECK_UNALIGNED=0 +TESTS += $(MULTIARCH_TESTS) diff --git a/tests/tcg/s390x/console.c b/tests/tcg/s390x/console.c new file mode 100644 index 00000000000..d43ce3f44b4 --- /dev/null +++ b/tests/tcg/s390x/console.c @@ -0,0 +1,12 @@ +/* + * Console code for multiarch tests. + * Reuses the pc-bios/s390-ccw implementation. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "../../../pc-bios/s390-ccw/sclp.c" + +void __sys_outc(char c) +{ + write(1, &c, sizeof(c)); +} diff --git a/tests/tcg/s390x/head64.S b/tests/tcg/s390x/head64.S new file mode 100644 index 00000000000..c6f36dfea4b --- /dev/null +++ b/tests/tcg/s390x/head64.S @@ -0,0 +1,31 @@ +/* + * Startup code for multiarch tests. + * Reuses the pc-bios/s390-ccw implementation. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#define main main_pre +#include "../../../pc-bios/s390-ccw/start.S" +#undef main + +main_pre: + aghi %r15,-160 /* reserve stack for C code */ + brasl %r14,sclp_setup + brasl %r14,main + larl %r1,success_psw /* check main() return code */ + ltgr %r2,%r2 + je 0f + larl %r1,failure_psw +0: + lpswe 0(%r1) + + .align 8 +success_psw: + .quad 0x2000180000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000180000000,0 /* disabled wait */ + + .section .bss + .align 0x1000 +stack: + .skip 0x8000