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.


Fixed the FS/GS save/restore problem
Peter Dinda [Mon, 23 Jun 2008 17:15:02 +0000 (17:15 +0000)]
Added PCI
Added Out/In_DWord
Patched to compile
Debugging?

palacios/src/geekos/int.c
palacios/src/geekos/io.c
palacios/src/geekos/kthread.c
palacios/src/geekos/main.c
palacios/src/geekos/timer.c
palacios/src/geekos/vm.c
palacios/src/palacios/svm_lowlevel.asm
palacios/src/palacios/vmm_decoder.c

index 513240d..f83087e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * GeekOS interrupt handling data structures and functions
  * Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
@@ -396,7 +396,7 @@ void Dump_Interrupt_State(struct Interrupt_State* state)
 {
     uint_t errorCode = state->errorCode;
 
-   PrintBoth("eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
+   SerialPrint("eax=%08x ebx=%08x ecx=%08x edx=%08x\n"
           "esi=%08x edi=%08x ebp=%08x\n"
           "eip=%08x cs=%08x eflags=%08x\n"
           "Interrupt number=%d (%s), error code=%d\n"
index 3132733..1310cdc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * x86 port IO routines
  * Copyright (c) 2001, David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
@@ -50,7 +50,7 @@ void Out_Word(ushort_t port, ushort_t value)
 }
 
 /*
- * Read a byte from an I/O port.
+ * Read a word from an I/O port.
  */
 ushort_t In_Word(ushort_t port)
 {
@@ -66,6 +66,34 @@ ushort_t In_Word(ushort_t port)
 }
 
 /*
+ * Write a double word to an I/O port.
+ */
+void Out_DWord(ushort_t port, uint_t value)
+{
+    __asm__ __volatile__ (
+       "outl %0, %1"
+       :
+       : "a" (value), "Nd" (port)
+    );
+}
+
+/*
+ * Read a double word from an I/O port.
+ */
+uint_t In_DWord(ushort_t port)
+{
+    uint_t value;
+
+    __asm__ __volatile__ (
+       "inl %1, %0"
+       : "=a" (value)
+       : "Nd" (port)
+    );
+
+    return value;
+}
+
+/*
  * Short delay.  May be needed when talking to some
  * (slow) I/O devices.
  */
index 9b614d2..1a67775 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Kernel threads
  * Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
@@ -560,6 +560,8 @@ void Schedule(void)
      * will "return", and then Schedule() will return to wherever
      * it was called from.
      */
+
+    SerialPrint("Switch_To_Thread() in Schedule()\n");
     Switch_To_Thread(runnable);
 }
 
index a498a90..e557664 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.36 $
+ * $Revision: 1.37 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
@@ -36,6 +36,7 @@
 
 #include <geekos/vmm_stubs.h>
 
+#include <geekos/pci.h>
 
 
 
@@ -192,6 +193,9 @@ void Main(struct Boot_Info* bootInfo)
   Init_Keyboard();
   Init_VM(bootInfo);
   Init_Paging();
+  
+  Init_PCI();
+
   Init_Stubs();
 
   //  Init_IDE();
index dbda61f..766ce07 100644 (file)
@@ -2,7 +2,7 @@
  * GeekOS timer interrupt support
  * Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
  * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu>
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
  * 
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "COPYING".
@@ -208,11 +208,20 @@ static void Timer_Interrupt_Handler(struct Interrupt_State* state)
 
     SerialPrint("Host Timer Interrupt Handler running\n");
 
+
+#if 0
+#define STACK_LEN 256
+
+    SerialPrint("Timer====\n");
+    Dump_Interrupt_State(state);
+    //    SerialMemDump((unsigned char*)(&current),STACK_LEN);
+    SerialPrint("Timer done===\n");
+
+#endif
     /* Update global and per-thread number of ticks */
     ++g_numTicks;
     ++current->numTicks;
 
-
     /*
      * If thread has been running for an entire quantum,
      * inform the interrupt return code that we want
index 92d61f1..0b69b6a 100644 (file)
@@ -334,10 +334,34 @@ int RunVMM(struct Boot_Info * bootInfo) {
        struct vm_device * keyboard = create_keyboard();
        struct vm_device * pit = create_pit();
 
-       //generic_port_range_type range = {0,1024} ; // hook first 1024 ports if not already hooked
 
-       //struct vm_device * generic = create_generic(&range, 1, NULL, 0, NULL, 0);
+
+#if GENERIC
+       generic_port_range_type range[] = {
+          {0x00, 0x07},   // DMA 1 channels 0,1,2,3 (address, counter)
+          {0xc0, 0xc7},   // DMA 2 channels 4,5,6,7 (address, counter)
+          {0x87, 0x87},   // DMA 1 channel 0 page register
+          {0x83, 0x83},   // DMA 1 channel 1 page register
+          {0x81, 0x81},   // DMA 1 channel 2 page register
+          {0x82, 0x82},   // DMA 1 channel 3 page register
+          {0x8f, 0x8f},   // DMA 2 channel 4 page register
+          {0x8b, 0x8b},   // DMA 2 channel 5 page register
+          {0x89, 0x89},   // DMA 2 channel 6 page register
+          {0x8a, 0x8a},   // DMA 2 channel 7 page register
+         {0x08, 0x0f},   // DMA 1 misc registers (csr, req, smask,mode,clearff,reset,enable,mmask)
+          {0xd0, 0xde},   // DMA 2 misc registers
+          {0x3f0, 0x3f2}, // Primary floppy controller (base,statusa/statusb,DOR)
+          {0x3f4, 0x3f5}, // Primary floppy controller (mainstat/datarate,data)
+          {0x3f7, 0x3f7}, // Primary floppy controller (DIR)
+          {0x370, 0x372}, // Secondary floppy controller (base,statusa/statusb,DOR)
+          {0x374, 0x375}, // Secondary floppy controller (mainstat/datarate,data)
+          {0x377, 0x377}, // Secondary floppy controller (DIR)
+          {0x378, 0x400}
+        };
+
+       struct vm_device * generic = create_generic(range,19,NULL,0,NULL,0);
        
+#endif
 
        attach_device(&(vm_info), nvram);
        //attach_device(&(vm_info), timer);
@@ -345,8 +369,12 @@ int RunVMM(struct Boot_Info * bootInfo) {
        attach_device(&(vm_info), pit);
        attach_device(&(vm_info), keyboard);
 
+
+#if GENERIC
        // Important that this be attached last!
-       //attach_device(&(vm_info), generic);
+       attach_device(&(vm_info), generic);
+
+#endif
 
        PrintDebugDevMgr(&(vm_info.dev_mgr));
       }
index 503776f..77e8597 100644 (file)
@@ -143,6 +143,8 @@ safe_svm_launch:
        push    ebp
        mov     ebp, esp
        pushf
+       push    fs
+       push    gs
        pusha                                   ;; Save Host state
 
 
@@ -166,6 +168,8 @@ safe_svm_launch:
        add     esp, 4                          ;; skip past the gpr ptr
        
        popa                                    ;; Restore Host state
+       pop     gs
+       pop     fs
        popf
        pop     ebp
        ret
index 9b8d91e..a414691 100644 (file)
@@ -10,16 +10,16 @@ int v3_parse_instr(struct guest_info * info,
                   struct x86_operand * dst_operand,
                   struct x86_operand * extra_operand) {
 
-  V3_Assert(src_operand != NULL);
-  V3_Assert(dst_operand != NULL);
-  V3_Assert(extra_operand != NULL);
-  V3_Assert(instr_length != NULL);
-  V3_Assert(info != NULL);
+  V3_ASSERT(src_operand != NULL);
+  V3_ASSERT(dst_operand != NULL);
+  V3_ASSERT(extra_operand != NULL);
+  V3_ASSERT(instr_length != NULL);
+  V3_ASSERT(info != NULL);
 
   
   // Ignore prefixes for now
-  while (is_prefix_byte(*instr)) {
-    instr++;
+  while (is_prefix_byte(*instr_ptr)) {
+    instr_ptr++;
     *instr_length++;
   }