From nobody Mon Feb 9 15:30:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619014748; cv=none; d=zohomail.com; s=zohoarc; b=IHkPL20PwTHWHoM4VFP0zEeZGdtc3WhrQJndzu+onBcWm2Ofk+TOd1wN6Mrt5WG9Vyk74F6QgFIVJkG6cy0g915n/i5guyGooA93bkkZUHgMnZ+fWivpno+ogT2rAGbeClnhr7nJfP9WEUip7LI6jWFLQR+ZE6SJHka9o3gfFPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014748; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FiBwCz4dwAqT37AlnbBbOZ4vWqaWoYHBKFYgRm0agTA=; b=MXUBozmOzDYst3cNysOfV9yYLACSWS0v7pwQYoNreUUN716j5iC8gUCxJsCO/Y1c/FiJPFkQh9yFu7nL8llbtraq7qkePC3bPL+jlHBF2k5tC0nZXItgayaw+O1quoHQidV2LFPxMkENcQd90mPoMifAXGXJT+m6i/u+gyUDKgM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16190147485298.952755637312066; Wed, 21 Apr 2021 07:19:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114605.218442 (Exim 4.92) (envelope-from ) id 1lZDgt-0000hL-9j; Wed, 21 Apr 2021 14:18:55 +0000 Received: by outflank-mailman (output) from mailman id 114605.218442; Wed, 21 Apr 2021 14:18:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgt-0000hD-6p; Wed, 21 Apr 2021 14:18:55 +0000 Received: by outflank-mailman (input) for mailman id 114605; Wed, 21 Apr 2021 14:18:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgs-0000gq-8w for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:18:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fec5f106-5e72-4f63-a3b6-08936010f98d; Wed, 21 Apr 2021 14:18:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7712B4A7; Wed, 21 Apr 2021 14:18:52 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fec5f106-5e72-4f63-a3b6-08936010f98d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014732; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FiBwCz4dwAqT37AlnbBbOZ4vWqaWoYHBKFYgRm0agTA=; b=RoT/kousnB94ZwZVfCZHkz6zIqAIF94qOdwqe8b8ZGrMs3mrTOFwd0zBBF6etjPu4LEumS /MAUd8Y8+tTEfvKc17gcJw77ZMCuuFthejAVH5JM13ch92STSiWm6fF38f3dLJJY9cDwsy EeYCzB+7/PkDjRAxmbhBZkkjw/Er8Q4= Subject: [PATCH v2 02/20] lib: move memcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <0d651bc9-c877-949b-ff04-937f19fa9f89@suse.com> Date: Wed, 21 Apr 2021 16:18:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,27 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif =20 -#ifndef __HAVE_ARCH_MEMCPY -/** - * memcpy - Copy one area of memory to another - * @dest: Where to copy to - * @src: Where to copy from - * @count: The size of the area. - * - * You should not use this function to access IO space, use memcpy_toio() - * or memcpy_fromio() instead. - */ -void *(memcpy)(void *dest, const void *src, size_t count) -{ - char *tmp =3D (char *) dest, *s =3D (char *) src; - - while (count--) - *tmp++ =3D *s++; - - return dest; -} -#endif - #ifndef __HAVE_ARCH_MEMMOVE /** * memmove - Copy one area of memory to another --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -1,9 +1,6 @@ #ifndef __X86_STRING_H__ #define __X86_STRING_H__ =20 -#define __HAVE_ARCH_MEMCPY -#define memcpy(d, s, n) __builtin_memcpy(d, s, n) - #define __HAVE_ARCH_MEMMOVE #define memmove(d, s, n) __builtin_memmove(d, s, n) =20 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D memcpy.o lib-y +=3D memset.o lib-y +=3D muldiv64.o lib-y +=3D parse-size.o --- /dev/null +++ b/xen/lib/memcpy.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memcpy - Copy one area of memory to another + * @dest: Where to copy to + * @src: Where to copy from + * @count: The size of the area. + * + * You should not use this function to access IO space, use memcpy_toio() + * or memcpy_fromio() instead. + */ +void *(memcpy)(void *dest, const void *src, size_t count) +{ + char *tmp =3D (char *) dest, *s =3D (char *) src; + + while (count--) + *tmp++ =3D *s++; + + return dest; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */