[PATCH v6 3/6] kexec, x86: Fix bzImage real-mode booting
H. Peter Anvin
hpa at zytor.com
Thu Dec 13 18:42:55 EST 2012
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*/
}
> + 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?
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
More information about the kexec
mailing list