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 memory region generated page tables, and removed all the ugliness that was...
[palacios.git] / palacios / src / geekos / main.c
index 2cd5a6a..3d3ebba 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu>
  * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
  * Copyright (c) 2004, Iulian Neamtiu <neamtiu@cs.umd.edu>
- * $Revision: 1.10 $
+ * $Revision: 1.16 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
 #include <geekos/mem.h>
 #include <geekos/paging.h>
 #include <geekos/ide.h>
+#include <geekos/malloc.h>
 
+#include <geekos/debug.h>
 #include <geekos/vmm.h>
 
 #include <geekos/gdt.h>
 
-#include <geekos/vmm_sizes.h>
+
+#include <geekos/vmm_stubs.h>
 
 /*
   static inline unsigned int cpuid_ecx(unsigned int op)
@@ -118,7 +121,9 @@ void BuzzVM()
   int j;
   unsigned char init;
   
-  
+    
+  SerialPrint("Starting To Buzz\n");
+
   init=MyIn_Byte(SPEAKER_PORT);
 
   while (1) {
@@ -146,9 +151,6 @@ void RunVM() {
 
 
 
-extern uint_t VMCS_STORE();
-extern uint_t VMCS_READ();
-
 
 
 void Buzzer(ulong_t arg) {
@@ -165,6 +167,8 @@ void Buzzer(ulong_t arg) {
 
 
 
+
+
 void Hello(ulong_t arg)
 {
   char *b="hello ";
@@ -246,6 +250,8 @@ void VM_Thread(ulong_t arg)
 }
 */
 
+
+
 int AllocateAndMapPagesForRange(uint_t start, uint_t length, pte_t template_pte)
 {
   uint_t address;
@@ -285,7 +291,7 @@ void Main(struct Boot_Info* bootInfo)
   Init_Screen();
 
 
-  InitSerial();
+  Init_Serial();
   Init_Mem(bootInfo);
   Init_CRC32();
   Init_TSS();
@@ -312,24 +318,51 @@ void Main(struct Boot_Info* bootInfo)
   */
 #endif
 
-#if 1
+#if 0
   SerialPrint("Dumping GUEST KERNEL CODE (first 512*2 bytes @ 0x100000)\n");
   SerialMemDump((unsigned char *)0x100000, 512*2);
 #endif
 
 
 
-
-  SerialPrint("\n\nHello, Welcome to this horrid output-only serial interface\n");
-  SerialPrint("Eventually, this will let us control the VMM\n\n");
-  SerialPrint("\n\n===>");
-  
+  {
+    struct vmm_os_hooks os_hooks;
+    struct vmm_ctrl_ops vmm_ops;
+    guest_info_t vm_info;
+    memset(&os_hooks, 0, sizeof(struct vmm_os_hooks));
+    memset(&vmm_ops, 0, sizeof(struct vmm_ctrl_ops));
+    memset(&vm_info, 0, sizeof(guest_info_t));
+
+    os_hooks.print_debug = &PrintBoth;
+    os_hooks.print_info = &Print;
+    os_hooks.print_trace = &SerialPrint;
+    os_hooks.allocate_pages = &Allocate_VMM_Pages;
+    os_hooks.free_page = &Free_VMM_Page;
+    os_hooks.malloc = &VMM_Malloc;
+    os_hooks.free = &VMM_Free;
+
+
+    Init_VMM(&os_hooks, &vmm_ops);
   
 
-  Init_VMM();
+    init_mem_layout(&(vm_info.mem_layout));
+    init_mem_list(&(vm_info.mem_list));
+
+    //  add_mem_list_pages(&(vm_info.mem_list), START_OF_VM, 20);
+    //add_guest_mem_range(&(vm_info.mem_layout), 0, 20);
+
+
+    vm_info.rip = (ullong_t)(void*)&BuzzVM;
+    vm_info.rsp = (ulong_t)Alloc_Page();
+
+    SerialPrint("Initializing Guest\n");
+    (vmm_ops).init_guest(&vm_info);
+    SerialPrint("Starting Guest\n");
+    (vmm_ops).start_guest(&vm_info);
+    
+  }
+
 
-  
   SerialPrintLevel(1000,"Launching Noisemaker and keyboard listener threads\n");
   
   key_thread = Start_Kernel_Thread(Keyboard_Listener, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false);