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.


modified copyright tags
[palacios.git] / palacios / src / palacios / vmm_decoder.c
index 9b8d91e..26b5e91 100644 (file)
@@ -1,34 +1,33 @@
-#include <palacios/vmm_decoder.h>
-
-
+/* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
+/* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
 
-/* The full blown instruction parser... */
-int v3_parse_instr(struct guest_info * info,
-                  char * instr_ptr,
-                  uint_t * instr_length, 
-                  struct x86_operand * src_operand,
-                  struct x86_operand * dst_operand,
-                  struct x86_operand * extra_operand) {
+#include <palacios/vmm_decoder.h>
 
-  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++;
-    *instr_length++;
+int opcode_cmp(const uchar_t * op1, const uchar_t * op2) {
+  if (op1[0] != op2[0]) {
+    return op1[0] - op2[0];;
+  } else {
+    return memcmp(op1 + 1, op2 + 1, op1[0]);
   }
+}
 
 
-  // Opcode table lookup, see xen/kvm
-
-
-
-
-
-  return 0;
+void strip_rep_prefix(uchar_t * instr, int length) {
+  int read_ctr = 0;
+  int write_ctr = 0;
+  int found = 0;
+
+  while (read_ctr < length) {
+    if ((!found) && 
+       ( (instr[read_ctr] == 0xF2) ||
+         (instr[read_ctr] == 0xF3))) {
+      read_ctr++;
+      found = 1;
+    } else {
+      instr[write_ctr] = instr[read_ctr];
+      write_ctr++;
+      read_ctr++;
+    }
+  }
 }