Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added support for in/out instructions
[palacios.git] / palacios / src / geekos / svm.c
index ad870ff..6870430 100644 (file)
@@ -111,12 +111,11 @@ int init_svm_guest(struct guest_info *info) {
   //info->page_tables = generate_guest_page_tables(&(info->mem_layout), &(info->mem_list));
   //PrintDebugPageTables(info->page_tables);
 
-  
 
   PrintDebug("Initializing VMCB (addr=%x)\n", info->vmm_data);
   Init_VMCB((vmcb_t*)(info->vmm_data), *info);
   
-  info->rip = 0;
+  //  info->rip = 0;
 
   info->vm_regs.rdi = 0;
   info->vm_regs.rsi = 0;
@@ -140,7 +139,9 @@ int start_svm_guest(struct guest_info *info) {
   //PrintDebugVMCB((vmcb_t*)(info->vmm_data));
 
   while (1) {
+
     PrintDebug("SVM Launch Args (vmcb=%x), (info=%x), (vm_regs=%x)\n", info->vmm_data,  &(info->vm_regs));
+    PrintDebug("Launching to RIP: %x\n", info->rip);
     safe_svm_launch((vmcb_t*)(info->vmm_data), &(info->vm_regs));
     //launch_svm((vmcb_t*)(info->vmm_data));
     PrintDebug("SVM Returned\n");
@@ -175,13 +176,9 @@ void Init_VMCB_Real(vmcb_t * vmcb, struct guest_info vm_info) {
   guest_state->rip = vm_info.rip;
 
 
-
-
-
   guest_state->efer |= EFER_MSR_svm_enable;
   guest_state->rflags = 0x00000002; // The reserved bit is always 1
   ctrl_area->svm_instrs.instrs.VMRUN = 1;
-  // guest_state->cr0 = 0x00000001;    // PE 
   ctrl_area->guest_ASID = 1;
   guest_state->cr0 = 0x60000010;
 
@@ -260,9 +257,6 @@ void Init_VMCB_Real(vmcb_t * vmcb, struct guest_info vm_info) {
       *bitmap |= 1 << (port % 8);
     }
 
-    //    memset((uchar_t*)io_port_bitmap, 0xff, PAGE_SIZE * 2);
-    //PrintDebugMemDump((uchar_t*)io_port_bitmap, PAGE_SIZE *2);
-
     ctrl_area->instrs.instrs.IOIO_PROT = 1;
   }
 
@@ -288,6 +282,7 @@ void Init_VMCB_Real(vmcb_t * vmcb, struct guest_info vm_info) {
        
     guest_state->g_pat = 0x7040600070406ULL;
 
+    vm_info.shdw_pg_state.guest_cr0.e_reg.low = guest_state->cr0;
     guest_state->cr0 |= 0x80000000;
   } else if (vm_info.page_mode == NESTED_PAGING) {
     // Flush the TLB on entries/exits