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 23:26:35 +0800	[thread overview]
Message-ID: <tencent_7D89E27172EB5C93465EFBB4@qq.com> (raw)
In-Reply-To: <CAFEAcA87Pb4Mk8McdaZHe41s=Cc1EeCknKfikRm6F+QoxKsdgg@mail.gmail.com>

I actually thought about hacking it to mmap from file into guest memory before running ELF. In include/exec/memory.h, the function memory_region_init_ram_from_file sounds like what I need. But the entire memory.h source file is wrapped by #ifndef CONFIG_USER_ONLY, I cannot use that API in user space emulation, right?

------------------ Original ------------------
From:  "Peter Maydell";<peter.maydell@linaro.org>;
Send time: Friday, Sep 20, 2019 10:55 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 15:49, Libo Zhou <zhlb29@foxmail.com> wrote:
> 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.

QEMU doesn't really support doing that kind of thing, because
actual Linux binaries don't execute in an environment like that.
You could probably hack QEMU to mmap a file into the guest's
memory before we start to run the userspace process, but there's
nothing that will do what you want out of the box.

thanks
-- PMM

  reply	other threads:[~2019-09-20 15:37 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
2019-09-20 14:55     ` Peter Maydell
2019-09-20 15:26       ` Libo Zhou [this message]
2019-09-20 16:08         ` Peter Maydell
2019-09-20 16:29           ` Libo Zhou
  -- strict thread matches above, loose matches on Subject: below --
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_7D89E27172EB5C93465EFBB4@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).