pub unsafe extern "C" fn memory_region_from_host(
    ptr: *mut c_void,
    offset: *mut ram_addr_t
) -> *mut MemoryRegion
Expand description

memory_region_from_host: Convert a pointer into a RAM memory region and an offset within it.

Given a host pointer inside a RAM memory region (created with memory_region_init_ram() or memory_region_init_ram_ptr()), return the MemoryRegion and the offset within it.

Use with care; by the time this function returns, the returned pointer is not protected by RCU anymore. If the caller is not within an RCU critical section and does not hold the iothread lock, it must have other means of protecting the pointer, such as a reference to the region that includes the incoming ram_addr_t.

@mr: the memory region being queried.