[7085] Remove code phys_ram_base uses.
Revision: 7085
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7085 Author: pbrook Date: 2009-04-11 14:47:08 +0000 (Sat, 11 Apr 2009)
Log Message:
-----------
Remove code phys_ram_base uses.
Signed-off-by Paul Brook <[email protected]>
Modified Paths:
--------------
trunk/cpu-all.h
trunk/exec-all.h
trunk/exec.c
trunk/kvm-all.c
trunk/vl.c
Modified: trunk/cpu-all.h
===================================================================
cpu-all.h +3 -0
@@ -908,6 +908,9 @@void qemu_ram_free (ram_addr_t addr);/* This should only be used for ram local to a device. */ void *qemu_get_ram_ptr (ram_addr_t addr); +/* This should not be used by devices. */ +ram_addr_t qemu_ram_addr_from_host (void *ptr); + int cpu_register_io_memory(int io_index, CPUReadMemoryFunc **mem_read, CPUWriteMemoryFunc **mem_write,
Modified: trunk/exec-all.h
===================================================================
exec-all.h +4 -1
@@ -316,6 +316,7 @@static inline target_ulong get_phys_addr_code (CPUState *env1,target_ulong addr) {int mmu_idx, page_index, pd; +void *p; page_index = (addr >>TARGET_PAGE_BITS ) & (CPU_TLB_SIZE -1 ); mmu_idx =cpu_mmu_index (env1);
@@ -331,7 +332,9 @@cpu_abort (env1,"Trying to execute code outside RAM or ROM at 0x" TARGET_FMT_lx"\n" , addr);#endif } -return addr + env1->tlb_table[mmu_idx][page_index].addend - (unsigned long )phys_ram_base; + p = (void *)(unsigned long )addr + + env1->tlb_table[mmu_idx][page_index].addend; +return qemu_ram_addr_from_host (p); }/* Deterministic execution requires that IO only be performed on the last
Modified: trunk/exec.c
===================================================================
exec.c +41 -19
175 lines not on this page · raw message
Modified: trunk/kvm-all.c
===================================================================
kvm-all.c +2 -2
@@ -101,7 +101,7 @@ mem.slot = slot->slot; mem.guest_phys_addr = slot->start_addr; mem.memory_size = slot->memory_size; - mem.userspace_addr = (unsigned long )phys_ram_base + slot->phys_offset; + mem.userspace_addr = (unsigned long )qemu_get_ram_ptr (slot->phys_offset); mem.flags = slot->flags;return kvm_vm_ioctl (s,KVM_SET_USER_MEMORY_REGION , &mem);
@@ -329,7 +329,7 @@/* initially, KVM allocated its own memory and we had to jump through * hooks to make phys_ram_base point to this. Modern versions of KVM -* just use a user allocated buffer so we can use phys_ram_base +* just use a user allocated buffer so we can use regular pages * unmodified. Make sure we have a sufficiently modern version of KVM. */ ret =kvm_ioctl (s,KVM_CHECK_EXTENSION ,KVM_CAP_USER_MEMORY );
Modified: trunk/vl.c
===================================================================
vl.c +10 -9
@@ -3097,7 +3097,7 @@if (qemu_get_be32 (f) != phys_ram_size)return -EINVAL ;for (i =0 ; i < phys_ram_size; i+=TARGET_PAGE_SIZE ) { - ret =ram_get_page (f, phys_ram_base + i,TARGET_PAGE_SIZE ); + ret =ram_get_page (f,qemu_get_ram_ptr (i),TARGET_PAGE_SIZE );if (ret)return ret; }
@@ -3184,20 +3184,20 @@while (addr < phys_ram_size) {if (cpu_physical_memory_get_dirty (current_addr,MIGRATION_DIRTY_FLAG )) { -uint8_t ch; +uint8_t *p;cpu_physical_memory_reset_dirty (current_addr, current_addr +TARGET_PAGE_SIZE ,MIGRATION_DIRTY_FLAG ); - ch = *(phys_ram_base + current_addr); + p =qemu_get_ram_ptr (current_addr); -if (is_dup_page (phys_ram_base + current_addr, ch)) { +if (is_dup_page (p, *p)) {qemu_put_be64 (f, current_addr |RAM_SAVE_FLAG_COMPRESS ); -qemu_put_byte (f, ch); +qemu_put_byte (f, *p); }else {qemu_put_be64 (f, current_addr |RAM_SAVE_FLAG_PAGE ); -qemu_put_buffer (f, phys_ram_base + current_addr,TARGET_PAGE_SIZE ); +qemu_put_buffer (f, p,TARGET_PAGE_SIZE ); } found =1 ;
@@ -3278,7 +3278,8 @@ goto error; }if (buf[0 ] ==0 ) { -if (ram_decompress_buf (s, phys_ram_base + i,BDRV_HASH_BLOCK_SIZE ) <0 ) { +if (ram_decompress_buf (s,qemu_get_ram_ptr (i), +BDRV_HASH_BLOCK_SIZE ) <0 ) {fprintf (stderr,"Error while reading ram block address=0x%08" PRIx64, (uint64_t )i); goto error; }
@@ -3328,9 +3329,9 @@if (flags &RAM_SAVE_FLAG_COMPRESS ) {uint8_t ch =qemu_get_byte (f); -memset (phys_ram_base + addr, ch,TARGET_PAGE_SIZE ); +memset (qemu_get_ram_ptr (addr), ch,TARGET_PAGE_SIZE ); }else if (flags &RAM_SAVE_FLAG_PAGE ) -qemu_get_buffer (f, phys_ram_base + addr,TARGET_PAGE_SIZE ); +qemu_get_buffer (f,qemu_get_ram_ptr (addr),TARGET_PAGE_SIZE ); }while (!(flags &RAM_SAVE_FLAG_EOS ));return 0 ;