X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_decoder.c;h=26b5e91609fd8604d0fefc51ce50981ee21219b8;hb=091d8b1fcfc3a766f6603d4c1c69d9f8f4bf3031;hp=a414691b71682740574a16021a0adf8d8ee319bc;hpb=3b49b57d1f3b8bccdf7390c26ea9cda1f8dac8c3;p=palacios.git diff --git a/palacios/src/palacios/vmm_decoder.c b/palacios/src/palacios/vmm_decoder.c index a414691..26b5e91 100644 --- a/palacios/src/palacios/vmm_decoder.c +++ b/palacios/src/palacios/vmm_decoder.c @@ -1,34 +1,33 @@ -#include - - +/* (c) 2008, Jack Lange */ +/* (c) 2008, The V3VEE Project */ -/* 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 - 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_ptr)) { - instr_ptr++; - *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++; + } + } }