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