From: "Marc Marí" <markmb@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>,
Kevin O'Connor <kevin@koconnor.net>,
Laszlo Ersek <lersek@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] Add optionrom compatible with fw_cfg DMA version
Date: Fri, 8 Jan 2016 17:05:51 +0100 [thread overview]
Message-ID: <20160108170551.304fe666@markmb_rh> (raw)
In-Reply-To: <568FDB9F.7080709@redhat.com>
On Fri, 8 Jan 2016 16:54:07 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 08/01/2016 15:58, Marc Marí wrote:
> >
> > +static inline uint16_t readw_addr32(const void *addr) {
> > + uint16_t val;
> > + asm("addr32 movw %1, %0" : "=r"(val) : "g"(addr));
> > + barrier();
> > + return val;
> > +}
> > +
>
> Does SeaBIOS ensure that DS base is zero here?
DS = CS:
" movw %cs, %ax\n"
" movw %ax, %ds\n"
At the beginning of the ROM.
> > +static void transition32(void)
> > +{
> > + extern void *gdt;
> > + uint32_t data_segment;
> > + struct length_addr rombios_gdt;
> > +
> > + data_segment = read_ds();
> > + rombios_gdt.addr = (uint32_t)((data_segment << 4) +
> > (uint32_t)(&gdt));
> > + rombios_gdt.length = (3 * 8) - 1;
> > +
> > + /* Load GDT */
> > + asm("data32 lgdt %0" : : "m"(rombios_gdt): "memory");
> > +
> > + /* Get us to protected mode and set ES to a 32 bit segment
> > */
> > + asm("mov $1, %%eax\n"
> > + "mov %%eax, %%cr0\n"
> > + "mov $0x10, %%eax\n"
> > + "mov %%eax, %%es\n"
> > + : : : "eax");
> > +
> > + /* We're now running in 16-bit CS, but 32-bit ES! */
> > +}
>
> Do you even need to go to 32-bit mode? The only reason to do so in
> the original ROM was to do a "rep insb" above 1 GB, but here fw_cfg
> can do DMA to high addresses for you.
There's no need of course. I was looking at the original ROM and I did
not think this through.
Thanks for your comments
Marc
next prev parent reply other threads:[~2016-01-08 16:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 14:58 [Qemu-devel] [PATCH] Add optionrom compatible with fw_cfg DMA version Marc Marí
2016-01-08 15:54 ` Paolo Bonzini
2016-01-08 16:05 ` Marc Marí [this message]
2016-01-08 16:09 ` 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=20160108170551.304fe666@markmb_rh \
--to=markmb@redhat.com \
--cc=gsomlo@gmail.com \
--cc=kevin@koconnor.net \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.