From: Lei Xia Date: Wed, 28 Apr 2010 21:25:14 +0000 (-0500) Subject: Minor fix to the halt handler X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=0027db7c5ddd6b376f1d18e9cdd619126d5896c4;p=palacios.git Minor fix to the halt handler --- diff --git a/palacios/src/palacios/vmm_halt.c b/palacios/src/palacios/vmm_halt.c index bb28ebc..ef796e4 100644 --- a/palacios/src/palacios/vmm_halt.c +++ b/palacios/src/palacios/vmm_halt.c @@ -45,32 +45,35 @@ int v3_handle_halt(struct guest_info * info) { PrintDebug("CPU Yield\n"); -again: - - rdtscll(yield_start); - v3_yield(info); - rdtscll(yield_stop); - - - //v3_update_time(info, yield_stop - yield_start); - gap = yield_stop - yield_start; - /* - If we got here, either an interrupt has occured or - sufficient time has passed that we may need to inject - a timer interrupt. - First, we will update time, which may or may not inject an - interrupt - */ - v3_update_time(info, gap); - info->time_state.cached_hlt_tsc += gap; + while(1){ + if (v3_intr_pending(info)) { + /* if there is pending interrupt, just return */ + break; + } - /* At this point, we either have some combination of - interrupts, including perhaps a timer interrupt, or - no interrupt. - */ - if (!v3_intr_pending(info)) { - /* if no interrupt, then we yield again */ - goto again; + rdtscll(yield_start); + v3_yield(info); + rdtscll(yield_stop); + + gap = yield_stop - yield_start; + /* + If we got here, either an interrupt has occured or + sufficient time has passed that we may need to inject + a timer interrupt. + First, we will update time, which may or may not inject an + interrupt + */ + v3_update_time(info, gap); + info->time_state.cached_hlt_tsc += gap; + + /* At this point, we either have some combination of + interrupts, including perhaps a timer interrupt, or + no interrupt. + */ + if (!v3_intr_pending(info)) { + /* if no interrupt, then we do halt*/ + asm("hlt"); + } } #if 0