cpu: Change cpu_exit() argument to CPUState

It no longer depends on CPUArchState, so move it to qom/cpu.c.

Prepares for changing GDBState::c_cpu to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-05-17 18:26:54 +02:00
parent cb446ecab7
commit 60a3e17a46
13 changed files with 24 additions and 20 deletions

4
cpus.c
View File

@ -473,7 +473,7 @@ static void cpu_handle_guest_debug(CPUArchState *env)
static void cpu_signal(int sig) static void cpu_signal(int sig)
{ {
if (cpu_single_env) { if (cpu_single_env) {
cpu_exit(cpu_single_env); cpu_exit(ENV_GET_CPU(cpu_single_env));
} }
exit_request = 1; exit_request = 1;
} }
@ -1088,7 +1088,7 @@ void cpu_stop_current(void)
CPUState *cpu_single_cpu = ENV_GET_CPU(cpu_single_env); CPUState *cpu_single_cpu = ENV_GET_CPU(cpu_single_env);
cpu_single_cpu->stop = false; cpu_single_cpu->stop = false;
cpu_single_cpu->stopped = true; cpu_single_cpu->stopped = true;
cpu_exit(cpu_single_env); cpu_exit(cpu_single_cpu);
qemu_cond_signal(&qemu_pause_cond); qemu_cond_signal(&qemu_pause_cond);
} }
} }

8
exec.c
View File

@ -598,14 +598,6 @@ void cpu_single_step(CPUArchState *env, int enabled)
#endif #endif
} }
void cpu_exit(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
cpu->exit_request = 1;
cpu->tcg_exit_req = 1;
}
void cpu_abort(CPUArchState *env, const char *fmt, ...) void cpu_abort(CPUArchState *env, const char *fmt, ...)
{ {
va_list ap; va_list ap;

View File

@ -2655,7 +2655,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
is still in the running state, which can cause packets to be dropped is still in the running state, which can cause packets to be dropped
and state transition 'T' packets to be sent while the syscall is still and state transition 'T' packets to be sent while the syscall is still
being processed. */ being processed. */
cpu_exit(s->c_cpu); cpu_exit(ENV_GET_CPU(s->c_cpu));
#endif #endif
} }

View File

@ -1109,7 +1109,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
CPUX86State *env = cpu_single_env; CPUX86State *env = cpu_single_env;
if (env && level) { if (env && level) {
cpu_exit(env); cpu_exit(CPU(x86_env_get_cpu(env)));
} }
} }

View File

@ -253,7 +253,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
CPUMIPSState *env = cpu_single_env; CPUMIPSState *env = cpu_single_env;
if (env && level) { if (env && level) {
cpu_exit(env); cpu_exit(CPU(mips_env_get_cpu(env)));
} }
} }

View File

@ -102,7 +102,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
CPUMIPSState *env = cpu_single_env; CPUMIPSState *env = cpu_single_env;
if (env && level) { if (env && level) {
cpu_exit(env); cpu_exit(CPU(mips_env_get_cpu(env)));
} }
} }

View File

@ -773,7 +773,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
CPUMIPSState *env = cpu_single_env; CPUMIPSState *env = cpu_single_env;
if (env && level) { if (env && level) {
cpu_exit(env); cpu_exit(CPU(mips_env_get_cpu(env)));
} }
} }

View File

@ -420,7 +420,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
CPUPPCState *env = cpu_single_env; CPUPPCState *env = cpu_single_env;
if (env && level) { if (env && level) {
cpu_exit(env); cpu_exit(CPU(ppc_env_get_cpu(env)));
} }
} }

View File

@ -421,8 +421,6 @@ DECLARE_TLS(CPUArchState *,cpu_single_env);
| CPU_INTERRUPT_TGT_EXT_3 \ | CPU_INTERRUPT_TGT_EXT_3 \
| CPU_INTERRUPT_TGT_EXT_4) | CPU_INTERRUPT_TGT_EXT_4)
void cpu_exit(CPUArchState *s);
/* Breakpoint/watchpoint flags */ /* Breakpoint/watchpoint flags */
#define BP_MEM_READ 0x01 #define BP_MEM_READ 0x01
#define BP_MEM_WRITE 0x02 #define BP_MEM_WRITE 0x02

View File

@ -370,6 +370,14 @@ void cpu_interrupt(CPUState *cpu, int mask);
*/ */
void cpu_reset_interrupt(CPUState *cpu, int mask); void cpu_reset_interrupt(CPUState *cpu, int mask);
/**
* cpu_exit:
* @cpu: The CPU to exit.
*
* Requests the CPU @cpu to exit execution.
*/
void cpu_exit(CPUState *cpu);
/** /**
* cpu_resume: * cpu_resume:
* @cpu: The CPU to resume. * @cpu: The CPU to resume.

View File

@ -160,7 +160,7 @@ static inline void start_exclusive(void)
other_cpu = ENV_GET_CPU(other); other_cpu = ENV_GET_CPU(other);
if (other_cpu->running) { if (other_cpu->running) {
pending_cpus++; pending_cpus++;
cpu_exit(other); cpu_exit(other_cpu);
} }
} }
if (pending_cpus > 1) { if (pending_cpus > 1) {

View File

@ -524,7 +524,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
host_to_target_siginfo_noswap(&tinfo, info); host_to_target_siginfo_noswap(&tinfo, info);
if (queue_signal(thread_env, sig, &tinfo) == 1) { if (queue_signal(thread_env, sig, &tinfo) == 1) {
/* interrupt the virtual CPU as soon as possible */ /* interrupt the virtual CPU as soon as possible */
cpu_exit(thread_env); cpu_exit(ENV_GET_CPU(thread_env));
} }
} }

View File

@ -91,6 +91,12 @@ void cpu_reset_interrupt(CPUState *cpu, int mask)
cpu->interrupt_request &= ~mask; cpu->interrupt_request &= ~mask;
} }
void cpu_exit(CPUState *cpu)
{
cpu->exit_request = 1;
cpu->tcg_exit_req = 1;
}
int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
void *opaque) void *opaque)
{ {