From: Jack Lange Date: Wed, 3 Jun 2009 02:47:15 +0000 (-0500) Subject: hook F10 to state dumping X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=d3f9dd3b223729a81918a0df0dadf72015739c6c hook F10 to state dumping --- diff --git a/palacios/src/devices/keyboard.c b/palacios/src/devices/keyboard.c index 639e113..5cef405 100644 --- a/palacios/src/devices/keyboard.c +++ b/palacios/src/devices/keyboard.c @@ -309,7 +309,13 @@ static int key_event_handler(struct guest_info * info, struct keyboard_internal *state = (struct keyboard_internal *)(dev->private_data); PrintDebug("keyboard: injected status 0x%x, and scancode 0x%x\n", evt->status, evt->scan_code); - + + + if (evt->scan_code == 0x44) { // F10 debug dump + v3_print_guest_state(info); + // PrintGuestPageTables(info, info->shdw_pg_state.guest_cr3); + } + if ( (state->status_byte & STATUS_ENABLED) // onboard is enabled && (!(state->cmd_byte & CMD_DISABLE)) ) { // keyboard is enabled diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index c846415..be9778c 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -183,7 +184,7 @@ void v3_print_ctrl_regs(struct guest_info * info) { char * reg_names[] = {"CR0", "CR2", "CR3", "CR4", "CR8", "FLAGS", NULL}; vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA(info->vmm_data); - reg_ptr= (v3_reg_t *)regs; + reg_ptr = (v3_reg_t *)regs; PrintDebug("32 bit Ctrl Regs:\n"); @@ -196,6 +197,27 @@ void v3_print_ctrl_regs(struct guest_info * info) { } +void v3_print_guest_state(struct guest_info * info) { + addr_t linear_addr = 0; + + PrintDebug("RIP: %p\n", (void *)(addr_t)(info->rip)); + linear_addr = get_addr_linear(info, info->rip, &(info->segments.cs)); + PrintDebug("RIP Linear: %p\n", (void *)linear_addr); + + v3_print_segments(info); + v3_print_ctrl_regs(info); + + if (info->shdw_pg_mode == SHADOW_PAGING) { + PrintDebug("Shadow Paging Guest Registers:\n"); + PrintDebug("\tGuest CR0=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_cr0)); + PrintDebug("\tGuest CR3=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_cr3)); + PrintDebug("\tGuest EFER=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_efer.value)); + // CR4 + } + v3_print_GPRs(info); +} + + #ifdef __V3_32BIT__ void v3_print_GPRs(struct guest_info * info) { struct v3_gprs * regs = &(info->vm_regs);