From: Konrad Rzeszutek Wilk <konrad@kernel.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH] xen: find a better location for the real-mode trampoline
Date: Fri, 7 Dec 2012 16:23:37 -0500 [thread overview]
Message-ID: <20121207212336.GD9664@phenom.dumpdata.com> (raw)
In-Reply-To: <50B87D6E02000078000ACBF2@nat28.tlf.novell.com>
On Fri, Nov 30, 2012 at 08:33:34AM +0000, Jan Beulich wrote:
> >>> On 29.11.12 at 18:34, Paolo Bonzini <pbonzini@redhat.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. But it is even better to
> > fetch the information from the multiboot structure, where the boot
> > loader has placed the data for us already.
>
> I think if anything we really should make this a minimum calculation
> of all three (sanity checked) values, rather than throwing the other
> sources out. It's just not certain enough that we can trust all
> multiboot implementations.
>
> Of course, ideally we'd consult the memory map, but the E820 one
> is unavailable at that point (and getting at it would create a
> chicken-and-egg problem).
Can we scan the memory for the possible EBDA regions? There is an
"EBDA" type header in those regions, if I recall?
>
> Jan
>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > xen/arch/x86/boot/head.S | 21 ++++++++++++---------
> > 1 file changed, 12 insertions(+), 9 deletions(-)
> >
> > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> > index 7efa155..1790462 100644
> > --- a/xen/arch/x86/boot/head.S
> > +++ b/xen/arch/x86/boot/head.S
> > @@ -78,16 +78,19 @@ __start:
> > cmp $0x2BADB002,%eax
> > jne not_multiboot
> >
> > - /* Set up trampoline segment 64k below EBDA */
> > - movzwl 0x40e,%eax /* EBDA segment */
> > - cmp $0xa000,%eax /* sanity check (high) */
> > - jae 0f
> > - cmp $0x4000,%eax /* sanity check (low) */
> > - jae 1f
> > -0:
> > - movzwl 0x413,%eax /* use base memory size on failure */
> > - shl $10-4,%eax
> > + /* Set up trampoline segment just below end of base memory.
> > + * Prefer to get this information from the multiboot
> > + * structure, if available.
> > + */
> > + mov 4(%ebx),%eax /* kb of low memory */
> > + testb $1,(%ebx) /* test MBI_MEMLIMITS */
> > + jnz 1f
> > +
> > + movzwl 0x413,%eax /* base memory size in kb */
> > 1:
> > + shl $10-4,%eax /* convert to a segment number */
> > +
> > + /* Reserve 64kb for the trampoline */
> > sub $0x1000,%eax
> >
> > /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */
> > --
> > 1.8.0
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
next prev parent reply other threads:[~2012-12-07 21:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 17:34 [PATCH] xen: find a better location for the real-mode trampoline Paolo Bonzini
2012-11-30 8:33 ` Jan Beulich
2012-12-07 21:23 ` Konrad Rzeszutek Wilk [this message]
2012-12-10 9:34 ` Jan Beulich
2012-12-18 13:07 ` Jan Beulich
2012-12-18 13:22 ` Paolo Bonzini
2012-12-18 13:27 ` Jan Beulich
2012-12-18 13:28 ` Paolo Bonzini
2012-12-18 13:36 ` Jan Beulich
2012-12-18 13:39 ` Paolo Bonzini
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=20121207212336.GD9664@phenom.dumpdata.com \
--to=konrad@kernel.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).