From nobody Mon Feb 9 17:08:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500029451151501.3897233405754; Fri, 14 Jul 2017 03:50:51 -0700 (PDT) Received: from localhost ([::1]:36918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVyBN-0003hd-MT for importer@patchew.org; Fri, 14 Jul 2017 06:50:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVy2D-0003GH-6t for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:41:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVy2B-0003LC-UW for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:41:21 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41253) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVy2B-0003KY-Kd for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:41:19 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6EAcg5m053649 for ; Fri, 14 Jul 2017 06:41:18 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpsnc6cmk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Jul 2017 06:41:18 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jul 2017 11:41:15 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 14 Jul 2017 11:41:13 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6EAfD7m59310244; Fri, 14 Jul 2017 10:41:13 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EA7242420; Fri, 14 Jul 2017 11:38:35 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 773044241F; Fri, 14 Jul 2017 11:38:35 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 14 Jul 2017 11:38:35 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 0699220F69D; Fri, 14 Jul 2017 12:41:13 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Fri, 14 Jul 2017 12:40:45 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> References: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071410-0012-0000-0000-0000056329E4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071410-0013-0000-0000-000018D63D00 Message-Id: <1500028867-134709-19-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707140175 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 18/40] pc-bios/s390-ccw: Move libc functions to separate header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , qemu-devel , Alexander Graf , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The upcoming netboot code will use the libc from SLOF. To be able to still use s390-ccw.h there, the libc related functions in this header have to be moved to a different location. And while we're at it, remove the duplicate memcpy() function from sclp.c. Reviewed-by: Christian Borntraeger Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth Message-Id: <1499863793-18627-2-git-send-email-thuth@redhat.com> Signed-off-by: Christian Borntraeger --- pc-bios/s390-ccw/bootmap.c | 1 + pc-bios/s390-ccw/libc.h | 45 ++++++++++++++++++++++++++++++++++++++= ++++ pc-bios/s390-ccw/main.c | 1 + pc-bios/s390-ccw/s390-ccw.h | 29 --------------------------- pc-bios/s390-ccw/sclp.c | 10 ++-------- pc-bios/s390-ccw/virtio-scsi.c | 1 + pc-bios/s390-ccw/virtio.c | 1 + 7 files changed, 51 insertions(+), 37 deletions(-) create mode 100644 pc-bios/s390-ccw/libc.h diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 523fa78..458d3da 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -8,6 +8,7 @@ * directory. */ =20 +#include "libc.h" #include "s390-ccw.h" #include "bootmap.h" #include "virtio.h" diff --git a/pc-bios/s390-ccw/libc.h b/pc-bios/s390-ccw/libc.h new file mode 100644 index 0000000..0142ea8 --- /dev/null +++ b/pc-bios/s390-ccw/libc.h @@ -0,0 +1,45 @@ +/* + * libc-style definitions and functions + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#ifndef S390_CCW_LIBC_H +#define S390_CCW_LIBC_H + +typedef long size_t; +typedef int bool; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +static inline void *memset(void *s, int c, size_t n) +{ + int i; + unsigned char *p =3D s; + + for (i =3D 0; i < n; i++) { + p[i] =3D c; + } + + return s; +} + +static inline void *memcpy(void *s1, const void *s2, size_t n) +{ + uint8_t *dest =3D s1; + const uint8_t *src =3D s2; + int i; + + for (i =3D 0; i < n; i++) { + dest[i] =3D src[i]; + } + + return s1; +} + +#endif diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 1cacc1b..40cba8d 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -8,6 +8,7 @@ * directory. */ =20 +#include "libc.h" #include "s390-ccw.h" #include "virtio.h" =20 diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 2089274..43e2d42 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -18,12 +18,6 @@ typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; typedef unsigned long ulong; -typedef long size_t; -typedef int bool; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; typedef unsigned char __u8; typedef unsigned short __u16; typedef unsigned int __u32; @@ -88,18 +82,6 @@ ulong get_second(void); /* bootmap.c */ void zipl_load(void); =20 -static inline void *memset(void *s, int c, size_t n) -{ - int i; - unsigned char *p =3D s; - - for (i =3D 0; i < n; i++) { - p[i] =3D c; - } - - return s; -} - static inline void fill_hex(char *out, unsigned char val) { const char hex[] =3D "0123456789abcdef"; @@ -169,17 +151,6 @@ static inline void sleep(unsigned int seconds) } } =20 -static inline void *memcpy(void *s1, const void *s2, size_t n) -{ - uint8_t *p1 =3D s1; - const uint8_t *p2 =3D s2; - - while (n--) { - p1[n] =3D p2[n]; - } - return s1; -} - static inline void IPL_assert(bool term, const char *message) { if (!term) { diff --git a/pc-bios/s390-ccw/sclp.c b/pc-bios/s390-ccw/sclp.c index a1639ba..aa1c862 100644 --- a/pc-bios/s390-ccw/sclp.c +++ b/pc-bios/s390-ccw/sclp.c @@ -8,6 +8,7 @@ * directory. */ =20 +#include "libc.h" #include "s390-ccw.h" #include "sclp.h" =20 @@ -59,13 +60,6 @@ static int _strlen(const char *str) return i; } =20 -static void _memcpy(char *dest, const char *src, int len) -{ - int i; - for (i =3D 0; i < len; i++) - dest[i] =3D src[i]; -} - void sclp_print(const char *str) { int len =3D _strlen(str); @@ -76,7 +70,7 @@ void sclp_print(const char *str) sccb->ebh.length =3D sizeof(EventBufferHeader) + len; sccb->ebh.type =3D SCLP_EVENT_ASCII_CONSOLE_DATA; sccb->ebh.flags =3D 0; - _memcpy(sccb->data, str, len); + memcpy(sccb->data, str, len); =20 sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb); } diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index f61ecf0..c92f5d3 100644 --- a/pc-bios/s390-ccw/virtio-scsi.c +++ b/pc-bios/s390-ccw/virtio-scsi.c @@ -9,6 +9,7 @@ * directory. */ =20 +#include "libc.h" #include "s390-ccw.h" #include "virtio.h" #include "scsi.h" diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 6ee93d5..8768331 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -8,6 +8,7 @@ * directory. */ =20 +#include "libc.h" #include "s390-ccw.h" #include "virtio.h" #include "virtio-scsi.h" --=20 2.7.4