qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jaeyong Yoo <jaeyong.yoo@samsung.com>
To: 'Laszlo Ersek' <lersek@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Where is vga-rom mapped in guest system memory?
Date: Fri, 16 May 2014 13:19:15 +0900	[thread overview]
Message-ID: <00b701cf70bd$ff94b7a0$febe26e0$%yoo@samsung.com> (raw)
In-Reply-To: <5374C97B.2000702@redhat.com>

> -----Original Message-----
> From: qemu-devel-bounces+jaeyong.yoo=samsung.com@nongnu.org [mailto:qemu-
> devel-bounces+jaeyong.yoo=samsung.com@nongnu.org] On Behalf Of Laszlo
> Ersek
> Sent: Thursday, May 15, 2014 11:05 PM
> To: Jaeyong Yoo; qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] Where is vga-rom mapped in guest system memory?
> 
> On 05/15/14 15:25, Jaeyong Yoo wrote:
> >> I rely on the qemu debug port rather than on serial:
> >>
> >>   -debugcon file:debug.log -global isa-debugcon.iobase=0x402
> >>
> >> Check the DEBUG_IO and DEBUG_LEVEL settings in the SeaBIOS config as
> well.
> >
> > Thanks Laszlo! Now I can see the log message in VirtualBox vgabios
> > with qemu debug port.
> >
> > By the way, I've got one more question, which is very strange for me.
> >
> > I tried to print a string and the values read by the string address do
> > not look correct. More specifically, I wrote the following code in
> VirtualBox vga-bios:
> >
> > char *msg = "Start Vgabios\n";
> >
> > for (i = msg; ++i; *i != 0)
> > {
> >     outb(0x402, *i);
> > }
> >
> > And, I expect to see the message "Start Vgabios" in the debug port,
> > but it doesn't work. If I object-dump the related parts in VirtualBox
> > vga-bios, I can see that the msg (msg = 0x7eea) properly contains
> > "Start Vgabios". And, if I print the value of i in vga-bios, it gives
> > 0x7eea (which is correct address). Then I expect that *i should be 'S'
> > but *I gives zero. I checked the vga-rom size field and it properly
> > covers the actual size of vgarom. Then, I think qemu properly map the
> entire vgarom in the proper, so it won't be an issue.
> >
> > Is there some issues with memory addressing that I'm missing?
> 
> You are probably in real mode. The above outb() loop probably translates
> to something like this:
> 
> 00000000  3E8A04            mov al,[ds:si]
> 00000003  BA0204            mov dx,0x402
> 00000006  EE                out dx,al
> 00000007  46                inc si
> 
> (objdump -S will allow you to see it exactly.)
> 
> My take is that ds is not set correctly. You might have to set ds manually,
> or at least decorate the definition of the string with some gcc section
> attribute so that the compiler places the string in a section that will be
> "automatically" matched by ds.
> 
> Or, you might be able to test it like this:
> - first, change the type of "msg" from "pointer to character" to "array of
> characters":
> 
>   char msg[] = "Start Vgabios\n"
> 
> - second, give it automatic storage duration, rather than static storage
> duration. In English, make it local to the function containing the loop.
> Hopefully the compiler will generate code that places the string on the
> stack then, and then your loop body will (hopefully) look something like
> 
> 00000000  368A02            mov al,[ss:bp+si]
> 00000003  BA0204            mov dx,0x402
> 00000006  EE                out dx,al
> 00000007  46                inc si
> 
> (Ie. work off your stack, where ss and bp should be "just right".)
> 
> I'm just guessing of course.

Thanks a lot Laszlo,
The problem was ds as you guessed! After I set ds the same as cs, I can
see log messages correctly! And, I can start porting VirtualBox vgabios
to work on qemu.

By the way, would there be no-issue of VBox vgabios (16-bit code) working
with seaBIOS? I'm guessing not, but I want to double check.


Thanks,
Jaeyong

  reply	other threads:[~2014-05-16  4:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 12:58 [Qemu-devel] Where is vga-rom mapped in guest system memory? Jaeyong Yoo
2014-05-13 13:54 ` Laszlo Ersek
2014-05-14  4:01   ` Jaeyong Yoo
2014-05-14 10:55     ` Laszlo Ersek
2014-05-14 11:41       ` Jaeyong Yoo
2014-05-14 11:54         ` Laszlo Ersek
2014-05-15 13:25           ` Jaeyong Yoo
2014-05-15 14:04             ` Laszlo Ersek
2014-05-16  4:19               ` Jaeyong Yoo [this message]
2014-05-16  9:36                 ` Laszlo Ersek

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='00b701cf70bd$ff94b7a0$febe26e0$%yoo@samsung.com' \
    --to=jaeyong.yoo@samsung.com \
    --cc=lersek@redhat.com \
    --cc=qemu-devel@nongnu.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).