# Makefile for GeekOS kernel, userspace, and tools
 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $Revision: 1.37 $
+# $Revision: 1.38 $
 
 # This is free software.  You are permitted to use,
 # redistribute, and modify it as specified in the file "COPYING".
                vmcb.c vmm_mem.c vmm_paging.c vmm_io.c vmm_debug.c svm_io.c \
                vmm_intr.c vmm_time.c\
                vmm_shadow_paging.c vm_guest_mem.c  \
-                vm_dev.c vmm_dev_mgr.c \
+                vm_dev.c vmm_dev_mgr.c vmm_decoder.c \
 #\
 #              vmx.c vmcs_gen.c vmcs.c
 
 
  * We can parse out the instruction prefixes, as well as decode the operands 
  */
 
+typedef enum {INVALID_OPERAND, REG_OPERAND, MEM_OPERAND} operand_type_t;
+
+
+
+
+struct x86_operand {
+  addr_t operand;
+  uint_t size;
+  operand_type_t type;
+};
+
+
+/* This parses an instruction 
+ * All addresses in arguments are in the host address space
+ */
+int v3_parse_instr(struct guest_info * info,             // input
+                  char * instr_ptr,                        // input 
+                  uint_t * instr_length,                // output
+                  struct x86_operand * src_operand,     // output
+                  struct x86_operand * dst_operand,     // output
+                  struct x86_operand * extra_operand);  // output
+                  
+
 
 /* 
  * JRL: Some of this was taken from the Xen sources... 
 static const uchar_t PREFIX_OP_SIZE = 0x66;
 static const uchar_t PREFIX_ADDR_SIZE = 0x67;
 
-
 static inline int is_prefix_byte(char byte) {
   switch (byte) {
   case 0xF0:      // lock
 
 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 v3_gprs;
 
 
 #include <palacios/vmm_debug.h>
 #include <palacios/vm_guest_mem.h>
 
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 
 
 extern struct vmm_os_hooks * os_hooks;
 
 #include <palacios/svm_handler.h>
 #include <palacios/vmm.h>
 #include <palacios/vm_guest_mem.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 #include <palacios/vmm_ctrl_regs.h>
 #include <palacios/svm_io.h>
 #include <palacios/vmm_intr.h>
 
 #include <palacios/svm_io.h>
 #include <palacios/vmm_io.h>
 #include <palacios/vmm_ctrl_regs.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 #include <palacios/vm_guest_mem.h>
 
 
   } else {
     // This value should be set depending on the host register size...
     mask = get_gpr_mask(info);
+
+
+    PrintDebug("INS Aborted... Check implementation\n");
+    return -1;
   }
 
   if (io_info->rep) {
 
 #include <palacios/vmm_mem.h>
 #include <palacios/vmm.h>
 #include <palacios/vmcb.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 #include <palacios/vm_guest_mem.h>
 #include <palacios/vmm_ctrl_regs.h>
 
 
 #include <palacios/vmm_mem.h>
 #include <palacios/vmm.h>
 #include <palacios/vmm_util.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 
 
 
 
 
 #include <palacios/vmm.h>
 #include <palacios/vm_guest_mem.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>