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.mayd...@linaro.org>; Send time: Friday, Sep 20, 2019 10:55 PM To: "Libo Zhou"<zhl...@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 <zhl...@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