From: Jack Lange Date: Fri, 20 Jun 2008 15:27:41 +0000 (+0000) Subject: added decoder X-Git-Tag: boot386puppy-26-to-ide~22 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=1c63b0651a5d039076d8027c7cd87960e4151408 added decoder --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index 4151515..c4aa17c 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -1,6 +1,6 @@ # Makefile for GeekOS kernel, userspace, and tools # Copyright (c) 2004,2005 David H. Hovemeyer -# $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". @@ -126,7 +126,7 @@ VMM_C_SRCS := vm_guest.c \ 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 diff --git a/palacios/include/palacios/vmm_emulate.h b/palacios/include/palacios/vmm_decoder.h similarity index 95% rename from palacios/include/palacios/vmm_emulate.h rename to palacios/include/palacios/vmm_decoder.h index d4288a2..e25497a 100644 --- a/palacios/include/palacios/vmm_emulate.h +++ b/palacios/include/palacios/vmm_decoder.h @@ -8,6 +8,29 @@ * 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... @@ -95,7 +118,6 @@ static const uchar_t PREFIX_BR_TAKEN = 0x3E; 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 @@ -153,7 +175,11 @@ static inline addr_t get_addr_linear(struct guest_info * info, addr_t addr, stru 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; diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 057685d..b4209ef 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -9,7 +9,7 @@ #include #include -#include +#include extern struct vmm_os_hooks * os_hooks; diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index f7916fc..7e1a91b 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/palacios/src/palacios/svm_io.c b/palacios/src/palacios/svm_io.c index 38f0b8e..ce12669 100644 --- a/palacios/src/palacios/svm_io.c +++ b/palacios/src/palacios/svm_io.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include @@ -103,6 +103,10 @@ int handle_svm_io_ins(struct guest_info * info) { } 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) { diff --git a/palacios/src/palacios/vmm_ctrl_regs.c b/palacios/src/palacios/vmm_ctrl_regs.c index fba6004..7d59b82 100644 --- a/palacios/src/palacios/vmm_ctrl_regs.c +++ b/palacios/src/palacios/vmm_ctrl_regs.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index c4747ee..f31d471 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 142f41d..5536f04 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -3,7 +3,7 @@ #include #include -#include +#include