Diff for /qemu/exec.c between versions 1.1.1.10 and 1.1.1.11

version 1.1.1.10, 2018/04/24 17:20:56 version 1.1.1.11, 2018/04/24 17:34:40
Line 70 Line 70
 #define TARGET_VIRT_ADDR_SPACE_BITS 42  #define TARGET_VIRT_ADDR_SPACE_BITS 42
 #elif defined(TARGET_PPC64)  #elif defined(TARGET_PPC64)
 #define TARGET_PHYS_ADDR_SPACE_BITS 42  #define TARGET_PHYS_ADDR_SPACE_BITS 42
 #elif defined(TARGET_X86_64) && !defined(CONFIG_KQEMU)  #elif defined(TARGET_X86_64)
 #define TARGET_PHYS_ADDR_SPACE_BITS 42  #define TARGET_PHYS_ADDR_SPACE_BITS 42
 #elif defined(TARGET_I386) && !defined(CONFIG_KQEMU)  #elif defined(TARGET_I386)
 #define TARGET_PHYS_ADDR_SPACE_BITS 36  #define TARGET_PHYS_ADDR_SPACE_BITS 36
 #else  #else
 /* Note: for compatibility with kqemu, we use 32 bits for x86_64 */  
 #define TARGET_PHYS_ADDR_SPACE_BITS 32  #define TARGET_PHYS_ADDR_SPACE_BITS 32
 #endif  #endif
   
Line 206  static int tb_phys_invalidate_count; Line 205  static int tb_phys_invalidate_count;
 #define SUBPAGE_IDX(addr) ((addr) & ~TARGET_PAGE_MASK)  #define SUBPAGE_IDX(addr) ((addr) & ~TARGET_PAGE_MASK)
 typedef struct subpage_t {  typedef struct subpage_t {
     target_phys_addr_t base;      target_phys_addr_t base;
     CPUReadMemoryFunc **mem_read[TARGET_PAGE_SIZE][4];      CPUReadMemoryFunc * const *mem_read[TARGET_PAGE_SIZE][4];
     CPUWriteMemoryFunc **mem_write[TARGET_PAGE_SIZE][4];      CPUWriteMemoryFunc * const *mem_write[TARGET_PAGE_SIZE][4];
     void *opaque[TARGET_PAGE_SIZE][2][4];      void *opaque[TARGET_PAGE_SIZE][2][4];
     ram_addr_t region_offset[TARGET_PAGE_SIZE][2][4];      ram_addr_t region_offset[TARGET_PAGE_SIZE][2][4];
 } subpage_t;  } subpage_t;
