Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4496209imu; Tue, 8 Jan 2019 00:59:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN7GMZJJuTlpapypth/3AYj+xoUogG4y9Yrel91GvAKQZBr6/AJ+wKaOSEnq8TH2u72TO94z X-Received: by 2002:a63:5f50:: with SMTP id t77mr791364pgb.76.1546937987445; Tue, 08 Jan 2019 00:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546937987; cv=none; d=google.com; s=arc-20160816; b=wS3ynpQjHkGdmBjmWMyLyU29MOPlCs26oQlp3EGFYylJ59iynLvesM69j4f5FQwHWZ U9MBr9gNxWgPRSyRywqKDjFnwLPlkNZyZQGymOgg62/SBOxqzieFSrHWQQz3+apJE4kv IVOo/3qXgz2WtLpclNSMl2jSdsthiuo17tPUPzM/lzTlNUf0QYPHQZkH5as5J84TIvcm 5cUtDN7kskRxwXDX8cTOOTTOmEIVih9wWy3qsshq1QfA/zQDiFRL3ENJuUytRaQP94XE aUVVsalF8aaDzg2bkHUF5ptjj0KczYb/fDm9QQUThrHNbFpauxNsDMwFbyg4SryMNOze g0VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=kWL9iESX9v88d2DAIewrymBvfFwXJs+BeeB4yg3jpGw=; b=pWeBLOQIj6HLgO/EQ+DMyoO/2BwbDosuKZj9/92yxc7gT1jkrm3xYLz/Arrc0Tur2z D0jroiudbo1D33+Cpq8QmgaSIBK0dam5YORiCWJPYy+EZJ5qCQgAzPgmgo+BHQzTEwoK 7QKdrPJMCBj8ROE33mDJuC8XnctOLZw97crgIPFegKDRfq1DSvK9A58FTIxOGPsLTT6Y 1UQyUlWRh8jHY1+wnu8waE/Gs1TQLRSLvMt1yuXXOIm7evC5vFVWNRuCSNreEp0g7nyH E43FXFVQnwyb3OMu3Zz9gCB9Z/PtwlOPINmPjyfRxx8nehMyYLU76NtVPpx6sRpFKWnN iMug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si2333599pga.38.2019.01.08.00.59.30; Tue, 08 Jan 2019 00:59:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727925AbfAHIqN (ORCPT + 99 others); Tue, 8 Jan 2019 03:46:13 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:60827 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727745AbfAHIqN (ORCPT ); Tue, 8 Jan 2019 03:46:13 -0500 X-IronPort-AV: E=Sophos;i="5.56,453,1539619200"; d="scan'208";a="51545107" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 08 Jan 2019 16:46:05 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 585F04BAC80B; Tue, 8 Jan 2019 16:46:04 +0800 (CST) Received: from [10.167.226.60] (10.167.226.60) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 8 Jan 2019 16:46:03 +0800 Subject: Re: [PATCH] x86/boot: drop memset from copy.S From: Cao jin To: , CC: , , , References: <20190107074056.12532-1-caoj.fnst@cn.fujitsu.com> Message-ID: <4bb8f61a-f93c-4b30-9990-ecf5a8ddc998@cn.fujitsu.com> Date: Tue, 8 Jan 2019 16:46:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190107074056.12532-1-caoj.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.60] X-yoursite-MailScanner-ID: 585F04BAC80B.A9274 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: caoj.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One more question: in compressed/, for mem*(), it seems we both use the macros of boot/string.h, and the functions of compressed/string.c. Is that what we want? compressed/ is compiled with -O2, so it cannot be told by objdump -d, but still can be confirmed by nm <*.o>, for example: $nm arch/x86/boot/compressed/eboot.o U memcpy U memset $nm arch/x86/boot/compressed/pgtable_64.o # No entry of mem*() both of eboot.c and pgtable_64.c #include "../string.h", and use some of mem*(), it is counter-intuitive to me. Very appreciate it someone can leave a hint. -- Sincerely, Cao jin On 1/7/19 3:40 PM, Cao jin wrote: > According to objdump output of setup, function memset is not used in > setup code. Currently, all usage of memset in setup come from macro > definition of string.h. > > Signed-off-by: Cao jin > --- > Compiled and booted under x86_64; compiled under i386. > > Questions: now there is 2 definition of memcpy, one lies in copy.S, > another lies in string.h which is mapped to gcc builtin function. Do we > still need 2 definition? Could we move the content of copy.S to > boot/string.c? > > At first glance, the usage of string.{c.h} of setup is kind of confusing, > they are also used in compressed/ and purgatory/ > > arch/x86/boot/copy.S | 15 --------------- > 1 file changed, 15 deletions(-) > > diff --git a/arch/x86/boot/copy.S b/arch/x86/boot/copy.S > index 15d9f74b0008..5157d08b0ff2 100644 > --- a/arch/x86/boot/copy.S > +++ b/arch/x86/boot/copy.S > @@ -33,21 +33,6 @@ GLOBAL(memcpy) > retl > ENDPROC(memcpy) > > -GLOBAL(memset) > - pushw %di > - movw %ax, %di > - movzbl %dl, %eax > - imull $0x01010101,%eax > - pushw %cx > - shrw $2, %cx > - rep; stosl > - popw %cx > - andw $3, %cx > - rep; stosb > - popw %di > - retl > -ENDPROC(memset) > - > GLOBAL(copy_from_fs) > pushw %ds > pushw %fs >