func: void *cpu_physical_memory_map(hwaddr hwaddr int is_write) return address_space_map ( & address_space_memory , addr , plen , is_write ) ; void *address_space_map(AddressSpace hwaddr hwaddr bool is_write) hwaddr len = * plen ; hwaddr l , xlat , base ; MemoryRegion * mr , * this_mr ; if ( len == 0 )  l = len; mr = address_space_translate ( as , addr , & xlat , & l , is_write ); MemoryRegion *address_space_translate(AddressSpace *as, hwaddr hwaddr *xlat, hwaddr bool is_write) IOMMUTLBEntry iotlb ; MemoryRegionSection * section ; MemoryRegion * mr ; section = address_space_translate_internal ( as -> dispatch , addr , & addr , plen , true ); mr = section -> mr; if ( ! mr -> iommu_ops )  iotlb = mr -> iommu_ops -> translate ( mr , addr ); addr = ( ( iotlb . translated_addr & ~iotlb . addr_mask ) | ( addr & iotlb . addr_mask ) ); if ( ! ( iotlb . perm & ( 1 << is_write ) ) )  mr = & io_mem_unassigned; as = iotlb . target_as; return mr ; if ( ! memory_access_is_direct ( mr , is_write ) )  static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write) if ( memory_region_is_ram ( mr ) )  return ! ( is_write && mr -> readonly ) ; if ( memory_region_is_romd ( mr ) )  return ! is_write ; return false ; if ( bounce . buffer )  bounce . buffer = qemu_memalign ( TARGET_PAGE_SIZE , TARGET_PAGE_SIZE ); bounce . addr = addr; bounce . len = l; bounce . mr = mr; if ( ! is_write )  address_space_read ( as , addr , bounce . buffer , l ); bool address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len) return address_space_rw ( as , addr , buf , len , false ) ; bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t int len, bool is_write) hwaddr l ; uint8_t * ptr ; hwaddr addr1 ; MemoryRegion * mr ; while ( len > 0 )  l = len; mr = address_space_translate ( as , addr , & addr1 , & l , is_write ); if ( is_write )  if ( ! memory_access_is_direct ( mr , is_write ) )  l = memory_access_size ( mr , l , addr1 ); val = ldq_p ( buf ); error |= io_mem_write ( mr , addr1 , val , 8 ); val = ldl_p ( buf ); error |= io_mem_write ( mr , addr1 , val , 4 ); val = lduw_p ( buf ); error |= io_mem_write ( mr , addr1 , val , 2 ); val = ldub_p ( buf ); error |= io_mem_write ( mr , addr1 , val , 1 ); addr1 += memory_region_get_ram_addr ( mr ); memcpy ( ptr , buf , l ); if ( ! memory_access_is_direct ( mr , is_write ) )  l = memory_access_size ( mr , l , addr1 ); error |= io_mem_read ( mr , addr1 , & val , 8 ); stq_p ( buf , val ); error |= io_mem_read ( mr , addr1 , & val , 4 ); stl_p ( buf , val ); error |= io_mem_read ( mr , addr1 , & val , 2 ); stw_p ( buf , val ); error |= io_mem_read ( mr , addr1 , & val , 1 ); stb_p ( buf , val ); ptr = qemu_get_ram_ptr ( mr -> ram_addr + addr1 ); memcpy ( buf , ptr , l ); len -= l; buf += l; addr += l; return error ; 