Line 464  static void code_gen_alloc(unsigned long Line 463  static void code_gen_alloc(unsigned long
             exit(1);              exit(1);
         }          }
     }      }
 #elif defined(__FreeBSD__) || defined(__DragonFly__)  #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
     {      {
         int flags;          int flags;
         void *addr = NULL;          void *addr = NULL;
Line 514  void cpu_exec_init_all(unsigned long tb_ Line 513  void cpu_exec_init_all(unsigned long tb_
   
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)  #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
   
 #define CPU_COMMON_SAVE_VERSION 1  static void cpu_common_pre_save(void *opaque)
   
 static void cpu_common_save(QEMUFile *f, void *opaque)  
 {  {
     CPUState *env = opaque;      CPUState *env = opaque;
   
     cpu_synchronize_state(env, 0);      cpu_synchronize_state(env);
   
     qemu_put_be32s(f, &env->halted);  
     qemu_put_be32s(f, &env->interrupt_request);  
 }  }
   
 static int cpu_common_load(QEMUFile *f, void *opaque, int version_id)  static int cpu_common_pre_load(void *opaque)
 {  {
     CPUState *env = opaque;      CPUState *env = opaque;
   
     if (version_id != CPU_COMMON_SAVE_VERSION)      cpu_synchronize_state(env);
         return -EINVAL;      return 0;
   }
   
   static int cpu_common_post_load(void *opaque, int version_id)
   {
       CPUState *env = opaque;
   
     qemu_get_be32s(f, &env->halted);  
     qemu_get_be32s(f, &env->interrupt_request);  
     /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the      /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the
        version_id is increased. */         version_id is increased. */
     env->interrupt_request &= ~0x01;      env->interrupt_request &= ~0x01;
     tlb_flush(env, 1);      tlb_flush(env, 1);
     cpu_synchronize_state(env, 1);  
   
     return 0;      return 0;
 }  }
   
   static const VMStateDescription vmstate_cpu_common = {
       .name = "cpu_common",
       .version_id = 1,
       .minimum_version_id = 1,
       .minimum_version_id_old = 1,
       .pre_save = cpu_common_pre_save,
       .pre_load = cpu_common_pre_load,
       .post_load = cpu_common_post_load,
       .fields      = (VMStateField []) {
           VMSTATE_UINT32(halted, CPUState),
           VMSTATE_UINT32(interrupt_request, CPUState),
           VMSTATE_END_OF_LIST()
       }
   };
 #endif  #endif
   
 CPUState *qemu_get_cpu(int cpu)  CPUState *qemu_get_cpu(int cpu)
Line 575  void cpu_exec_init(CPUState *env) Line 586  void cpu_exec_init(CPUState *env)
     }      }
     env->cpu_index = cpu_index;      env->cpu_index = cpu_index;
     env->numa_node = 0;      env->numa_node = 0;
     TAILQ_INIT(&env->breakpoints);      QTAILQ_INIT(&env->breakpoints);
     TAILQ_INIT(&env->watchpoints);      QTAILQ_INIT(&env->watchpoints);
     *penv = env;      *penv = env;
 #if defined(CONFIG_USER_ONLY)  #if defined(CONFIG_USER_ONLY)
     cpu_list_unlock();      cpu_list_unlock();
 #endif  #endif
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)  #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
     register_savevm("cpu_common", cpu_index, CPU_COMMON_SAVE_VERSION,      vmstate_register(cpu_index, &vmstate_cpu_common, env);
                     cpu_common_save, cpu_common_load, env);  
     register_savevm("cpu", cpu_index, CPU_SAVE_VERSION,      register_savevm("cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);                      cpu_save, cpu_load, env);
 #endif  #endif
Line 1338  int cpu_watchpoint_insert(CPUState *env, Line 1348  int cpu_watchpoint_insert(CPUState *env,
   
     /* keep all GDB-injected watchpoints in front */      /* keep all GDB-injected watchpoints in front */
     if (flags & BP_GDB)      if (flags & BP_GDB)
         TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);          QTAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
     else      else
         TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);          QTAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
   
     tlb_flush_page(env, addr);      tlb_flush_page(env, addr);
   
Line 1356  int cpu_watchpoint_remove(CPUState *env, Line 1366  int cpu_watchpoint_remove(CPUState *env,
     target_ulong len_mask = ~(len - 1);      target_ulong len_mask = ~(len - 1);
     CPUWatchpoint *wp;      CPUWatchpoint *wp;
   
     TAILQ_FOREACH(wp, &env->watchpoints, entry) {      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
         if (addr == wp->vaddr && len_mask == wp->len_mask          if (addr == wp->vaddr && len_mask == wp->len_mask
                 && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {                  && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
             cpu_watchpoint_remove_by_ref(env, wp);              cpu_watchpoint_remove_by_ref(env, wp);
Line 1369  int cpu_watchpoint_remove(CPUState *env, Line 1379  int cpu_watchpoint_remove(CPUState *env,
 /* Remove a specific watchpoint by reference.  */  /* Remove a specific watchpoint by reference.  */
 void cpu_watchpoint_remove_by_ref(CPUState *env, CPUWatchpoint *watchpoint)  void cpu_watchpoint_remove_by_ref(CPUState *env, CPUWatchpoint *watchpoint)
 {  {
     TAILQ_REMOVE(&env->watchpoints, watchpoint, entry);      QTAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
   
     tlb_flush_page(env, watchpoint->vaddr);      tlb_flush_page(env, watchpoint->vaddr);
   
Line 1381  void cpu_watchpoint_remove_all(CPUState  Line 1391  void cpu_watchpoint_remove_all(CPUState 
 {  {
     CPUWatchpoint *wp, *next;      CPUWatchpoint *wp, *next;
   
     TAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {      QTAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
         if (wp->flags & mask)          if (wp->flags & mask)
             cpu_watchpoint_remove_by_ref(env, wp);              cpu_watchpoint_remove_by_ref(env, wp);
     }      }
Line 1401  int cpu_breakpoint_insert(CPUState *env, Line 1411  int cpu_breakpoint_insert(CPUState *env,
   
     /* keep all GDB-injected breakpoints in front */      /* keep all GDB-injected breakpoints in front */
     if (flags & BP_GDB)      if (flags & BP_GDB)
         TAILQ_INSERT_HEAD(&env->breakpoints, bp, entry);          QTAILQ_INSERT_HEAD(&env->breakpoints, bp, entry);
     else      else
         TAILQ_INSERT_TAIL(&env->breakpoints, bp, entry);          QTAILQ_INSERT_TAIL(&env->breakpoints, bp, entry);
   
     breakpoint_invalidate(env, pc);      breakpoint_invalidate(env, pc);
   
Line 1421  int cpu_breakpoint_remove(CPUState *env, Line 1431  int cpu_breakpoint_remove(CPUState *env,
 #if defined(TARGET_HAS_ICE)  #if defined(TARGET_HAS_ICE)
     CPUBreakpoint *bp;      CPUBreakpoint *bp;
   
     TAILQ_FOREACH(bp, &env->breakpoints, entry) {      QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
         if (bp->pc == pc && bp->flags == flags) {          if (bp->pc == pc && bp->flags == flags) {
             cpu_breakpoint_remove_by_ref(env, bp);              cpu_breakpoint_remove_by_ref(env, bp);
             return 0;              return 0;
Line 1437  int cpu_breakpoint_remove(CPUState *env, Line 1447  int cpu_breakpoint_remove(CPUState *env,
 void cpu_breakpoint_remove_by_ref(CPUState *env, CPUBreakpoint *breakpoint)  void cpu_breakpoint_remove_by_ref(CPUState *env, CPUBreakpoint *breakpoint)
 {  {
 #if defined(TARGET_HAS_ICE)  #if defined(TARGET_HAS_ICE)
     TAILQ_REMOVE(&env->breakpoints, breakpoint, entry);      QTAILQ_REMOVE(&env->breakpoints, breakpoint, entry);
   
     breakpoint_invalidate(env, breakpoint->pc);      breakpoint_invalidate(env, breakpoint->pc);
   
Line 1451  void cpu_breakpoint_remove_all(CPUState  Line 1461  void cpu_breakpoint_remove_all(CPUState 
 #if defined(TARGET_HAS_ICE)  #if defined(TARGET_HAS_ICE)
     CPUBreakpoint *bp, *next;      CPUBreakpoint *bp, *next;
   
     TAILQ_FOREACH_SAFE(bp, &env->breakpoints, entry, next) {      QTAILQ_FOREACH_SAFE(bp, &env->breakpoints, entry, next) {
         if (bp->flags & mask)          if (bp->flags & mask)
             cpu_breakpoint_remove_by_ref(env, bp);              cpu_breakpoint_remove_by_ref(env, bp);
     }      }
Line 1492  void cpu_set_log(int log_flags) Line 1502  void cpu_set_log(int log_flags)
             static char logfile_buf[4096];              static char logfile_buf[4096];
             setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));              setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
         }          }
 #else  #elif !defined(_WIN32)
           /* Win32 doesn't support line-buffering and requires size >= 2 */
         setvbuf(logfile, NULL, _IOLBF, 0);          setvbuf(logfile, NULL, _IOLBF, 0);
 #endif  #endif
         log_append = 1;          log_append = 1;
Line 1515  void cpu_set_log_filename(const char *fi Line 1526  void cpu_set_log_filename(const char *fi
   
 static void cpu_unlink_tb(CPUState *env)  static void cpu_unlink_tb(CPUState *env)
 {  {
 #if defined(USE_NPTL)  #if defined(CONFIG_USE_NPTL)
     /* FIXME: TB unchaining isn't SMP safe.  For now just ignore the      /* FIXME: TB unchaining isn't SMP safe.  For now just ignore the
        problem and hope the cpu will stop of its own accord.  For userspace         problem and hope the cpu will stop of its own accord.  For userspace
        emulation this often isn't actually as bad as it sounds.  Often         emulation this often isn't actually as bad as it sounds.  Often
Line 1701  CPUState *cpu_copy(CPUState *env) Line 1712  CPUState *cpu_copy(CPUState *env)
     /* Clone all break/watchpoints.      /* Clone all break/watchpoints.
        Note: Once we support ptrace with hw-debug register access, make sure         Note: Once we support ptrace with hw-debug register access, make sure
        BP_CPU break/watchpoints are handled correctly on clone. */         BP_CPU break/watchpoints are handled correctly on clone. */
     TAILQ_INIT(&env->breakpoints);      QTAILQ_INIT(&env->breakpoints);
     TAILQ_INIT(&env->watchpoints);      QTAILQ_INIT(&env->watchpoints);
 #if defined(TARGET_HAS_ICE)  #if defined(TARGET_HAS_ICE)
     TAILQ_FOREACH(bp, &env->breakpoints, entry) {      QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
         cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);          cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
     }      }
     TAILQ_FOREACH(wp, &env->watchpoints, entry) {      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
         cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,          cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
                               wp->flags, NULL);                                wp->flags, NULL);
     }      }
Line 1762  void tlb_flush(CPUState *env, int flush_ Line 1773  void tlb_flush(CPUState *env, int flush_
   
     memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));      memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
   
 #ifdef CONFIG_KQEMU  
     if (env->kqemu_enabled) {  
         kqemu_flush(env, flush_global);  
     }  
 #endif  
     tlb_flush_count++;      tlb_flush_count++;
 }  }
   
Line 1800  void tlb_flush_page(CPUState *env, targe Line 1806  void tlb_flush_page(CPUState *env, targe
         tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr);          tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr);
   
     tlb_flush_jmp_cache(env, addr);      tlb_flush_jmp_cache(env, addr);
   
 #ifdef CONFIG_KQEMU  
     if (env->kqemu_enabled) {  
         kqemu_flush_page(env, addr);  
     }  
 #endif  
 }  }
   
 /* update the TLBs so that writes to code in the virtual page 'addr'  /* update the TLBs so that writes to code in the virtual page 'addr'
Line 1853  void cpu_physical_memory_reset_dirty(ram Line 1853  void cpu_physical_memory_reset_dirty(ram
     if (length == 0)      if (length == 0)
         return;          return;
     len = length >> TARGET_PAGE_BITS;      len = length >> TARGET_PAGE_BITS;
 #ifdef CONFIG_KQEMU  
     /* XXX: should not depend on cpu context */  
     env = first_cpu;  
     if (env->kqemu_enabled) {  
         ram_addr_t addr;  
         addr = start;  
         for(i = 0; i < len; i++) {  
             kqemu_set_notdirty(env, addr);  
             addr += TARGET_PAGE_SIZE;  
         }  
     }  
 #endif  
     mask = ~dirty_flags;      mask = ~dirty_flags;
     p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);      p = phys_ram_dirty + (start >> TARGET_PAGE_BITS);
     for(i = 0; i < len; i++)      for(i = 0; i < len; i++)
Line 2021  int tlb_set_page_exec(CPUState *env, tar Line 2009  int tlb_set_page_exec(CPUState *env, tar
     code_address = address;      code_address = address;
     /* Make accesses to pages with watchpoints go via the      /* Make accesses to pages with watchpoints go via the
        watchpoint trap routines.  */         watchpoint trap routines.  */
     TAILQ_FOREACH(wp, &env->watchpoints, entry) {      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
         if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {          if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
             iotlb = io_mem_watch + paddr;              iotlb = io_mem_watch + paddr;
             /* TODO: The memory case can be optimized by not trapping              /* TODO: The memory case can be optimized by not trapping
Line 2303  static void *subpage_init (target_phys_a Line 2291  static void *subpage_init (target_phys_a
         }                                                               \          }                                                               \
     } while (0)      } while (0)
   
 /* register physical memory. 'size' must be a multiple of the target  /* register physical memory.
    page size. If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an     For RAM, 'size' must be a multiple of the target page size.
      If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an
    io memory page.  The address used when calling the IO function is     io memory page.  The address used when calling the IO function is
    the offset from the start of the region, plus region_offset.  Both     the offset from the start of the region, plus region_offset.  Both
    start_addr and region_offset are rounded down to a page boundary     start_addr and region_offset are rounded down to a page boundary
Line 2321  void cpu_register_physical_memory_offset Line 2310  void cpu_register_physical_memory_offset
     ram_addr_t orig_size = size;      ram_addr_t orig_size = size;
     void *subpage;      void *subpage;
   
 #ifdef CONFIG_KQEMU  
     /* XXX: should not depend on cpu context */  
     env = first_cpu;  
     if (env->kqemu_enabled) {  
         kqemu_set_phys_mem(start_addr, size, phys_offset);  
     }  
 #endif  
     if (kvm_enabled())      if (kvm_enabled())
         kvm_set_phys_mem(start_addr, size, phys_offset);          kvm_set_phys_mem(start_addr, size, phys_offset);
   
Line 2422  void qemu_unregister_coalesced_mmio(targ Line 2404  void qemu_unregister_coalesced_mmio(targ
         kvm_uncoalesce_mmio_region(addr, size);          kvm_uncoalesce_mmio_region(addr, size);
 }  }
   
 #ifdef CONFIG_KQEMU  
 /* XXX: better than nothing */  
 static ram_addr_t kqemu_ram_alloc(ram_addr_t size)  
 {  
     ram_addr_t addr;  
     if ((last_ram_offset + size) > kqemu_phys_ram_size) {  
         fprintf(stderr, "Not enough memory (requested_size = %" PRIu64 ", max memory = %" PRIu64 ")\n",  
                 (uint64_t)size, (uint64_t)kqemu_phys_ram_size);  
         abort();  
     }  
     addr = last_ram_offset;  
     last_ram_offset = TARGET_PAGE_ALIGN(last_ram_offset + size);  
     return addr;  
 }  
 #endif  
   
 ram_addr_t qemu_ram_alloc(ram_addr_t size)  ram_addr_t qemu_ram_alloc(ram_addr_t size)
 {  {
     RAMBlock *new_block;      RAMBlock *new_block;
   
 #ifdef CONFIG_KQEMU  
     if (kqemu_phys_ram_base) {  
         return kqemu_ram_alloc(size);  
     }  
 #endif  
   
     size = TARGET_PAGE_ALIGN(size);      size = TARGET_PAGE_ALIGN(size);
     new_block = qemu_malloc(sizeof(*new_block));      new_block = qemu_malloc(sizeof(*new_block));
   
   #if defined(TARGET_S390X) && defined(CONFIG_KVM)
       /* XXX S390 KVM requires the topmost vma of the RAM to be < 256GB */
       new_block->host = mmap((void*)0x1000000, size, PROT_EXEC|PROT_READ|PROT_WRITE,
                              MAP_SHARED | MAP_ANONYMOUS, -1, 0);
   #else
     new_block->host = qemu_vmalloc(size);      new_block->host = qemu_vmalloc(size);
   #endif
   #ifdef MADV_MERGEABLE
       madvise(new_block->host, size, MADV_MERGEABLE);
   #endif
     new_block->offset = last_ram_offset;      new_block->offset = last_ram_offset;
     new_block->length = size;      new_block->length = size;
   
Line 2490  void *qemu_get_ram_ptr(ram_addr_t addr) Line 2459  void *qemu_get_ram_ptr(ram_addr_t addr)
     RAMBlock **prevp;      RAMBlock **prevp;
     RAMBlock *block;      RAMBlock *block;
   
 #ifdef CONFIG_KQEMU  
     if (kqemu_phys_ram_base) {  
         return kqemu_phys_ram_base + addr;  
     }  
 #endif  
   
     prev = NULL;      prev = NULL;
     prevp = &ram_blocks;      prevp = &ram_blocks;
     block = ram_blocks;      block = ram_blocks;
Line 2528  ram_addr_t qemu_ram_addr_from_host(void  Line 2491  ram_addr_t qemu_ram_addr_from_host(void 
     RAMBlock *block;      RAMBlock *block;
     uint8_t *host = ptr;      uint8_t *host = ptr;
   
 #ifdef CONFIG_KQEMU  
     if (kqemu_phys_ram_base) {  
         return host - kqemu_phys_ram_base;  
     }  
 #endif  
   
     prev = NULL;      prev = NULL;
     prevp = &ram_blocks;      prevp = &ram_blocks;
     block = ram_blocks;      block = ram_blocks;
Line 2556  static uint32_t unassigned_mem_readb(voi Line 2513  static uint32_t unassigned_mem_readb(voi
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);      printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 0, 0, 0, 1);      do_unassigned_access(addr, 0, 0, 0, 1);
 #endif  #endif
     return 0;      return 0;
Line 2567  static uint32_t unassigned_mem_readw(voi Line 2524  static uint32_t unassigned_mem_readw(voi
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);      printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 0, 0, 0, 2);      do_unassigned_access(addr, 0, 0, 0, 2);
 #endif  #endif
     return 0;      return 0;
Line 2578  static uint32_t unassigned_mem_readl(voi Line 2535  static uint32_t unassigned_mem_readl(voi
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);      printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 0, 0, 0, 4);      do_unassigned_access(addr, 0, 0, 0, 4);
 #endif  #endif
     return 0;      return 0;
Line 2589  static void unassigned_mem_writeb(void * Line 2546  static void unassigned_mem_writeb(void *
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);      printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 1, 0, 0, 1);      do_unassigned_access(addr, 1, 0, 0, 1);
 #endif  #endif
 }  }
Line 2599  static void unassigned_mem_writew(void * Line 2556  static void unassigned_mem_writew(void *
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);      printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 1, 0, 0, 2);      do_unassigned_access(addr, 1, 0, 0, 2);
 #endif  #endif
 }  }
Line 2609  static void unassigned_mem_writel(void * Line 2566  static void unassigned_mem_writel(void *
 #ifdef DEBUG_UNASSIGNED  #ifdef DEBUG_UNASSIGNED
     printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);      printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val);
 #endif  #endif
 #if defined(TARGET_SPARC)  #if defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)
     do_unassigned_access(addr, 1, 0, 0, 4);      do_unassigned_access(addr, 1, 0, 0, 4);
 #endif  #endif
 }  }
   
 static CPUReadMemoryFunc *unassigned_mem_read[3] = {  static CPUReadMemoryFunc * const unassigned_mem_read[3] = {
     unassigned_mem_readb,      unassigned_mem_readb,
     unassigned_mem_readw,      unassigned_mem_readw,
     unassigned_mem_readl,      unassigned_mem_readl,
 };  };
   
 static CPUWriteMemoryFunc *unassigned_mem_write[3] = {  static CPUWriteMemoryFunc * const unassigned_mem_write[3] = {
     unassigned_mem_writeb,      unassigned_mem_writeb,
     unassigned_mem_writew,      unassigned_mem_writew,
     unassigned_mem_writel,      unassigned_mem_writel,
Line 2638  static void notdirty_mem_writeb(void *op Line 2595  static void notdirty_mem_writeb(void *op
 #endif  #endif
     }      }
     stb_p(qemu_get_ram_ptr(ram_addr), val);      stb_p(qemu_get_ram_ptr(ram_addr), val);
 #ifdef CONFIG_KQEMU  
     if (cpu_single_env->kqemu_enabled &&  
         (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)  
         kqemu_modify_page(cpu_single_env, ram_addr);  
 #endif  
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been      /* we remove the notdirty callback only if the code has been
Line 2663  static void notdirty_mem_writew(void *op Line 2615  static void notdirty_mem_writew(void *op
 #endif  #endif
     }      }
     stw_p(qemu_get_ram_ptr(ram_addr), val);      stw_p(qemu_get_ram_ptr(ram_addr), val);
 #ifdef CONFIG_KQEMU  
     if (cpu_single_env->kqemu_enabled &&  
         (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)  
         kqemu_modify_page(cpu_single_env, ram_addr);  
 #endif  
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been      /* we remove the notdirty callback only if the code has been
Line 2688  static void notdirty_mem_writel(void *op Line 2635  static void notdirty_mem_writel(void *op
 #endif  #endif
     }      }
     stl_p(qemu_get_ram_ptr(ram_addr), val);      stl_p(qemu_get_ram_ptr(ram_addr), val);
 #ifdef CONFIG_KQEMU  
     if (cpu_single_env->kqemu_enabled &&  
         (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK)  
         kqemu_modify_page(cpu_single_env, ram_addr);  
 #endif  
     dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);      dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;      phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
     /* we remove the notdirty callback only if the code has been      /* we remove the notdirty callback only if the code has been
Line 2701  static void notdirty_mem_writel(void *op Line 2643  static void notdirty_mem_writel(void *op
         tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);          tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);
 }  }
   
 static CPUReadMemoryFunc *error_mem_read[3] = {  static CPUReadMemoryFunc * const error_mem_read[3] = {
     NULL, /* never used */      NULL, /* never used */
     NULL, /* never used */      NULL, /* never used */
     NULL, /* never used */      NULL, /* never used */
 };  };
   
 static CPUWriteMemoryFunc *notdirty_mem_write[3] = {  static CPUWriteMemoryFunc * const notdirty_mem_write[3] = {
     notdirty_mem_writeb,      notdirty_mem_writeb,
     notdirty_mem_writew,      notdirty_mem_writew,
     notdirty_mem_writel,      notdirty_mem_writel,
Line 2731  static void check_watchpoint(int offset, Line 2673  static void check_watchpoint(int offset,
         return;          return;
     }      }
     vaddr = (env->mem_io_vaddr & TARGET_PAGE_MASK) + offset;      vaddr = (env->mem_io_vaddr & TARGET_PAGE_MASK) + offset;
     TAILQ_FOREACH(wp, &env->watchpoints, entry) {      QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
         if ((vaddr == (wp->vaddr & len_mask) ||          if ((vaddr == (wp->vaddr & len_mask) ||
              (vaddr & wp->len_mask) == wp->vaddr) && (wp->flags & flags)) {               (vaddr & wp->len_mask) == wp->vaddr) && (wp->flags & flags)) {
             wp->flags |= BP_WATCHPOINT_HIT;              wp->flags |= BP_WATCHPOINT_HIT;
Line 2800  static void watch_mem_writel(void *opaqu Line 2742  static void watch_mem_writel(void *opaqu
     stl_phys(addr, val);      stl_phys(addr, val);
 }  }
   
 static CPUReadMemoryFunc *watch_mem_read[3] = {  static CPUReadMemoryFunc * const watch_mem_read[3] = {
     watch_mem_readb,      watch_mem_readb,
     watch_mem_readw,      watch_mem_readw,
     watch_mem_readl,      watch_mem_readl,
 };  };
   
 static CPUWriteMemoryFunc *watch_mem_write[3] = {  static CPUWriteMemoryFunc * const watch_mem_write[3] = {
     watch_mem_writeb,      watch_mem_writeb,
     watch_mem_writew,      watch_mem_writew,
     watch_mem_writel,      watch_mem_writel,
Line 2898  static void subpage_writel (void *opaque Line 2840  static void subpage_writel (void *opaque
     subpage_writelen(opaque, addr, value, 2);      subpage_writelen(opaque, addr, value, 2);
 }  }
   
 static CPUReadMemoryFunc *subpage_read[] = {  static CPUReadMemoryFunc * const subpage_read[] = {
     &subpage_readb,      &subpage_readb,
     &subpage_readw,      &subpage_readw,
     &subpage_readl,      &subpage_readl,
 };  };
   
 static CPUWriteMemoryFunc *subpage_write[] = {  static CPUWriteMemoryFunc * const subpage_write[] = {
     &subpage_writeb,      &subpage_writeb,
     &subpage_writew,      &subpage_writew,
     &subpage_writel,      &subpage_writel,
Line 2985  static int get_free_io_mem_idx(void) Line 2927  static int get_free_io_mem_idx(void)
    value can be used with cpu_register_physical_memory(). (-1) is     value can be used with cpu_register_physical_memory(). (-1) is
    returned if error. */     returned if error. */
 static int cpu_register_io_memory_fixed(int io_index,  static int cpu_register_io_memory_fixed(int io_index,
                                         CPUReadMemoryFunc **mem_read,                                          CPUReadMemoryFunc * const *mem_read,
                                         CPUWriteMemoryFunc **mem_write,                                          CPUWriteMemoryFunc * const *mem_write,
                                         void *opaque)                                          void *opaque)
 {  {
     int i, subwidth = 0;      int i, subwidth = 0;
Line 3011  static int cpu_register_io_memory_fixed( Line 2953  static int cpu_register_io_memory_fixed(
     return (io_index << IO_MEM_SHIFT) | subwidth;      return (io_index << IO_MEM_SHIFT) | subwidth;
 }  }
   
 int cpu_register_io_memory(CPUReadMemoryFunc **mem_read,  int cpu_register_io_memory(CPUReadMemoryFunc * const *mem_read,
                            CPUWriteMemoryFunc **mem_write,                             CPUWriteMemoryFunc * const *mem_write,
                            void *opaque)                             void *opaque)
 {  {
     return cpu_register_io_memory_fixed(0, mem_read, mem_write, opaque);      return cpu_register_io_memory_fixed(0, mem_read, mem_write, opaque);
Line 3043  static void io_mem_init(void) Line 2985  static void io_mem_init(void)
   
     io_mem_watch = cpu_register_io_memory(watch_mem_read,      io_mem_watch = cpu_register_io_memory(watch_mem_read,
                                           watch_mem_write, NULL);                                            watch_mem_write, NULL);
 #ifdef CONFIG_KQEMU  
     if (kqemu_phys_ram_base) {  
         /* alloc dirty bits array */  
         phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);  
         memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS);  
     }  
 #endif  
 }  }
   
 #endif /* !defined(CONFIG_USER_ONLY) */  #endif /* !defined(CONFIG_USER_ONLY) */
Line 3244  static BounceBuffer bounce; Line 3179  static BounceBuffer bounce;
 typedef struct MapClient {  typedef struct MapClient {
     void *opaque;      void *opaque;
     void (*callback)(void *opaque);      void (*callback)(void *opaque);
     LIST_ENTRY(MapClient) link;      QLIST_ENTRY(MapClient) link;
 } MapClient;  } MapClient;
   
 static LIST_HEAD(map_client_list, MapClient) map_client_list  static QLIST_HEAD(map_client_list, MapClient) map_client_list
     = LIST_HEAD_INITIALIZER(map_client_list);      = QLIST_HEAD_INITIALIZER(map_client_list);
   
 void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque))  void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque))
 {  {
Line 3256  void *cpu_register_map_client(void *opaq Line 3191  void *cpu_register_map_client(void *opaq
   
     client->opaque = opaque;      client->opaque = opaque;
     client->callback = callback;      client->callback = callback;
     LIST_INSERT_HEAD(&map_client_list, client, link);      QLIST_INSERT_HEAD(&map_client_list, client, link);
     return client;      return client;
 }  }
   
Line 3264  void cpu_unregister_map_client(void *_cl Line 3199  void cpu_unregister_map_client(void *_cl
 {  {
     MapClient *client = (MapClient *)_client;      MapClient *client = (MapClient *)_client;
   
     LIST_REMOVE(client, link);      QLIST_REMOVE(client, link);
     qemu_free(client);      qemu_free(client);
 }  }
   
Line 3272  static void cpu_notify_map_clients(void) Line 3207  static void cpu_notify_map_clients(void)
 {  {
     MapClient *client;      MapClient *client;
   
     while (!LIST_EMPTY(&map_client_list)) {      while (!QLIST_EMPTY(&map_client_list)) {
         client = LIST_FIRST(&map_client_list);          client = QLIST_FIRST(&map_client_list);
         client->callback(client->opaque);          client->callback(client->opaque);
         cpu_unregister_map_client(client);          cpu_unregister_map_client(client);
     }      }

Removed from v.1.1.1.10  
changed lines
  Added in v.1.1.1.11


unix.superglobalmegacorp.com