qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Libo Zhou" <zhlb29@foxmail.com>
To: "Peter Maydell" <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re:  Initialize data memory in user space emulation
Date: Fri, 20 Sep 2019 22:49:30 +0800	[thread overview]
Message-ID: <tencent_5378456F7A2F471F74C049FC@qq.com> (raw)
In-Reply-To: <CAFEAcA9QDrwUAdZWX7n_gO9afnT4n9+i8ZdqOcxrNbvi6n9=sw@mail.gmail.com>

Hi Peter,

Thanks for your explanation. Please let me add more details about what I need to do.

I need to emulate a Digital Signal Processor. The DSP essentially has only basic MIPS ISA, and it manipulates the data stored in a "data memory". I can run an ELF with user space emulation, what I need to additionally do is to initialize the "data memory" first, then run an ELF that manipulates the data in the "data memory", and finally see if the resulting data are correct or not.

Do you have any suggestions?

Cheers,
Libo Zhou

------------------ Original ------------------
From:  "Peter Maydell";<peter.maydell@linaro.org>;
Send time: Friday, Sep 20, 2019 6:36 PM
To: "Libo Zhou"<zhlb29@foxmail.com>; 
Cc: "qemu-devel"<qemu-devel@nongnu.org>; 
Subject:  Re: Initialize data memory in user space emulation

On Fri, 20 Sep 2019 at 10:25, Libo Zhou <zhlb29@foxmail.com> wrote:
>
> Hi all,
>
> I need a way to manipulate data saved in a reserved memory region in linux user space emulation. I found the -B option very promising.  Documentation says it is useful when the address region required by guest applications is reserved on the host.
>
> But how can I initialize that memory with data?

Hi -- this isn't really what the -B option does. What -B does
is set the 'guest base', which is the offset between what the
guest sees as its address 0 and what the host's address is. So
if you use -B to set the guest_base to 0x10000000, then when the
guest tries to mmap() a file to address 0x20000000 then we will
put the file at host address 0x30000000 (the address the guest
asks for plus the guest_base).

There is no way at all for the guest to access any data below the
guest_base address. The reason this option exists is in case the
default value QEMU chooses for guest_base would result in the guest
trying to mmap files in places that are already used by the host
QEMU binary or libraries. It's almost never an option users need
to set.

I'm not really sure what you mean by "a reserved memory region",
so it's a bit hard to say what might be the best way to do what
you want to do.

thanks
-- PMM

  reply	other threads:[~2019-09-20 15:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  9:15 Initialize data memory in user space emulation Libo Zhou
2019-09-20 10:36 ` Peter Maydell
2019-09-20 14:49   ` Libo Zhou [this message]
2019-09-20 14:55     ` Peter Maydell
2019-09-20 15:26       ` Libo Zhou
2019-09-20 16:08         ` Peter Maydell
2019-09-20 16:29           ` Libo Zhou
2019-09-20  9:40 Libo Zhou

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=tencent_5378456F7A2F471F74C049FC@qq.com \
    --to=zhlb29@foxmail.com \
    --cc=peter.maydell@linaro.org \
    --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).