X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_decoder.c;h=10fb2dcf7c9df55093f1e228dfd7b62ffecfa6d3;hb=9499a207c37ebd0eac1e9f62b4600c448101d7b0;hp=6884d33c247088d1ddd5509516801edddf1bb2dd;hpb=f224dad455ede0cdeadb60d0e428afcc869a4b2d;p=palacios.git diff --git a/palacios/src/palacios/vmm_decoder.c b/palacios/src/palacios/vmm_decoder.c index 6884d33..10fb2dc 100644 --- a/palacios/src/palacios/vmm_decoder.c +++ b/palacios/src/palacios/vmm_decoder.c @@ -1,2 +1,30 @@ #include + +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]); + } +} + + +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++; + } + } +}