mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-29 19:56:57 +00:00
exec: Add lock parameter to qemu_ram_ptr_length
Commit 04bf2526ce87f21b32c9acba1c5518708c243ad0 (exec: use qemu_ram_ptr_length to access guest ram) start using qemu_ram_ptr_length instead of qemu_map_ram_ptr, but when used with Xen, the behavior of both function is different. They both call xen_map_cache, but one with "lock", meaning the mapping of guest memory is never released implicitly, and the second one without, which means, mapping can be release later, when needed. In the context of address_space_{read,write}_continue, the ptr to those mapping should not be locked because it is used immediatly and never used again. The lock parameter make it explicit in which context qemu_ram_ptr_length is called. Backports commit f5aa69bdc3418773f26747ca282c291519626ece from qemu
This commit is contained in:
parent
d72175d671
commit
567bc68803
|
@ -1510,7 +1510,7 @@ void *qemu_map_ram_ptr(struct uc_struct *uc, RAMBlock *ram_block,
|
|||
/* Return a host pointer to guest's ram. Similar to qemu_map_ram_ptr
|
||||
* but takes a size argument */
|
||||
static void *qemu_ram_ptr_length(struct uc_struct *uc, RAMBlock *ram_block,
|
||||
ram_addr_t addr, hwaddr *size)
|
||||
ram_addr_t addr, hwaddr *size, bool lock)
|
||||
{
|
||||
RAMBlock *block = ram_block;
|
||||
if (*size == 0) {
|
||||
|
@ -2426,7 +2426,7 @@ void *address_space_map(AddressSpace *as,
|
|||
|
||||
memory_region_ref(mr);
|
||||
*plen = address_space_extend_translation(as, addr, len, mr, xlat, l, is_write);
|
||||
ptr = qemu_ram_ptr_length(mr->uc, mr->ram_block, xlat, plen);
|
||||
ptr = qemu_ram_ptr_length(mr->uc, mr->ram_block, xlat, plen, true);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue