From: Pavel Machek <pavel@suse.cz>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Pavel Machek <pavel@suse.cz>,
kernel list <linux-kernel@vger.kernel.org>,
ak@suse.de
Subject: Re: swsusp critical code rewritten to assembly
Date: Sun, 10 Nov 2002 20:22:53 +0100 [thread overview]
Message-ID: <20021110192253.GE3068@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <Pine.LNX.4.44.0211101117190.9581-100000@home.transmeta.com>
Hi!
> > do_magic was really too fragile to be written in C. This patch
> > rewrites it into assembly, to make sure C compiler does not generate
> > stack access and corrupt memory that way. Plus it cleans up suspend.c
> > a bit, makes it really free memory it needs, an no longer calls
> > drivers from atomic context.
>
> But this still has stuff in C:
>
> > + asm volatile ("movl %0, %%esp" :: "m" (saved_context_esp));
> > + asm volatile ("movl %0, %%ebp" :: "m" (saved_context_ebp));
> > + asm volatile ("movl %0, %%eax" :: "m" (saved_context_eax));
> > + asm volatile ("movl %0, %%ebx" :: "m" (saved_context_ebx));
> > + asm volatile ("movl %0, %%ecx" :: "m" (saved_context_ecx));
> > + asm volatile ("movl %0, %%edx" :: "m" (saved_context_edx));
> > + asm volatile ("movl %0, %%esi" :: "m" (saved_context_esi));
> > + asm volatile ("movl %0, %%edi" :: "m" (saved_context_edi));
> >
> > - fix_processor_context();
> > + restore_processor_state();
>
> What's up with that? There's no way you can safely restore regular
> registers and _especially_ %%esp from C code, since the compiler may be
> using them for other things.
After applying that patch, this stuff is no longer used for
suspend-to-disk. Its still there for suspend-to-ram; I'll fix that.
Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
prev parent reply other threads:[~2002-11-10 19:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-10 13:21 Pavel Machek
2002-11-10 19:18 ` Linus Torvalds
2002-11-10 19:22 ` Pavel Machek [this message]
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=20021110192253.GE3068@atrey.karlin.mff.cuni.cz \
--to=pavel@suse.cz \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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®