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.


Incorporated XED inclusion code.
[palacios.git] / palacios / src / geekos / vm.c
index 5fd8965..661f5d1 100644 (file)
 #include <palacios/vmm_dev_mgr.h>
 #include <palacios/vmm_time.h>
 
+//test decoder
+//#include <palacios/vmm_decoder.h>
+
+extern int parse();
+
 #define SPEAKER_PORT 0x61
 
 static inline void VM_Out_Byte(ushort_t port, uchar_t value)
@@ -199,6 +204,8 @@ int RunVMM(struct Boot_Info * bootInfo) {
 
 
 
+
+
     memset(&os_hooks, 0, sizeof(struct vmm_os_hooks));
     memset(&vmm_ops, 0, sizeof(struct vmm_ctrl_ops));
     memset(&vm_info, 0, sizeof(struct guest_info));
@@ -213,10 +220,18 @@ int RunVMM(struct Boot_Info * bootInfo) {
     os_hooks.vaddr_to_paddr = &Identity;
     os_hooks.paddr_to_vaddr = &Identity;
     os_hooks.hook_interrupt = &hook_irq_stub;
+    os_hooks.hook_interrupt_new = &geekos_hook_interrupt_new;
     os_hooks.ack_irq = &ack_irq;
     os_hooks.get_cpu_khz = &get_cpu_khz;
 
+
+
     Init_VMM(&os_hooks, &vmm_ops);
+
+    //test decoder
+    PrintBoth("testing decoder\n");
+    parse();
+    PrintBoth("testing decoder done\n");
   
 
     /* MOVE THIS TO AN INIT GUEST ROUTINE */
@@ -286,13 +301,17 @@ int RunVMM(struct Boot_Info * bootInfo) {
       int i;
       void * region_start;
 
-      PrintBoth("Guest Size: %lu\n", bootInfo->guest_size);
+      extern char _binary_vm_kernel_start;
+      PrintBoth(" Guest Load Addr: 0x%x\n", &_binary_vm_kernel_start);
 
-      struct guest_mem_layout * layout = (struct guest_mem_layout *)0x100000;
+      struct guest_mem_layout * layout = (struct guest_mem_layout *)&_binary_vm_kernel_start;
 
+      //     SerialPrint("Guest Mem Dump at 0x%x\n", 0x100000);
+      //SerialMemDump((unsigned char *)(0x100000), 261 * 1024);
       if (layout->magic != MAGIC_CODE) {
+       
        PrintBoth("Layout Magic Mismatch (0x%x)\n", layout->magic);
+       return -1;
       }
 
       PrintBoth("%d layout regions\n", layout->num_regions);
@@ -371,10 +390,9 @@ int RunVMM(struct Boot_Info * bootInfo) {
 
 #if GENERIC
        generic_port_range_type range[] = {
-#if 0
+#if 1
           {0x00, 0x07, GENERIC_PRINT_AND_IGNORE},   // DMA 1 channels 0,1,2,3 (address, counter)
-          {0xc0, 0xc7, GENERIC_PRINT_AND_
-IGNORE},   // DMA 2 channels 4,5,6,7 (address, counter)
+          {0xc0, 0xc7, GENERIC_PRINT_AND_IGNORE},   // DMA 2 channels 4,5,6,7 (address, counter)
           {0x87, 0x87, GENERIC_PRINT_AND_IGNORE},   // DMA 1 channel 0 page register
           {0x83, 0x83, GENERIC_PRINT_AND_IGNORE},   // DMA 1 channel 1 page register
           {0x81, 0x81, GENERIC_PRINT_AND_IGNORE},   // DMA 1 channel 2 page register
@@ -387,7 +405,7 @@ IGNORE},   // DMA 2 channels 4,5,6,7 (address, counter)
           {0xd0, 0xde, GENERIC_PRINT_AND_IGNORE},   // DMA 2 misc registers
 #endif
 
-         
+         
          {0x3f8, 0x3f8+7, GENERIC_PRINT_AND_IGNORE},      // COM 1
          {0x2f8, 0x2f8+7, GENERIC_PRINT_AND_IGNORE},      // COM 2
          {0x3e8, 0x3e8+7, GENERIC_PRINT_AND_IGNORE},      // COM 3
@@ -417,7 +435,8 @@ IGNORE},   // DMA 2 channels 4,5,6,7 (address, counter)
 
         };
 
-       struct vm_device * generic = create_generic(range,NULL,NULL);
+
+       struct vm_device * generic = create_generic(range, NULL, NULL);
 
 #endif
 
@@ -444,15 +463,16 @@ IGNORE},   // DMA 2 channels 4,5,6,7 (address, counter)
       
 #if 1
       // give floppy controller to vm
-      hook_irq(&vm_info, 6);
+      hook_irq_for_guest_injection(&vm_info, 6);
 #endif
 
+#if 1
       //primary ide
-      hook_irq(&vm_info, 14);
+      hook_irq_for_guest_injection(&vm_info, 14);
 
       // secondary ide
-      hook_irq(&vm_info, 15);
-
+      hook_irq_for_guest_injection(&vm_info, 15);
+#endif
 
 
       vm_info.rip = 0xfff0;