Re: [PATCH 8/8] x86: put 64bit bzImage high

Eric W. Biederman
2012-11-17T08:44:05Z

Yinghai Lu <yinghai@kernel.org> writes:

> On Fri, Nov 16, 2012 at 10:33 PM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>> Yinghai Lu <yinghai@kernel.org> writes:
>>
>>> also need to make sure pass right 64bit start address to go there
>>> directly later.
>>
>> There are some silly things here but I think the clean way to handle
>> this is to create a kexec/arch/i386/kexec-bzImage64.c that handles
>> loading a bzImage with a 64bit entry point.
>>
>> That should keep the code simpler and easier to read. Although it will
>> probably introduce a bit more code.
>
> please check attached one with kexec-bzImage64.c

Yes that looks better.

So far I have just skimmed the code but this in particular is not
needed. We are going in via the 64bit entry point so there is no
point in ever allocating the real mode buffer in the low 640k.

+ if (info->kexec_flags & (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)) {
+ /* If using bzImage for capture kernel, then we will not be
+ * executing real mode code. setup segment can be loaded
+ * anywhere as we will be just reading command line.
+ */
+ setup_base = add_buffer(info, real_mode, setup_size, setup_size,
+ 16, 0x3000, -1, -1);
+ } else {
+ /* Careful setup_base must be greater than 8K */
+ setup_base = add_buffer(info, real_mode, setup_size, setup_size,
+ 16, 0x3000, 640*1024, 1);
+ }

That should be just;
+ /* No real mode code will be executing. setup segment can be loaded
+ * anywhere as we will be just reading the command line.
+ */
+ setup_base = add_buffer(info, real_mode, setup_size, setup_size,
+ 16, 0x3000, -1, -1);

Eric