Ensure a SIGALRM results in a break out from the cpu loop.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3769 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
001a3f5abf
commit
ee5605e556
34
vl.c
34
vl.c
@ -233,6 +233,10 @@ const char *prom_envs[MAX_PROM_ENVS];
|
|||||||
int nb_drives_opt;
|
int nb_drives_opt;
|
||||||
char drives_opt[MAX_DRIVES][1024];
|
char drives_opt[MAX_DRIVES][1024];
|
||||||
|
|
||||||
|
static CPUState *cur_cpu;
|
||||||
|
static CPUState *next_cpu;
|
||||||
|
static int event_pending;
|
||||||
|
|
||||||
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
|
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
@ -1180,16 +1184,16 @@ static void host_alarm_handler(int host_signum)
|
|||||||
struct qemu_alarm_win32 *data = ((struct qemu_alarm_timer*)dwUser)->priv;
|
struct qemu_alarm_win32 *data = ((struct qemu_alarm_timer*)dwUser)->priv;
|
||||||
SetEvent(data->host_alarm);
|
SetEvent(data->host_alarm);
|
||||||
#endif
|
#endif
|
||||||
CPUState *env = cpu_single_env;
|
CPUState *env = next_cpu;
|
||||||
if (env) {
|
|
||||||
/* stop the currently executing cpu because a timer occured */
|
/* stop the currently executing cpu because a timer occured */
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_EXIT);
|
cpu_interrupt(env, CPU_INTERRUPT_EXIT);
|
||||||
#ifdef USE_KQEMU
|
#ifdef USE_KQEMU
|
||||||
if (env->kqemu_enabled) {
|
if (env->kqemu_enabled) {
|
||||||
kqemu_cpu_interrupt(env);
|
kqemu_cpu_interrupt(env);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
event_pending = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7340,8 +7344,6 @@ void main_loop_wait(int timeout)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUState *cur_cpu;
|
|
||||||
|
|
||||||
static int main_loop(void)
|
static int main_loop(void)
|
||||||
{
|
{
|
||||||
int ret, timeout;
|
int ret, timeout;
|
||||||
@ -7351,15 +7353,13 @@ static int main_loop(void)
|
|||||||
CPUState *env;
|
CPUState *env;
|
||||||
|
|
||||||
cur_cpu = first_cpu;
|
cur_cpu = first_cpu;
|
||||||
|
next_cpu = cur_cpu->next_cpu ?: first_cpu;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (vm_running) {
|
if (vm_running) {
|
||||||
|
|
||||||
env = cur_cpu;
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/* get next cpu */
|
/* get next cpu */
|
||||||
env = env->next_cpu;
|
env = next_cpu;
|
||||||
if (!env)
|
|
||||||
env = first_cpu;
|
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
ti = profile_getclock();
|
ti = profile_getclock();
|
||||||
#endif
|
#endif
|
||||||
@ -7367,6 +7367,12 @@ static int main_loop(void)
|
|||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
qemu_time += profile_getclock() - ti;
|
qemu_time += profile_getclock() - ti;
|
||||||
#endif
|
#endif
|
||||||
|
next_cpu = env->next_cpu ?: first_cpu;
|
||||||
|
if (event_pending) {
|
||||||
|
ret = EXCP_INTERRUPT;
|
||||||
|
event_pending = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (ret == EXCP_HLT) {
|
if (ret == EXCP_HLT) {
|
||||||
/* Give the next CPU a chance to run. */
|
/* Give the next CPU a chance to run. */
|
||||||
cur_cpu = env;
|
cur_cpu = env;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user