[PATCH v6 3/6] kexec, x86: Fix bzImage real-mode booting

Yinghai Lu yinghai at kernel.org
Thu Dec 13 19:06:47 EST 2012


On Thu, Dec 13, 2012 at 3:42 PM, H. Peter Anvin <hpa at zytor.com> wrote:
> On 12/13/2012 02:18 PM, Yinghai Lu wrote:
>
>> +       if (real_mode_entry) {
>> +               /* restore can use heap and load high */
>> +               real_mode->loader_flags = 0x81;
>> +               if (real_mode->protocol_version >= 0x0201)
>> +                       real_mode->heap_end_ptr += heap_size - 0x200;
>> /*stack*/
>> +       }
>> +
>
>
> This code is wrong: the bits at the bottom of this field (LOADED_HIGH) are
> kernel->bootloader flags.
>
> The right behavior is:
>
>         if (real_mode->protocol_version >= 0x0201) {
>                 real_mode->loader_flag |= CAN_USE_HEAP;
>
>                 real_mode->heap_end_ptr += heap_size - 0x200; /*stack*/
>         }

ok.
>
>
>> +               regs16.ds = regs16.es = regs16.fs = regs16.gs = setup_base
>> >> 4;
>>
>> +               regs16.cs = regs16.ds + 0x20;
>> +               regs16.ip = 0;
>> +               /* XXX: Documentation/i386/boot.txt says 'ss' must equal
>> 'ds' */
>> +               regs16.ss = (elf_rel_get_addr(&info->rhdr, "stack_end") -
>> 64*1024) >> 4;
>> +               /* XXX: Documentation/i386/boot.txt says 'sp' must equal
>> heap_end */
>> +               regs16.esp = 0xFFFC;
>> +
>
>
> And, pray tell, why aren't they?

?, maybe Eric could answer that.



More information about the kexec mailing list