Skip to content

Commit

Permalink
Merge branch 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu
Browse files Browse the repository at this point in the history
* 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu:
  target-i386: move tcg initialization into x86_cpu_initfn()
  cleanup cpu_set_debug_excp_handler
  target-xtensa: drop usage of prev_debug_excp_handler
  target-i386: drop usage of prev_debug_excp_handler
  • Loading branch information
blueswirl committed Aug 9, 2012
2 parents 8227421 + d65e981 commit d3da41e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 27 deletions.
5 changes: 1 addition & 4 deletions cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,9 @@ static inline TranslationBlock *tb_find_fast(CPUArchState *env)

static CPUDebugExcpHandler *debug_excp_handler;

CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
void cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
{
CPUDebugExcpHandler *old_handler = debug_excp_handler;

debug_excp_handler = handler;
return old_handler;
}

static void cpu_handle_debug_exception(CPUArchState *env)
Expand Down
2 changes: 1 addition & 1 deletion exec-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr);

typedef void (CPUDebugExcpHandler)(CPUArchState *env);

CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
void cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);

/* vl.c */
extern int singlestep;
Expand Down
10 changes: 10 additions & 0 deletions target-i386/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,7 @@ static void x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
CPUX86State *env = &cpu->env;
static int inited;

cpu_exec_init(env);

Expand Down Expand Up @@ -1775,6 +1776,15 @@ static void x86_cpu_initfn(Object *obj)
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);

env->cpuid_apic_id = env->cpu_index;

/* init various static tables used in TCG mode */
if (tcg_enabled() && !inited) {
inited = 1;
optimize_flags_init();
#ifndef CONFIG_USER_ONLY
cpu_set_debug_excp_handler(breakpoint_handler);
#endif
}
}

static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
Expand Down
1 change: 1 addition & 0 deletions target-i386/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ static inline int hw_breakpoint_len(unsigned long dr7, int index)
void hw_breakpoint_insert(CPUX86State *env, int index);
void hw_breakpoint_remove(CPUX86State *env, int index);
int check_hw_breakpoints(CPUX86State *env, int force_dr6_update);
void breakpoint_handler(CPUX86State *env);

/* will be suppressed */
void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0);
Expand Down
16 changes: 1 addition & 15 deletions target-i386/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,7 @@ int check_hw_breakpoints(CPUX86State *env, int force_dr6_update)
return hit_enabled;
}

static CPUDebugExcpHandler *prev_debug_excp_handler;

static void breakpoint_handler(CPUX86State *env)
void breakpoint_handler(CPUX86State *env)
{
CPUBreakpoint *bp;

Expand All @@ -965,8 +963,6 @@ static void breakpoint_handler(CPUX86State *env)
break;
}
}
if (prev_debug_excp_handler)
prev_debug_excp_handler(env);
}

typedef struct MCEInjectionParams {
Expand Down Expand Up @@ -1155,21 +1151,11 @@ X86CPU *cpu_x86_init(const char *cpu_model)
{
X86CPU *cpu;
CPUX86State *env;
static int inited;

cpu = X86_CPU(object_new(TYPE_X86_CPU));
env = &cpu->env;
env->cpu_model_str = cpu_model;

/* init various static tables used in TCG mode */
if (tcg_enabled() && !inited) {
inited = 1;
optimize_flags_init();
#ifndef CONFIG_USER_ONLY
prev_debug_excp_handler =
cpu_set_debug_excp_handler(breakpoint_handler);
#endif
}
if (cpu_x86_register(cpu, cpu_model) < 0) {
object_delete(OBJECT(cpu));
return NULL;
Expand Down
8 changes: 1 addition & 7 deletions target-xtensa/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ static uint32_t check_hw_breakpoints(CPUXtensaState *env)
return 0;
}

static CPUDebugExcpHandler *prev_debug_excp_handler;

static void breakpoint_handler(CPUXtensaState *env)
{
if (env->watchpoint_hit) {
Expand All @@ -70,9 +68,6 @@ static void breakpoint_handler(CPUXtensaState *env)
cpu_resume_from_signal(env, NULL);
}
}
if (prev_debug_excp_handler) {
prev_debug_excp_handler(env);
}
}

XtensaCPU *cpu_xtensa_init(const char *cpu_model)
Expand Down Expand Up @@ -105,8 +100,7 @@ XtensaCPU *cpu_xtensa_init(const char *cpu_model)

if (!debug_handler_inited && tcg_enabled()) {
debug_handler_inited = 1;
prev_debug_excp_handler =
cpu_set_debug_excp_handler(breakpoint_handler);
cpu_set_debug_excp_handler(breakpoint_handler);
}

xtensa_irq_init(env);
Expand Down

0 comments on commit d3da41e

Please sign in to comment.