From: Christian Ruppert <christian.ruppert@abilis.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Pavel Roskin <proski@gnu.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Vineet Gupta <Vineet.Gupta1@synopsys.com>,
Noam Camus <noamc@ezchip.com>
Subject: Re: [PATCH 2/2] x86: Add support for uncompressed kernel images
Date: Fri, 15 Nov 2013 10:49:33 +0100 [thread overview]
Message-ID: <20131115094931.GB31656@ab42.lan> (raw)
In-Reply-To: <52850C28.8010800@zytor.com>
On Thu, Nov 14, 2013 at 09:45:12AM -0800, H. Peter Anvin wrote:
> On 11/14/2013 12:38 AM, Christian Ruppert wrote:
> > diff --git a/lib/decompress_copy.c b/lib/decompress_copy.c
> > new file mode 100644
> > index 0000000..8a41090
> > --- /dev/null
> > +++ b/lib/decompress_copy.c
> > @@ -0,0 +1,47 @@
> > +#include <linux/decompress/mm.h>
> > +
> > +#define NOZIP_BUFSZ (16 * 1024)
> > +STATIC int INIT nozip(unsigned char *buf, int len,
> > + int(*fill)(void*, unsigned int),
> > + int(*flush)(void*, unsigned int),
> > + unsigned char *outbuf,
> > + int *pos,
> > + void(*error)(char *x))
> > +{
> > + char *b;
> > +
> > + if (buf)
> > + b = buf;
> > + else
> > + b = malloc(NOZIP_BUFSZ);
> > +
> > + if (!b) {
> > + error("Out of memory while allocating buffer");
> > + return -1;
> > + }
> > +
> > + if (flush) {
> > + if (!len)
> > + len = fill(b, NOZIP_BUFSZ);
> > +
> > + len = flush(b, len);
> > + } else {
> > + if (!len)
> > + len = fill(outbuf, NOZIP_BUFSZ);
> > + else {
> > + int i;
> > + for (i = 0; i < len; i++)
> > + outbuf[i] = b[i];
>
> Clever way of doing memcpy(). I know some other compression
> implementations open-code memmove(), but using it for the entire data
> set in the most common case is atrocious. If we need to get a default
> implementation of memmove() we should just do that.
Actually, the x86 architecture already contains a basic implementation
of memcpy in its self-decompressor. Correct me if I'm wrong but I guess
memmove is not required since I don't expect the output of a generic
decompression function to overlap with its input.
We can simply use that function if we agree that
. either nozip is x86 specific
. or every architecture using this code must bring along its own memcpy
implementation in its self-decompressor.
Do you think that would be OK?
Greetings,
Christian
next prev parent reply other threads:[~2013-11-15 9:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 16:34 Uncompressed kernel doesn't build on x86_64 Pavel Roskin
2013-11-13 16:49 ` H. Peter Anvin
2013-11-14 8:32 ` Christian Ruppert
2013-11-14 8:38 ` [PATCH 1/2] init/Kconfig: add option to disable kernel compression Christian Ruppert
2013-11-14 10:21 ` Vineet Gupta
2013-11-15 16:57 ` Christian Ruppert
2013-11-16 9:41 ` Vineet Gupta
2013-11-14 8:38 ` [PATCH 2/2] x86: Add support for uncompressed kernel images Christian Ruppert
2013-11-14 17:31 ` H. Peter Anvin
2013-11-15 9:31 ` Christian Ruppert
2013-11-14 17:45 ` H. Peter Anvin
2013-11-15 9:49 ` Christian Ruppert [this message]
2013-11-15 10:06 ` H. Peter Anvin
2013-11-14 14:13 ` Uncompressed kernel doesn't build on x86_64 Austin S Hemmelgarn
2013-11-14 23:38 ` Pavel Roskin
2013-11-18 9:48 [PATCH] [FIX] init/Kconfig: fix option to disable kernel compression Christian Ruppert
2013-11-18 9:51 ` [PATCH 2/2] x86: Add support for uncompressed kernel images Christian Ruppert
2013-11-18 11:25 ` Borislav Petkov
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=20131115094931.GB31656@ab42.lan \
--to=christian.ruppert@abilis.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=noamc@ezchip.com \
--cc=proski@gnu.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
all inboxes | Powered by JetHome®