X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fvm.c;h=779e36ea55f42c37b35fcfb773e26268b5ad13cf;hb=cbf35ad72de3a7a1f6eee3e8b2b35d7f31df22a5;hp=5fd8965c80ab84cde6f449a689900b71da15c9d6;hpb=0a15dd0709348fe3770bae9cc485c1c2fc11ef98;p=palacios.git diff --git a/palacios/src/geekos/vm.c b/palacios/src/geekos/vm.c index 5fd8965..779e36e 100644 --- a/palacios/src/geekos/vm.c +++ b/palacios/src/geekos/vm.c @@ -18,6 +18,11 @@ #include #include +//test decoder +//#include + +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); @@ -342,6 +361,8 @@ int RunVMM(struct Boot_Info * bootInfo) { //add_shadow_region_passthrough(&vm_info, 0x100000, 0x2000000, (addr_t)Allocate_VMM_Pages(8192)); add_shadow_region_passthrough(&vm_info, 0x100000, 0x1000000, (addr_t)Allocate_VMM_Pages(4096)); + add_shadow_region_passthrough(&vm_info, 0x1000000, 0x8000000, (addr_t)Allocate_VMM_Pages(32768)); + // test - give linux accesss to PCI space - PAD add_shadow_region_passthrough(&vm_info, 0xc0000000,0xffffffff,0xc0000000); @@ -371,10 +392,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 +407,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 +437,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 +465,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;