From 7fbbca6f2aa10621ac97263581f338fd31a1efc5 Mon Sep 17 00:00:00 2001 From: Alexander Kudryavtsev Date: Wed, 12 Oct 2011 16:43:17 +0400 Subject: [PATCH 25/32] Fixed AMD booting --- palacios/src/palacios/vmm_ctrl_regs.c | 12 ++++++++++-- palacios/src/palacios/vmm_quix86.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/palacios/src/palacios/vmm_ctrl_regs.c b/palacios/src/palacios/vmm_ctrl_regs.c index 8d5216e..939c6f0 100644 --- a/palacios/src/palacios/vmm_ctrl_regs.c +++ b/palacios/src/palacios/vmm_ctrl_regs.c @@ -558,6 +558,8 @@ int v3_handle_efer_read(struct guest_info * core, uint_t msr, struct v3_msr * ds } +extern v3_cpu_arch_t v3_cpu_types[V3_CONFIG_MAX_CPUS]; + int v3_handle_efer_write(struct guest_info * core, uint_t msr, struct v3_msr src, void * priv_data) { struct v3_msr * vm_efer = &(core->shdw_pg_state.guest_efer); struct efer_64 * hw_efer = (struct efer_64 *)&(core->ctrl_regs.efer); @@ -577,6 +579,12 @@ int v3_handle_efer_write(struct guest_info * core, uint_t msr, struct v3_msr src return -1; } + int cpu = v3_cpu_types[core->pcpu_id]; + + if(cpu == V3_SVM_REV3_CPU && core->shdw_pg_mode == NESTED_PAGING) { + return 0; + } + // Set LME and LMA bits seen by hardware if (old_hw_efer.lme == 0) { // Long mode was not previously enabled, so the lme bit cannot @@ -586,8 +594,8 @@ int v3_handle_efer_write(struct guest_info * core, uint_t msr, struct v3_msr src } else { // Long mode was previously enabled. Ensure LMA bit is set. // VMX does not automatically set LMA, and this should not affect SVM. - hw_efer->lma = 1; - ((struct efer_64 *)vm_efer)->lma = 1; + hw_efer->lma = 1; + ((struct efer_64 *)vm_efer)->lma = 1; } return 0; diff --git a/palacios/src/palacios/vmm_quix86.c b/palacios/src/palacios/vmm_quix86.c index 6440878..ee11125 100644 --- a/palacios/src/palacios/vmm_quix86.c +++ b/palacios/src/palacios/vmm_quix86.c @@ -297,7 +297,7 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins if(qx86_print_intel(&qx86_inst, &opt, buf, &buf_sz) != QX86_SUCCESS) { PrintDebug("Print failed!\n"); } else { - PrintDebug("Instruction: %s\n", buf); + PrintDebug("Instruction (%p): %s\n", (void*)info->rip, buf); } PrintDebug("Operands: dst %p src %p 3rd %p\n", (void*)instr->dst_operand.operand, (void*)instr->src_operand.operand, (void*)instr->third_operand.operand); #endif -- 1.7.5.4