Re: [PATCH][RFC] swsusp: speed up image restoring on x86-64
From: Rafael J. Wysocki
Date: Fri Jan 21 2005 - 07:48:27 EST
On Friday, 21 of January 2005 11:06, Pavel Machek wrote:
> Hi!
>
> > > Well, I know that current code works. It was produced by C compiler,
> > > btw. Now, new code works for you, but it was not in kernel for 4
> > > releases, and... this code is pretty subtle.
> >
> > Now, I'm confused. :-) It's roughly this:
> >
> > struct pbe *pbe = pagedir_nosave, *end;
> > unsigned n = nr_copy_pages;
> > if (n) {
> > end = pbe + n;
> > do {
> > memcpy((void *)pbe->orig_address, (void *)pbe->address, PAGE_SIZE);
> > pbe++;
> > } while (pbe < end);
> > }
> >
> > where memcpy() is of course a hand-written inline that includes the cr3 manipulation,
> > and pbe, end, n are registers.
>
> For example it may not use any variable in memory, and may not use
> stack, as memory changes under its hands.
Which is not a big problem on x86-64. :-)
> Plus assembly is always subtle ;-).
And that's what makes it interesting.
Greets,
RJW
--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/