X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_decoder.c;h=10fb2dcf7c9df55093f1e228dfd7b62ffecfa6d3;hp=6d1299a4b67c4b9e06fc0b116bb37f9d6d783925;hb=a5c5675571882a9b8a7594ef07fe303b195ef9ae;hpb=9b78fe7d41b07fd135eae2282cc18ccb964e7de3 diff --git a/palacios/src/palacios/vmm_decoder.c b/palacios/src/palacios/vmm_decoder.c index 6d1299a..10fb2dc 100644 --- a/palacios/src/palacios/vmm_decoder.c +++ b/palacios/src/palacios/vmm_decoder.c @@ -8,3 +8,23 @@ int opcode_cmp(const uchar_t * op1, const uchar_t * op2) { return memcmp(op1 + 1, op2 + 1, op1[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++; + } + } +}