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.


*** empty log message ***
[palacios.git] / palacios / include / palacios / vmm_emulate.h
index ea24d25..d4288a2 100644 (file)
@@ -6,12 +6,11 @@
 /*
  * This is where we do the hideous X86 instruction parsing among other things
  * We can parse out the instruction prefixes, as well as decode the operands 
-
  */
 
 
-/* JRL: Some of this was taken from the Xen sources... 
- *
+/* 
+ * JRL: Some of this was taken from the Xen sources... 
  */
 
 #define PACKED __attribute__((packed))
@@ -121,17 +120,32 @@ static inline int is_prefix_byte(char byte) {
 }
 
 
+static inline v3_reg_t get_gpr_mask(struct guest_info * info) {
+  switch (info->cpu_mode) {
+  case REAL: 
+    return 0xffff;
+    break;
+  case PROTECTED:
+  case PROTECTED_PG:
+    return 0xffffffff;
+  default:
+    V3_ASSERT(0);
+    return 0;
+  }
+}
+
 
-static inline addr_t get_addr_linear(struct guest_info * info, addr_t addr, addr_t seg_base) {
+static inline addr_t get_addr_linear(struct guest_info * info, addr_t addr, struct v3_segment * seg) {
   switch (info->cpu_mode) {
   case REAL:
-    return addr + (seg_base << 4);
+    return addr + (seg->selector << 4);
     break;
   case PROTECTED:
   case PROTECTED_PG:
-    return addr + seg_base;
+    return addr + seg->base;
     break;
   default:
+    V3_ASSERT(0);
     return 0;
   }
 }
@@ -141,9 +155,9 @@ typedef enum {INVALID_ADDR_TYPE, REG, DISP0, DISP8, DISP16, DISP32} modrm_mode_t
 typedef enum {INVALID_REG_SIZE, REG64, REG32, REG16, REG8} reg_size_t;
 typedef enum {INVALID_OPERAND, REG_OPERAND, MEM_OPERAND} operand_type_t;
 
-struct guest_gprs;
+struct v3_gprs;
 
-static inline addr_t decode_register(struct guest_gprs * gprs, char reg_code, reg_size_t reg_size) {
+static inline addr_t decode_register(struct v3_gprs * gprs, char reg_code, reg_size_t reg_size) {
   addr_t reg_addr;
 
   switch (reg_code) {
@@ -197,7 +211,7 @@ static inline addr_t decode_register(struct guest_gprs * gprs, char reg_code, re
 
 
 
-static inline operand_type_t decode_operands16(struct guest_gprs * gprs, // input/output
+static inline operand_type_t decode_operands16(struct v3_gprs * gprs, // input/output
                                               char * modrm_instr,       // input
                                               int * offset,             // output
                                               addr_t * first_operand,   // output
@@ -286,7 +300,7 @@ static inline operand_type_t decode_operands16(struct guest_gprs * gprs, // inpu
 
 
 
-static inline operand_type_t decode_operands32(struct guest_gprs * gprs, // input/output
+static inline operand_type_t decode_operands32(struct v3_gprs * gprs, // input/output
                                               char * modrm_instr,       // input
                                               int * offset,             // output
                                               addr_t * first_operand,   // output