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 queue implementation
Jack Lange [Mon, 25 Aug 2008 21:51:49 +0000 (21:51 +0000)]
palacios/build/Makefile
palacios/include/palacios/vmm_ctrl_regs.h
palacios/include/palacios/vmm_queue.h [new file with mode: 0644]
palacios/src/palacios/vmm_ctrl_regs.c
palacios/src/palacios/vmm_queue.c [new file with mode: 0644]

index b4a27c6..0d31d7e 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for GeekOS kernel, userspace, and tools
 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $Revision: 1.64 $
+# $Revision: 1.65 $
 
 # This is free software.  You are permitted to use,
 # redistribute, and modify it as specified in the file "COPYING".
@@ -49,7 +49,7 @@ DEBUG=1
 DEBUG_SECTIONS= 
 
 ifeq ($(DEBUG_ALL),1)
-  DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_IO -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_GENERIC 
+  DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_IO -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_GENERIC -DDEBUG_RAMDISK
 endif
 ifeq ($(DEBUG_SHADOW_PAGING),1)
 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING
@@ -216,7 +216,7 @@ VMM_C_SRCS :=   vm_guest.c \
                 vm_dev.c vmm_dev_mgr.c vmm_decoder.c \
                 svm_halt.c svm_pause.c svm_wbinvd.c \
                vmm_config.c vmm_hashtable.c \
-               vmm_string.c vmm_emulator.c \
+               vmm_string.c vmm_emulator.c vmm_queue.c\
                 $(DECODER_SRCS)
 #              vmx.c vmcs_gen.c vmcs.c
 
index f53034c..fad8cdd 100644 (file)
@@ -164,7 +164,7 @@ struct rflags {
 
 
 
-
+/*
 // First opcode byte
 static const uchar_t cr_access_byte = 0x0f;
 
@@ -176,7 +176,7 @@ static const uchar_t smsw_reg_byte = 0x4;
 static const uchar_t clts_byte = 0x06;
 static const uchar_t mov_to_cr_byte = 0x22;
 static const uchar_t mov_from_cr_byte = 0x20;
-
+*/
 
 
 int handle_cr0_write(struct guest_info * info);
diff --git a/palacios/include/palacios/vmm_queue.h b/palacios/include/palacios/vmm_queue.h
new file mode 100644 (file)
index 0000000..ee0e01a
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __VMM_QUEUE_H__
+#define __VMM_QUEUE_H__
+
+#ifdef __V3VEE__
+
+#include <palacios/vmm.h>
+#include <palacios/vmm_list.h>
+
+
+
+/* IMPORTANT:
+ * This implementation currently does no locking, and as such is not 
+ * SMP/thread/interrupt safe
+ */
+
+
+struct queue_entry {
+  addr_t entry;
+  struct list_head entry_list;
+};
+
+
+struct gen_queue {
+  uint_t num_entries;
+  struct list_head entries;
+
+  // We really need to implement this....
+  // void * lock;
+};
+
+
+struct gen_queue * create_queue();
+void init_queue(struct gen_queue * queue);
+
+void enqueue(struct gen_queue * queue, addr_t entry);
+addr_t dequeue(struct gen_queue * queue);
+
+
+
+#endif // ! __V3VEE__
+
+#endif
index 4575f99..39303aa 100644 (file)
@@ -20,9 +20,6 @@
 #endif
 
 
-
-
-
 // First Attempt = 494 lines
 // current = 106 lines
 int handle_cr0_write(struct guest_info * info) {
@@ -202,7 +199,7 @@ int handle_cr0_read(struct guest_info * info) {
 
 
 
-// First Attemp = 256 lines
+// First Attempt = 256 lines
 // current = 65 lines
 int handle_cr3_write(struct guest_info * info) {
   int ret;
@@ -246,14 +243,12 @@ int handle_cr3_write(struct guest_info * info) {
       
 
       cached = cache_page_tables32(info, CR3_TO_PDE32(*(addr_t *)new_cr3));
+
       if (cached == -1) {
        PrintError("CR3 Cache failed\n");
        return -1;
       } else if (cached == 0) {
-
-
        addr_t shadow_pt;
-
        
        PrintDebug("New CR3 is different - flushing shadow page table\n");      
        
@@ -334,12 +329,7 @@ int handle_cr3_read(struct guest_info * info) {
     return -1;
   }
 
-
   info->rip += dec_instr.instr_length;
 
   return 0;
 }
-
-
-
-
diff --git a/palacios/src/palacios/vmm_queue.c b/palacios/src/palacios/vmm_queue.c
new file mode 100644 (file)
index 0000000..da5176a
--- /dev/null
@@ -0,0 +1,39 @@
+#include <palacios/vmm_queue.h>
+
+
+
+void init_queue(struct gen_queue * queue) {
+  queue->num_entries = 0;
+  INIT_LIST_HEAD(&(queue->entries));
+}
+
+
+struct gen_queue * create_queue() {
+  struct gen_queue * tmp_queue = V3_Malloc(sizeof(struct gen_queue));
+  init_queue(tmp_queue);
+  return tmp_queue;
+}
+
+void enqueue(struct gen_queue * queue, addr_t entry) {
+  struct queue_entry * q_entry = V3_Malloc(sizeof(struct queue_entry));
+
+  q_entry->entry = entry;
+  list_add_tail(&(q_entry->entry_list), &(queue->entries));
+  queue->num_entries++;
+}
+
+
+addr_t dequeue(struct gen_queue * queue) {
+  addr_t entry_val = 0;
+
+  if (!list_empty(&(queue->entries))) {
+    struct list_head * q_entry = queue->entries.next;
+    struct queue_entry * tmp_entry = list_entry(q_entry, struct queue_entry, entry_list);
+
+    entry_val = tmp_entry->entry;
+    list_del(q_entry);
+    V3_Free(tmp_entry);
+  }
+
+  return entry_val;
+}