public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Haren Myneni <hbabu@us.ibm.com>,
	Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [PATCH v6 3/6] kexec, x86: Fix bzImage real-mode booting
Date: Thu, 13 Dec 2012 15:42:55 -0800	[thread overview]
Message-ID: <50CA67FF.90009@zytor.com> (raw)
In-Reply-To: <1355437112-9250-4-git-send-email-yinghai@kernel.org>

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.


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2012-12-13 23:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 22:18 [PATCH v6 0/6] kexec: put bzImage and ramdisk above 4G for x86 64bit Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 1/6] kexec, x86: add boot header member for version 2.12 Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 2/6] kexec, x86: clean boot_params area for entry-32bit path Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 3/6] kexec, x86: Fix bzImage real-mode booting Yinghai Lu
2012-12-13 23:42   ` H. Peter Anvin [this message]
2012-12-14  0:06     ` Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 4/6] kexec, x86: put ramdisk/cmd_line above 4G for 64bit bzImage Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 5/6] kexec, x86_64: Load bzImage64 above 4G Yinghai Lu
2012-12-13 22:18 ` [PATCH v6 6/6] kexec, x86: handle Crash low kernel range Yinghai Lu
2012-12-14  0:41 ` [PATCH v6 0/6] kexec: put bzImage and ramdisk above 4G for x86 64bit H. Peter Anvin
2012-12-14  0:47   ` Yinghai Lu

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=50CA67FF.90009@zytor.com \
    --to=hpa@zytor.com \
    --cc=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=vgoyal@redhat.com \
    --cc=yinghai@kernel.org \
    /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