From: Jack Lange Date: Wed, 24 Nov 2010 04:41:47 +0000 (-0600) Subject: minor fixes for stopping VMs X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=d46ec4b471af03e5e7562aeec4b26a2701671a01;p=palacios.git minor fixes for stopping VMs --- diff --git a/palacios/src/devices/8254.c b/palacios/src/devices/8254.c index e5498b9..7bf6a8c 100644 --- a/palacios/src/devices/8254.c +++ b/palacios/src/devices/8254.c @@ -680,8 +680,10 @@ static int pit_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { ullong_t reload_val = (ullong_t)cpu_khz * 1000; pit_state = (struct pit *)V3_Malloc(sizeof(struct pit)); + V3_ASSERT(pit_state != NULL); pit_state->speaker = 0; + pit_state->vm = vm; dev = v3_add_device(vm, dev_id, &dev_ops, pit_state); diff --git a/palacios/src/devices/cga.c b/palacios/src/devices/cga.c index febc36e..3f137e6 100644 --- a/palacios/src/devices/cga.c +++ b/palacios/src/devices/cga.c @@ -269,8 +269,7 @@ static int crtc_index_write(struct guest_info * core, uint16_t port, void * src, port, port); return -1; } - - + video_state->crtc_index_reg = *(uint8_t *)src; // Only do the passthrough IO for the first byte @@ -302,6 +301,7 @@ int v3_cons_get_fb(struct vm_device * frontend_dev, uint8_t * dst, uint_t offset V3_ASSERT(offset < SCREEN_SIZE); V3_ASSERT(length <= SCREEN_SIZE); V3_ASSERT(offset + length <= SCREEN_SIZE); + memcpy(dst, state->framebuf + screen_byte_offset + offset, length); return 0; @@ -309,15 +309,15 @@ int v3_cons_get_fb(struct vm_device * frontend_dev, uint8_t * dst, uint_t offset -static int free_device(struct video_internal * video_state) { +static int free_cga(struct video_internal * video_state) { if (video_state->framebuf_pa) { + PrintError("Freeing framebuffer PA %p\n", (void *)(video_state->framebuf_pa)); V3_FreePages((void *)(video_state->framebuf_pa), (FRAMEBUF_SIZE / 4096)); } v3_unhook_mem(video_state->dev->vm, V3_MEM_CORE_ANY, START_ADDR); - V3_Free(video_state); return 0; @@ -325,7 +325,7 @@ static int free_device(struct video_internal * video_state) { static struct v3_device_ops dev_ops = { - .free = (int (*)(void *))free_device, + .free = (int (*)(void *))free_cga, }; static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 6bf1a29..de6ee04 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -283,11 +283,15 @@ int v3_stop_vm(struct v3_vm_info * vm) { } if (still_running == 0) { - break; + break; } - + + V3_Print("Yielding\n"); + v3_yield(NULL); } + + V3_Print("VM stopped. Returning\n"); return 0; }