target-mips: Let cpu_mips_init() return MIPSCPU

Turn cpu_init macro into a static inline function returning CPUMIPSState
for backwards compatibility.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2012-05-05 13:33:04 +02:00
parent fca1be7cbc
commit 30bf942d8c
2 changed files with 12 additions and 4 deletions

View File

@ -496,7 +496,6 @@ void cpu_unassigned_access(CPUMIPSState *env, target_phys_addr_t addr,
void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf);
#define cpu_init cpu_mips_init
#define cpu_exec cpu_mips_exec
#define cpu_gen_code cpu_mips_gen_code
#define cpu_signal_handler cpu_mips_signal_handler
@ -626,9 +625,18 @@ enum {
#define CPU_INTERRUPT_WAKE CPU_INTERRUPT_TGT_INT_0
int cpu_mips_exec(CPUMIPSState *s);
CPUMIPSState *cpu_mips_init(const char *cpu_model);
MIPSCPU *cpu_mips_init(const char *cpu_model);
int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
static inline CPUMIPSState *cpu_init(const char *cpu_model)
{
MIPSCPU *cpu = cpu_mips_init(cpu_model);
if (cpu == NULL) {
return NULL;
}
return &cpu->env;
}
/* mips_timer.c */
uint32_t cpu_mips_get_random (CPUMIPSState *env);
uint32_t cpu_mips_get_count (CPUMIPSState *env);

View File

@ -12689,7 +12689,7 @@ static void mips_tcg_init(void)
#include "translate_init.c"
CPUMIPSState *cpu_mips_init (const char *cpu_model)
MIPSCPU *cpu_mips_init(const char *cpu_model)
{
MIPSCPU *cpu;
CPUMIPSState *env;
@ -12711,7 +12711,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
mips_tcg_init();
cpu_reset(CPU(cpu));
qemu_init_vcpu(env);
return env;
return cpu;
}
void cpu_state_reset(CPUMIPSState *env)