From nobody Tue Jun 23 21:13:10 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43676C433EF for ; Fri, 25 Feb 2022 13:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235079AbiBYN4R (ORCPT ); Fri, 25 Feb 2022 08:56:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbiBYN4N (ORCPT ); Fri, 25 Feb 2022 08:56:13 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D477C1DD0F1 for ; Fri, 25 Feb 2022 05:55:40 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id qx21so10981569ejb.13 for ; Fri, 25 Feb 2022 05:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6+U+4OPDxdQ4KBMFnmWDVQB99CK5buLdcQOKTy3BI0c=; b=X5xX9chZz5jQsaB4uh3fPSOca3jrKU0s2CQnIH+pvy6/llYk0OKrGZuoPrwDsew4s7 QJo24ds6T3VSQg+9G3r4F1hGcKnBZswGKI+EelXsDXfSL6qzr//u9M0lwvUwzgjkFt/R YV4J1ZfBu95hJWC72ZBhqMhie522SnbjQCV65n3FqeYZVxeUGxJN0Wq8SPnXhUbA1or+ 5kkzTz5ZVuBXcIXQE71+DrQHGngpqNTQj01HQgtMA4bBxubHMeHcFfeRjYyg0jS9gE1+ sdMix/OAa251eur3e8BiftlPTrtOaawNAX0Q3ADH9RZs9bQqltH9bT3ySUwh9bzknZQW r+Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6+U+4OPDxdQ4KBMFnmWDVQB99CK5buLdcQOKTy3BI0c=; b=Ylf5f+kXFEOOAe/I2sfJrGYePjfB1N8hWuFIfnQJszp0E58o7kEk0nFECUZdAvXkBH WJLigcAVDpHZPXVgD88nEYukKNf/5pdRPZrnBuc0Th8AhW1Te+FP5Q7Ye/auz1QlIdre q8W2l2D+/rEp6OTMIAqOREuhUzYCXoxKotvBjCNECbcOCr4KG0rVmbgUIOdPeoNzMuS3 2RBSPyMCeCwbS3Mq9aAsQPbvPdhsgpeYeflFBGr7NwQVJbfMOgLnRXui9/WrmSDtY1E4 +B8PKt+4IvZPqxbLIVRJMdTSY7nuqlClVNXzDVMHbMDPtsft4779O58/uyrL2+vVMjTF 5Lkw== X-Gm-Message-State: AOAM530VreFAwF+oDr6leK1gzE0khJ88WKJoCGwd0r9gaGh0ooOblv6O p9HCAyCG6BKN7m10LL1sA7G7tcvJK/CzMg== X-Google-Smtp-Source: ABdhPJzuoV70PQn+mUWOJS4WY4lavWofefgR5qJRShxZ5kW26X0Zm7bQdCW/FsSg3tRGsAgtfMsdOg== X-Received: by 2002:a17:906:e218:b0:6cf:7483:36c8 with SMTP id gf24-20020a170906e21800b006cf748336c8mr6103227ejb.747.1645797339174; Fri, 25 Feb 2022 05:55:39 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id fb18-20020a1709073a1200b006ceb0d6441dsm1049743ejc.9.2022.02.25.05.55.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Feb 2022 05:55:38 -0800 (PST) Sender: Michal Simek From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com Cc: Mahesh Bodapati , Randy Dunlap Subject: [PATCH v2 1/3] microblaze: Use simple memset implementation from lib/string.c Date: Fri, 25 Feb 2022 14:55:34 +0100 Message-Id: <4a143e7654f72ee893dcea9769946e17d3570b16.1645797329.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On microblaze systems which are not using OPT_LIB_FUNCTION only simple memset is used. This function is already implemented in lib/string.c that's why it should be used instead. This change is done in respect of issue fixed by commit 33d0f96ffd73 ("lib/string.c: Use freestanding environment") where gcc-10.x moved -ftree-loop-distribute-patterns optimization is to O2 optimization level. This optimization causes GCC to convert the while loop in memset.c into a call to memset. So This optimization is transforming a loop in a memset/memcpy into a call to the function itself. This makes the memset implementation as recursive. Based on fix above -ffreestanding was used and it needs to be used on Microblaze too but the patch is not adding this flag it removes simple implementation to cause that generic implementation is used where this flag is already setup. Signed-off-by: Michal Simek Signed-off-by: Mahesh Bodapati --- Changes in v2: - missing patch in v1 arch/microblaze/include/asm/string.h | 2 ++ arch/microblaze/lib/memset.c | 20 ++------------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/arch/microblaze/include/asm/string.h b/arch/microblaze/include= /asm/string.h index 34071a848b6a..dbdb9eb4a733 100644 --- a/arch/microblaze/include/asm/string.h +++ b/arch/microblaze/include/asm/string.h @@ -8,7 +8,9 @@ =20 #ifdef __KERNEL__ =20 +#ifdef CONFIG_OPT_LIB_FUNCTION #define __HAVE_ARCH_MEMSET +#endif #define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMMOVE =20 diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c index eb6c8988af02..615a2f8f53cb 100644 --- a/arch/microblaze/lib/memset.c +++ b/arch/microblaze/lib/memset.c @@ -30,22 +30,7 @@ #include #include =20 -#ifdef __HAVE_ARCH_MEMSET -#ifndef CONFIG_OPT_LIB_FUNCTION -void *memset(void *v_src, int c, __kernel_size_t n) -{ - char *src =3D v_src; - - /* Truncate c to 8 bits */ - c =3D (c & 0xFF); - - /* Simple, byte oriented memset or the rest of count. */ - while (n--) - *src++ =3D c; - - return v_src; -} -#else /* CONFIG_OPT_LIB_FUNCTION */ +#ifdef CONFIG_OPT_LIB_FUNCTION void *memset(void *v_src, int c, __kernel_size_t n) { char *src =3D v_src; @@ -94,6 +79,5 @@ void *memset(void *v_src, int c, __kernel_size_t n) =20 return v_src; } -#endif /* CONFIG_OPT_LIB_FUNCTION */ EXPORT_SYMBOL(memset); -#endif /* __HAVE_ARCH_MEMSET */ +#endif /* CONFIG_OPT_LIB_FUNCTION */ --=20 2.35.1 From nobody Tue Jun 23 21:13:10 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF41C433F5 for ; Fri, 25 Feb 2022 13:55:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235539AbiBYN4W (ORCPT ); Fri, 25 Feb 2022 08:56:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232498AbiBYN4P (ORCPT ); Fri, 25 Feb 2022 08:56:15 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BBAD20DB30 for ; Fri, 25 Feb 2022 05:55:42 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id h15so7534724edv.7 for ; Fri, 25 Feb 2022 05:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuLFG9NTpKcLVnRYyUUQhtRmRBUPOcoQBht+YhsQp/g=; b=V5BaqrKWmIfKjQDH7LspDEVFF2LgoNQfhbLzPmlr8NgNs3nJBMYAlYsFpdgp2IsUTB ASDRmiLH1gQQ1xLkLEkW4UTKkvR8uVoNmtBiDCty9HV/6sJx4PVk6c8sgD3hloAis0Fe 6vFeWzQn6WsxRi20zYZ6/tesKnA2+/fedGTIuTbRzFhfxGt90s90ZMgYACUkBY0LUv0g 7AxKw4ayG5DW2tLuh9Vvit95OEjXnQqKdDqlyPortoBFud8zOYqULYzuunEtYC+A42mc 2mX/AMNC/DCY8dmzNLmSQ0wCrmh23TA5CSTggzMg92dlGnq04aZrHxViF2jFaedt50tg MYpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KuLFG9NTpKcLVnRYyUUQhtRmRBUPOcoQBht+YhsQp/g=; b=lLrJGCpp3KM4axhjnzYirWNKRs0PuPKx4z4zH7UDSvXkyTOXn24QrBguQWCoG50SxF 3uhTz10eDxR4shu/w+rDdHqgV26o7oc8n9FwaHlMYUcy12rZRnZiraQIVcp9yo97mnuZ gA9WfJY0YItlG8KVobEuzYBm1nooFQpat+O2UYCu0H+gwz2qVorfkUS/BOs4OeFmcGXm DuOKqAX3GiVuaBlvmEGDZDqxv85367dk1YZhZDG82XkQj1MfgCXlavO/04sy5PHkb+t0 lDDW5qBmmuRIZvz7mJ2vK52ylr1aGcLm+habdbxTQeTdT00rv8FRRdXQ6PaY4rGNbZtt KfyA== X-Gm-Message-State: AOAM532D+XMLkzW+7thG677107jDQJ1jFXBMGypfWO3uxeu2IV11HOvd DZTNr9ZhfSyF8L8qBM0a/D/0rbkkRi3A+Q== X-Google-Smtp-Source: ABdhPJwdUAy1M2zh9SsylKzurfqnHLAHo3x9ZQEgBx4fZqZsZ/n8xF2CkJfoqaTlafsr98oCc8N+QA== X-Received: by 2002:a05:6402:369c:b0:413:2bc0:3f00 with SMTP id ej28-20020a056402369c00b004132bc03f00mr7303725edb.126.1645797340664; Fri, 25 Feb 2022 05:55:40 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id bm5-20020a170906c04500b006ce6f8892a5sm1056649ejb.7.2022.02.25.05.55.40 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Feb 2022 05:55:40 -0800 (PST) Sender: Michal Simek From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com Cc: Mahesh Bodapati , Randy Dunlap Subject: [PATCH v2 2/3] microblaze: Do loop unrolling for optimized memset implementation Date: Fri, 25 Feb 2022 14:55:35 +0100 Message-Id: <10a432e269a6d3349cf458e4f5792522779cba0d.1645797329.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Align implementation with memcpy and memmove where also remaining bytes are copied via final switch case instead of using simple implementations which loop. But this alignment has much stronger reason and definitely aligning implementation is not the key point here. It is just good to have in mind that the same technique is used already there. In GCC 10, now -ftree-loop-distribute-patterns optimization is on at O2. This optimization causes GCC to convert the while loop in memset.c into a call to memset. So this optimization is transforming a loop in a memset/memcpy into a call to the function itself. This makes the memset implementation as recursive. "-freestanding" option will disable the built-in library function but it has been added in generic library implementation. In default microblaze kernel defconfig we have CONFIG_OPT_LIB_FUNCTION enabled so it will always pick optimized version of memset which is target specific so we are replacing the while() loop with switch case to avoid recursive memset call. Issue with freestanding was already discussed in connection to commit 33d0f96ffd73 ("lib/string.c: Use freestanding environment") and also this is topic in glibc and gcc. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56888 http://patchwork.ozlabs.org/project/glibc/patch/20191121021040.14554-1-sand= ra@codesourcery.com/ Signed-off-by: Michal Simek Signed-off-by: Mahesh Bodapati --- Changes in v2: - missing patch in v1 arch/microblaze/lib/memset.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/microblaze/lib/memset.c b/arch/microblaze/lib/memset.c index 615a2f8f53cb..7c2352d56bb0 100644 --- a/arch/microblaze/lib/memset.c +++ b/arch/microblaze/lib/memset.c @@ -74,8 +74,19 @@ void *memset(void *v_src, int c, __kernel_size_t n) } =20 /* Simple, byte oriented memset or the rest of count. */ - while (n--) + switch (n) { + case 3: *src++ =3D c; + fallthrough; + case 2: + *src++ =3D c; + fallthrough; + case 1: + *src++ =3D c; + break; + default: + break; + } =20 return v_src; } --=20 2.35.1 From nobody Tue Jun 23 21:13:10 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8008C433F5 for ; Fri, 25 Feb 2022 13:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238218AbiBYN4Z (ORCPT ); Fri, 25 Feb 2022 08:56:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233301AbiBYN4Q (ORCPT ); Fri, 25 Feb 2022 08:56:16 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB52920E7AE for ; Fri, 25 Feb 2022 05:55:43 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id hw13so10994349ejc.9 for ; Fri, 25 Feb 2022 05:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5pSHD0SU+ptLFBEbz9zBf3mjkmvjW9rQOpevS0uGYMs=; b=ieyGbzplsa1pz/EICKUrS5akdyGa0zZvAQf2uRCF/0E8R+BsszAqqJd+XSJ3nLXOcs kuqle1nha6PUFpCamPySnhzxeO/l6jVSI0wIyk+LSRX8eBwwUx2nXC51Vp/Jk+TKLoLz A9gp6xzqpVLmB8iBX9VAYclNM8Nj3mnGU3agyh8c05YI+MyDuHj4BXbbLoDi+inRciKH zKPy0ezKjlkoc9PdGRP+pRBYjZB04tURU+UyRpNgRUCRTDQ0NGasmEbuNmAtqyM/KV7u V13gA2IlaX0onlta7BeiUy9RALBnka8/4iq2HA8weEKW36d6bdeZ5Ik3VQYGI+gdAulY DxvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5pSHD0SU+ptLFBEbz9zBf3mjkmvjW9rQOpevS0uGYMs=; b=XAEDD1yOBbe/S1vVn1CD+YX2gDf+6iYopOUJ0J1vaTVOoEXJ6CFz6HsFrVOXCWEdiL zC/YYY0E/usiL8iCykXtQZBOjg9Du9DUUNRc6oiPniFUEfTv5BxR4o3236pX7PRlMa8i jO8LLYIxMMXMY1u+SKOEcwJRqrrEASqHHIPk8itG07SHKV/r6KtgoJASQNrfymKwAJdY hG/ceFHRwJARltDgJjn7qXc2JrpC+4yMj1mAeNNnIFo7n2R1dD8BEoMT1UXa8N0gHhQF vWKrtGLVrq6XdbAxc1wAWOPzphVXlvEzhPtQixNm21ImisWk1vtFvXkQZ/qLUjJnL3Ju JpOg== X-Gm-Message-State: AOAM5323hcFxycyRts4SZoBAasq2dUMGOX294Cn5flNCj2R+HpQKmGoX A7T7cGDx/8s0/hNl0FWSbBPcncQfodJPVw== X-Google-Smtp-Source: ABdhPJwru0Ch3HnIaFXkHJ7a6WHcw/O/04wTW1z5PapPKsw4ZzYUUCNV0xGbIj8Q4xJZZQcxqwyuWw== X-Received: by 2002:a17:906:4d51:b0:6b8:78e0:565a with SMTP id b17-20020a1709064d5100b006b878e0565amr6152491ejv.587.1645797342213; Fri, 25 Feb 2022 05:55:42 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id d8-20020a170906304800b006cdf8a1e146sm1027809ejd.217.2022.02.25.05.55.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Feb 2022 05:55:41 -0800 (PST) Sender: Michal Simek From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com Cc: Mahesh Bodapati , Randy Dunlap Subject: [PATCH v2 3/3] microblaze: Use simple memmove/memcpy implementation from lib/string.c Date: Fri, 25 Feb 2022 14:55:36 +0100 Message-Id: <1f5cfc026a8a458f3e3134ab80f65bd4ac7e3e8e.1645797329.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This is based on previous commit ("microblaze: Use simple memset implementation from lib/string.c") where generic memset implementation is used when OPT_LIB_FUNCTION is not defined. The same change can be done for memset/memcpy implementation where doesn't make sense to have generic implementation in architecture code. Signed-off-by: Michal Simek --- (no changes since v1) arch/microblaze/include/asm/string.h | 2 +- arch/microblaze/lib/memcpy.c | 18 ++--------------- arch/microblaze/lib/memmove.c | 29 ++-------------------------- 3 files changed, 5 insertions(+), 44 deletions(-) diff --git a/arch/microblaze/include/asm/string.h b/arch/microblaze/include= /asm/string.h index dbdb9eb4a733..8798ad2c132a 100644 --- a/arch/microblaze/include/asm/string.h +++ b/arch/microblaze/include/asm/string.h @@ -10,13 +10,13 @@ =20 #ifdef CONFIG_OPT_LIB_FUNCTION #define __HAVE_ARCH_MEMSET -#endif #define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMMOVE =20 extern void *memset(void *, int, __kernel_size_t); extern void *memcpy(void *, const void *, __kernel_size_t); extern void *memmove(void *, const void *, __kernel_size_t); +#endif =20 #endif /* __KERNEL__ */ =20 diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c index 63041fdf916d..9966dce55619 100644 --- a/arch/microblaze/lib/memcpy.c +++ b/arch/microblaze/lib/memcpy.c @@ -31,20 +31,7 @@ =20 #include =20 -#ifdef __HAVE_ARCH_MEMCPY -#ifndef CONFIG_OPT_LIB_FUNCTION -void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) -{ - const char *src =3D v_src; - char *dst =3D v_dst; - - /* Simple, byte oriented memcpy. */ - while (c--) - *dst++ =3D *src++; - - return v_dst; -} -#else /* CONFIG_OPT_LIB_FUNCTION */ +#ifdef CONFIG_OPT_LIB_FUNCTION void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c) { const char *src =3D v_src; @@ -188,6 +175,5 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_s= ize_t c) =20 return v_dst; } -#endif /* CONFIG_OPT_LIB_FUNCTION */ EXPORT_SYMBOL(memcpy); -#endif /* __HAVE_ARCH_MEMCPY */ +#endif /* CONFIG_OPT_LIB_FUNCTION */ diff --git a/arch/microblaze/lib/memmove.c b/arch/microblaze/lib/memmove.c index 9862f6b1e59d..2e49d0ef1e07 100644 --- a/arch/microblaze/lib/memmove.c +++ b/arch/microblaze/lib/memmove.c @@ -30,31 +30,7 @@ #include #include =20 -#ifdef __HAVE_ARCH_MEMMOVE -#ifndef CONFIG_OPT_LIB_FUNCTION -void *memmove(void *v_dst, const void *v_src, __kernel_size_t c) -{ - const char *src =3D v_src; - char *dst =3D v_dst; - - if (!c) - return v_dst; - - /* Use memcpy when source is higher than dest */ - if (v_dst <=3D v_src) - return memcpy(v_dst, v_src, c); - - /* copy backwards, from end to beginning */ - src +=3D c; - dst +=3D c; - - /* Simple, byte oriented memmove. */ - while (c--) - *--dst =3D *--src; - - return v_dst; -} -#else /* CONFIG_OPT_LIB_FUNCTION */ +#ifdef CONFIG_OPT_LIB_FUNCTION void *memmove(void *v_dst, const void *v_src, __kernel_size_t c) { const char *src =3D v_src; @@ -215,6 +191,5 @@ void *memmove(void *v_dst, const void *v_src, __kernel_= size_t c) } return v_dst; } -#endif /* CONFIG_OPT_LIB_FUNCTION */ EXPORT_SYMBOL(memmove); -#endif /* __HAVE_ARCH_MEMMOVE */ +#endif /* CONFIG_OPT_LIB_FUNCTION */ --=20 2.35.1