[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1lk2bs970.fsf@frodo.ebiederm.org>
Date: Thu, 15 May 2008 11:39:47 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: "Huang, Ying" <ying.huang@...el.com>
Cc: Vivek Goyal <vgoyal@...hat.com>, Pavel Machek <pavel@....cz>,
nigel@...el.suspend2.net, "Rafael J. Wysocki" <rjw@...k.pl>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Kexec Mailing List <kexec@...ts.infradead.org>
Subject: Re: [PATCH] kexec based hibernation: a prototype of kexec multi-stage load
"Huang, Ying" <ying.huang@...el.com> writes:
> On Wed, 2008-05-14 at 14:43 -0700, Eric W. Biederman wrote:
> [...]
>> Then as a preliminary design let's plan on this.
>>
>> - Pass the rentry point as the return address (using the C ABI).
>> We may want to load the stack pointer etc so we can act as
>> a direct entry point for new code.
>
> There are some issues about passing entry point as return address. The
> kexec jump (or kexec with return) is used for
>
> - Switching between original kernel (A) and kexeced kernel (B)
> - Call some code (such as BIOS code) in physical mode
>
> 1) When call some code in physical mode, the called code can use a
> simple return to return to kernel A. So there is no return address on
> stack after return to kernel A. Instead, argument 1 is on stack top.
>
> 2) When switch back from kernel B to kernel A, kernel B will call the
> jump back entry of kernel A with C ABI. So, the return address is on
> stack top. And kernel A get jump back entry of kernel B via the return
> address.
>
> Because the stack state is different between 1) and 2), the jump back
> entry of kernel A should distinguish them.
Yes. Because the stack state is different we need to be careful.
However I don't see that we care how we got to the proper piece of
code. If we don't care we don't need to distinguish them.
Therefore I see two possible solutions.
1) Write a tiny trampoline that goes in the core file to keep
the calling conventions sane.
2) After we figure out our address read the stack pointer from
a fixed location and simply set it. (This is my preference)
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists