-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file mmap() support #261
Comments
I think this is huge. The vast majority of data copied into guest memory is probably coming from a file anyway. |
yes this will be nice to have. Qemu has something called memory-backend-file, so you might want to look at that to see if we can use it for this API. |
qemu-user seems to think calling mmap directly is fine (target_mmap() here is called from the mmap() syscall handler): https://github.com/hackndev/qemu/blob/master/darwin-user/mmap.c#L225 I just think a portable version of file mapping doesn't really need to be Unicorn's job. All I really want is the ability to make a fixed mapping from guest to existing host memory so I can do whatever I want with it, like invoke any syscall that needs to know the real backing page used by the guest (or manually map the same host region into two Unicorn instances, mostly satisfying my requirements in #142) |
yes, feel free to propose new API and implement it. |
Proposed API usage (as implemented in the pull request):
Permissions are not specified because Unicorn does not control them in this case. Python and Go binding updates have been added to the PR as well. I think this API will be mostly useful in C, Go, and .NET clients, as Java and Python aren't imo as well suited to dumping raw pointers into OS syscalls. |
this is already solved with the new API |
I'd like to be able to directly mmap() files into target memory. I think this is facilitated in qemu-user by doing a "guest-to-host" address translation and just calling mmap() directly. Do host memory addresses backing guest memory ever change position? Something to guarantee a guest address range is backed by a fixed contiguous host memory region would be sufficient for this.
Maybe an API like
guest_fixed_map(host_addr, guest_addr, size)
would work, which points a region of guest memory at an existing region of host memory. This way it's not tied to anything overly platform specific like mmap() APIs.The text was updated successfully, but these errors were encountered: