target/ppc: Convert to disas_set_info hook
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
		
							parent
							
								
									f50f3dd5d6
								
							
						
					
					
						commit
						0eea8cdd6d
					
				
							
								
								
									
										33
									
								
								disas.c
								
								
								
								
							
							
						
						
									
										33
									
								
								disas.c
								
								
								
								
							| 
						 | 
				
			
			@ -204,23 +204,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
 | 
			
		|||
        cc->disas_set_info(cpu, &s.info);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(TARGET_PPC)
 | 
			
		||||
    if ((flags >> 16) & 1) {
 | 
			
		||||
        s.info.endian = BFD_ENDIAN_LITTLE;
 | 
			
		||||
    }
 | 
			
		||||
    if (flags & 0xFFFF) {
 | 
			
		||||
        /* If we have a precise definition of the instruction set, use it. */
 | 
			
		||||
        s.info.mach = flags & 0xFFFF;
 | 
			
		||||
    } else {
 | 
			
		||||
#ifdef TARGET_PPC64
 | 
			
		||||
        s.info.mach = bfd_mach_ppc64;
 | 
			
		||||
#else
 | 
			
		||||
        s.info.mach = bfd_mach_ppc;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    s.info.disassembler_options = (char *)"any";
 | 
			
		||||
    s.info.print_insn = print_insn_ppc;
 | 
			
		||||
#endif
 | 
			
		||||
    if (s.info.print_insn == NULL) {
 | 
			
		||||
        s.info.print_insn = print_insn_od_target;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -380,22 +363,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
 | 
			
		|||
        cc->disas_set_info(cpu, &s.info);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(TARGET_PPC)
 | 
			
		||||
    if (flags & 0xFFFF) {
 | 
			
		||||
        /* If we have a precise definition of the instruction set, use it. */
 | 
			
		||||
        s.info.mach = flags & 0xFFFF;
 | 
			
		||||
    } else {
 | 
			
		||||
#ifdef TARGET_PPC64
 | 
			
		||||
        s.info.mach = bfd_mach_ppc64;
 | 
			
		||||
#else
 | 
			
		||||
        s.info.mach = bfd_mach_ppc;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    if ((flags >> 16) & 1) {
 | 
			
		||||
        s.info.endian = BFD_ENDIAN_LITTLE;
 | 
			
		||||
    }
 | 
			
		||||
    s.info.print_insn = print_insn_ppc;
 | 
			
		||||
#endif
 | 
			
		||||
    if (!s.info.print_insn) {
 | 
			
		||||
        monitor_printf(mon, "0x" TARGET_FMT_lx
 | 
			
		||||
                       ": Asm output not supported on this arch\n", pc);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1310,11 +1310,6 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
 | 
			
		|||
 | 
			
		||||
    if (format == 'i') {
 | 
			
		||||
        int flags = 0;
 | 
			
		||||
#ifdef TARGET_PPC
 | 
			
		||||
        CPUArchState *env = mon_get_cpu_env();
 | 
			
		||||
        flags = msr_le << 16;
 | 
			
		||||
        flags |= env->bfd_mach;
 | 
			
		||||
#endif
 | 
			
		||||
        monitor_disas(mon, cs, addr, count, is_physical, flags);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7407,12 +7407,9 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
 | 
			
		|||
#if defined(DEBUG_DISAS)
 | 
			
		||||
    if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)
 | 
			
		||||
        && qemu_log_in_addr_range(pc_start)) {
 | 
			
		||||
        int flags;
 | 
			
		||||
        flags = env->bfd_mach;
 | 
			
		||||
        flags |= ctx.le_mode << 16;
 | 
			
		||||
        qemu_log_lock();
 | 
			
		||||
        qemu_log("IN: %s\n", lookup_symbol(pc_start));
 | 
			
		||||
        log_target_disas(cs, pc_start, ctx.nip - pc_start, flags);
 | 
			
		||||
        log_target_disas(cs, pc_start, ctx.nip - pc_start, 0);
 | 
			
		||||
        qemu_log("\n");
 | 
			
		||||
        qemu_log_unlock();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10519,6 +10519,26 @@ static gchar *ppc_gdb_arch_name(CPUState *cs)
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
 | 
			
		||||
{
 | 
			
		||||
    PowerPCCPU *cpu = POWERPC_CPU(cs);
 | 
			
		||||
    CPUPPCState *env = &cpu->env;
 | 
			
		||||
 | 
			
		||||
    if ((env->hflags >> MSR_LE) & 1) {
 | 
			
		||||
        info->endian = BFD_ENDIAN_LITTLE;
 | 
			
		||||
    }
 | 
			
		||||
    info->mach = env->bfd_mach;
 | 
			
		||||
    if (!env->bfd_mach) {
 | 
			
		||||
#ifdef TARGET_PPC64
 | 
			
		||||
        info->mach = bfd_mach_ppc64;
 | 
			
		||||
#else
 | 
			
		||||
        info->mach = bfd_mach_ppc;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    info->disassembler_options = (char *)"any";
 | 
			
		||||
    info->print_insn = print_insn_ppc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Property ppc_cpu_properties[] = {
 | 
			
		||||
    DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU, pre_2_8_migration, false),
 | 
			
		||||
    DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU, pre_2_10_migration,
 | 
			
		||||
| 
						 | 
				
			
			@ -10582,6 +10602,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
 | 
			
		|||
#ifndef CONFIG_USER_ONLY
 | 
			
		||||
    cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
 | 
			
		||||
#endif
 | 
			
		||||
    cc->disas_set_info = ppc_disas_set_info;
 | 
			
		||||
 | 
			
		||||
    dc->fw_name = "PowerPC,UNKNOWN";
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue