linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thavatchai Makphaibulcboke <thavatchai.makpahibulchoke@hp.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] lib/decompress_unxz.c: removing all memory helper functions
Date: Tue, 12 Jun 2012 19:45:29 +0000	[thread overview]
Message-ID: <4FD79C59.80205@hp.com> (raw)
In-Reply-To: <1339522812.2404.4.camel@joe2Laptop>

On 06/12/2012 11:40 AM, Joe Perches wrote:
> On Tue, 2012-06-12 at 10:30 -0700, H. Peter Anvin wrote:
>> On 06/12/2012 10:26 AM, Nicolas Pitre wrote:
>>>
>>> Instead of copying, maybe this would be much better to make the content 
>>> of lib/string.c usable in a pre-boot environment.
> 
>> Not sure about that... a lot of it is #ifndef __HAVE_ARCH_* and you
>> *really* want those optimizations on some arches.
> 
> Can __weak be used?
> 

lib/string.c contains a lot of stuff that are not needed in preboot, and
would increase the kernel image size.  I'm not sure if we will be able
to make it usable in pre-boot and only bringing in what is needed by
preboot, withtut unnecessarily complicated lib/string.c.

Thanks Joe for the suggestion.  I guess we could remove the #ifndef by
renaming all arch specific mem helper functions to arch_<name>, and
declaring them with a weak attribute in mem.c and let the mem.c check to
see if it is provided, Here is an example for memcpy

Architecture specific,

void *arch_memcpy(void *__dest, __const void *__src, size_t __n)
{
...
}


lib/mem.c

extern void *arch_memcpy(void *__dest, __const void *__src, size_t __n)
__attribute __((weak));

void *memcpy(void *__dest, __const void *__src, size_t __n)
{
        if (arch_memcpy) {
		arch_memcpgoogly();
		return;	
	}

}

But this does not solve the memmove issue. Could we always trust
arch_memcpy in all architectures?  I guess the safest way would be to
use memmove in string.c.  Please let me know if you have any thoughts or
suggestions.

Thanks,
Mak.

.

  reply	other threads:[~2012-06-12 19:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  3:05 [PATCH v2] lib/decompress_unxz.c: removing all memory helper functions T Makphaibulchoke
2012-06-12  3:16 ` H. Peter Anvin
2012-06-12 14:35   ` Russell King - ARM Linux
2012-06-14 13:47     ` Russell King - ARM Linux
2012-06-14 14:35       ` H. Peter Anvin
2012-06-14 15:44         ` Russell King - ARM Linux
2012-06-14 16:15           ` H. Peter Anvin
2012-06-13  9:32   ` Martin Schwidefsky
2012-06-14 18:23   ` Russell King - ARM Linux
2012-06-12  3:27 ` Paul Mundt
2012-06-12 16:18 ` Lasse Collin
2012-06-12 17:26   ` Nicolas Pitre
2012-06-12 17:30     ` H. Peter Anvin
2012-06-12 17:40       ` Joe Perches
2012-06-12 19:45         ` Thavatchai Makphaibulcboke [this message]
2012-06-12 17:44       ` Nicolas Pitre
2012-06-12 17:48         ` H. Peter Anvin
2012-06-12 17:49           ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FD79C59.80205@hp.com \
    --to=thavatchai.makpahibulchoke@hp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).