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 instruction emulation for 64 bit machines
Jack Lange [Tue, 27 Jan 2009 21:07:20 +0000 (15:07 -0600)]
palacios/build/Makefile
palacios/include/palacios/vmm_instr_emulator.h
palacios/include/palacios/vmm_mem.h
palacios/include/palacios/vmm_rbtree.h
palacios/src/palacios/vmm_paging.c
palacios/src/palacios/vmm_xed.c

index 8ebcd21..6b8332b 100644 (file)
@@ -265,6 +265,7 @@ VMM_OBJS := \
        palacios/vmm_msr.o \
        palacios/svm_msr.o \
        palacios/vmm_socket.o \
+       palacios/vmm_xed.o \
 
 #              vmx.c vmcs_gen.c vmcs.c
 
@@ -296,17 +297,6 @@ DEVICES_OBJS := \
 
 $(DEVICES_OBJS) :: EXTRA_CFLAGS = \
        $(JRLDEBUG) \
-#
-# DECODER is the decoder that will be used 
-# currently we only support xed
-#
-DECODER=XED
-
-ifeq ($(DECODER),XED)
-VMM_OBJS += palacios/vmm_xed.o 
-else
-# This is an error
-endif
 
 
 
index 190dcee..74701a5 100644 (file)
         "pushf; "                                                      \
         "pop %0; "                                                     \
         "popf; "                                                       \
-        : "=b"(*flags)                                                 \
-        : "D"(*dst),"S"(*src),"c"(*ecx),"b"(*flags)                    \
+        : "=q"(*flags)                                                 \
+        : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags)                    \
         );                                                             \
                                                                        \
     /*  : "=D"(*dst),"=S"(*src),"=c"(*ecx),"=q"(*flags)*/              \
         "pushf; "                                                      \
         "pop %0; "                                                     \
         "popf; "                                                       \
-        : "=b"(*flags)                                                 \
-        : "D"(*dst),"S"(*src),"c"(*ecx),"b"(*flags)                    \
+        : "=q"(*flags)                                                 \
+        : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags)                    \
         );                                                             \
     *flags |= flags_rsvd;                                              \
   }
         "pushf; "                                                      \
         "pop %0; "                                                     \
         "popf; "                                                       \
-        : "=b"(*flags)                                                 \
-        : "D"(*dst),"S"(*src),"c"(*ecx),"b"(*flags)                    \
+        : "=q"(*flags)                                                 \
+        : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags)                    \
         );                                                             \
     *flags |= flags_rsvd;                                              \
   }
index e08e473..3616bc7 100644 (file)
@@ -127,7 +127,7 @@ int v3_hook_write_mem(struct guest_info * info, addr_t guest_addr_start, addr_t
                      int (*write)(addr_t guest_addr, void * src, uint_t length, void * priv_data),
                      void * priv_data);
 
-int unhook_guest_mem(struct guest_info * info, addr_t guest_addr);
+
 
 
 
index 44131fc..6b72d6d 100644 (file)
@@ -96,6 +96,11 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 
 #ifdef __V3VEE__
 
+#include <palacios/vmm_types.h>
+
+
+#undef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
 #define container_of(ptr, type, member) ({                      \
         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
index 12163f8..271ee3f 100644 (file)
@@ -46,6 +46,11 @@ static pt_entry_type_t pte64_lookup(pte64_t * pt, addr_t addr, addr_t * entry);
 
 
 
+#ifndef DEBUG_SHADOW_PAGING
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
+
 
 
 void delete_page_tables_32(pde32_t * pde) {
index f34408b..3c39b13 100644 (file)
@@ -67,12 +67,16 @@ static const ullong_t mask_8 = 0xffffffffffffffffLL;
       switch (length) {                                \
       case 1:                                  \
        mask = mask_1;                          \
+       break;                                  \
       case 2:                                  \
        mask = mask_2;                          \
+       break;                                  \
       case 4:                                  \
        mask = mask_4;                          \
+       break;                                  \
       case 8:                                  \
        mask = mask_8;                          \
+       break;                                  \
       }                                                \
       val & mask;})                            \
 
@@ -581,14 +585,14 @@ static int get_memory_operand(struct guest_info * info,  xed_decoded_inst_t * xe
   
   
 
-  PrintDebug("Struct: Seg=%p, base=%p, index=%p, scale=%p, displacement=%p\n", 
+  PrintDebug("Struct: Seg=%p, base=%p, index=%p, scale=%p, displacement=%p (size=%d)\n", 
             (void *)mem_op.segment, (void*)mem_op.base, (void *)mem_op.index, 
-            (void *)mem_op.scale, (void *)(addr_t)mem_op.displacement);
+            (void *)mem_op.scale, (void *)(addr_t)mem_op.displacement, mem_op.displacement_size);
 
 
   PrintDebug("operand size: %d\n", operand->size);
 
-  seg = mem_op.segment;
+  seg = MASK(mem_op.segment, mem_op.segment_size);
   base = MASK(mem_op.base, mem_op.base_size);
   index = MASK(mem_op.index, mem_op.index_size);
   scale = mem_op.scale;