> > target_phys_addr_t = physical address of the host > > ram_addr_t = physical address of the guest > > No, target_phys_addr_t is the physical address of the emulated target > system. For host addresses ram_addr_t, unsigned long or even int is > used. Host addresses are of course virtual, Qemu is a user space > application until someone makes it run in bare metal without OS.
Int should never be used to hold an address of any kind, and long probably shouldn't either. The only time you should use these is where you've got a known small offset, e.g after you've subtracted a base (physical) address to get an offset within an MMIO region. Some of the arm devices use uint32_t for addresses, which is really a bug. We get away with it because these are only ever used by 32-bit targets. target_ulong = target virtual address. target_phys_addr_t = target physical address. Because of the way TLB handling works these occasionally need to hold a host address. However these uses are local to the internals of the TLB code, and should never occur anywhere else. In general all access to target memory should be via cpu_physcial_memory_{rw,read,write} For performance reasons we currently make an exception for framebuffer devices and allow them to access ram directly. ram_addr_t holds an offset from phys_ram_base. If you do for some reason have a host address you should use real host pointers. Usermode emulation complicates things a bit, but this isn't relevant for any of the code in hw/. Paul