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.mayd...@linaro.org>; Send time: Friday, Sep 20, 2019 6:36 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 10:25, Libo Zhou <zhl...@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