From: Keir Fraser <keir@xen.org>
To: Jan Beulich <JBeulich@suse.com>, xen-devel <xen-devel@lists.xen.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3] x86: find a better location for the real-mode trampoline
Date: Thu, 17 Jan 2013 15:53:01 +0000 [thread overview]
Message-ID: <CD1DCEDD.590E5%keir@xen.org> (raw)
In-Reply-To: <50F823AB02000078000B6E12@nat28.tlf.novell.com>
On 17/01/2013 15:15, "Jan Beulich" <JBeulich@suse.com> wrote:
> On some machines, the location at 0x40e does not point to the beginning
> of the EBDA. Rather, it points to the beginning of the BIOS-reserved
> area of the EBDA, while the option ROMs place their data below that
> segment.
>
> For this reason, 0x413 is actually a better source than 0x40e to get
> the location of the real-mode trampoline. Xen was already using it
> as a second source, and this patch keeps that working. However, just
> in case, let's also fetch the information from the multiboot structure,
> where the boot loader should have placed it. This way we don't
> necessarily trust one of the BIOS or the multiboot loader more than
> the other.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Retain the previous code, thus using the multiboot value only if it's
> sane but lower than the BDA computed one. Also use the full 32-bit
> mem_lower value and prefer MBI_MEMLIMITS over open coding it (requiring
> a slight adjustment to multiboot.h to make its constants actually
> usable in assembly code, which previously they were only meant to be).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -88,6 +88,20 @@ __start:
> movzwl 0x413,%eax /* use base memory size on failure */
> shl $10-4,%eax
> 1:
> + /*
> + * Compare the value in the BDA with the information from the
> + * multiboot structure (if available) and use the smallest.
> + */
> + testb $MBI_MEMLIMITS,(%ebx)
> + jz 2f /* not available? BDA value will be fine
> */
> + mov 4(%ebx),%edx
> + cmp $0x100,%edx /* is the multiboot value too small? */
> + jb 2f /* if so, do not use it */
> + shl $10-4,%edx
> + cmp %eax,%edx /* compare with BDA value */
> + cmovb %edx,%eax /* and use the smaller */
> +
> +2: /* Reserve 64kb for the trampoline */
> sub $0x1000,%eax
>
> /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */
> --- a/xen/include/xen/multiboot.h
> +++ b/xen/include/xen/multiboot.h
> @@ -18,6 +18,7 @@
> #ifndef __MULTIBOOT_H__
> #define __MULTIBOOT_H__
>
> +#include "const.h"
>
> /*
> * Multiboot header structure.
> @@ -31,17 +32,17 @@
> /* The magic number passed by a Multiboot-compliant boot loader. */
> #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
>
> -#define MBI_MEMLIMITS (1u<< 0)
> -#define MBI_BOOTDEV (1u<< 1)
> -#define MBI_CMDLINE (1u<< 2)
> -#define MBI_MODULES (1u<< 3)
> -#define MBI_AOUT_SYMS (1u<< 4)
> -#define MBI_ELF_SYMS (1u<< 5)
> -#define MBI_MEMMAP (1u<< 6)
> -#define MBI_DRIVES (1u<< 7)
> -#define MBI_BIOSCONFIG (1u<< 8)
> -#define MBI_LOADERNAME (1u<< 9)
> -#define MBI_APM (1u<<10)
> +#define MBI_MEMLIMITS (_AC(1,u) << 0)
> +#define MBI_BOOTDEV (_AC(1,u) << 1)
> +#define MBI_CMDLINE (_AC(1,u) << 2)
> +#define MBI_MODULES (_AC(1,u) << 3)
> +#define MBI_AOUT_SYMS (_AC(1,u) << 4)
> +#define MBI_ELF_SYMS (_AC(1,u) << 5)
> +#define MBI_MEMMAP (_AC(1,u) << 6)
> +#define MBI_DRIVES (_AC(1,u) << 7)
> +#define MBI_BIOSCONFIG (_AC(1,u) << 8)
> +#define MBI_LOADERNAME (_AC(1,u) << 9)
> +#define MBI_APM (_AC(1,u) << 10)
>
> #ifndef __ASSEMBLY__
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
prev parent reply other threads:[~2013-01-17 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 15:15 [PATCH v3] x86: find a better location for the real-mode trampoline Jan Beulich
2013-01-17 15:53 ` Keir Fraser [this message]
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=CD1DCEDD.590E5%keir@xen.org \
--to=keir@xen.org \
--cc=JBeulich@suse.com \
--cc=pbonzini@redhat.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).