X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_instr_emulator.h;h=aef325ace0b450bf8b7a25b3a0213c8c552c688a;hb=7569a7e7b33dc1c26b68d66e4bcd3aebf3beaf7f;hp=3e9e613992729752ccbe903d796b8ff135219d0f;hpb=22e5122c2abd2e2b0a9ce5c5448fc36d294cfcca;p=palacios.git diff --git a/palacios/include/palacios/vmm_instr_emulator.h b/palacios/include/palacios/vmm_instr_emulator.h index 3e9e613..aef325a 100644 --- a/palacios/include/palacios/vmm_instr_emulator.h +++ b/palacios/include/palacios/vmm_instr_emulator.h @@ -397,6 +397,49 @@ +#define MAKE_2OP_8EXT_INST(iname) static inline void iname##8(addr_t * dst, addr_t * src, uint_t dst_len) { \ + if (dst_len == 2) { \ + asm volatile ( \ + #iname" %1, %0; " \ + : "=q"(*(uint16_t *)dst) \ + : "q"(*(uint8_t *)src), "0"(*(uint16_t *)dst) \ + ); \ + } else if (dst_len == 4) { \ + asm volatile ( \ + #iname" %1, %0; " \ + : "=q"(*(uint32_t *)dst) \ + : "q"(*(uint8_t *)src), "0"(*(uint32_t *)dst) \ + ); \ + } else if (dst_len == 8) { \ + asm volatile ( \ + #iname" %1, %0; " \ + : "=q"(*(uint64_t *)dst) \ + : "q"(*(uint8_t *)src), "0"(*(uint64_t *)dst) \ + ); \ + } \ + } + +#define MAKE_2OP_16EXT_INST(iname) static inline void iname##16(addr_t * dst, addr_t * src, uint_t dst_len) { \ + if (dst_len == 4) { \ + asm volatile ( \ + #iname" %1, %0; " \ + : "=q"(*(uint32_t *)dst) \ + : "q"(*(uint16_t *)src), "0"(*(uint32_t *)dst) \ + ); \ + } else if (dst_len == 8) { \ + asm volatile ( \ + #iname" %1, %0; " \ + : "=q"(*(uint64_t *)dst) \ + : "q"(*(uint16_t *)src), "0"(*(uint64_t *)dst) \ + ); \ + } \ + } + + + + + + /****************************/ /* 8 Bit instruction forms */ /****************************/ @@ -433,6 +476,9 @@ MAKE_1OP_8FLAGS_INST(setz); MAKE_1OP_8_INST(not); MAKE_2OP_8_INST(mov); +MAKE_2OP_8EXT_INST(movzx); +MAKE_2OP_8EXT_INST(movsx); + MAKE_2OP_8_INST(xchg); MAKE_2OP_8STR_INST(movs); @@ -456,6 +502,8 @@ MAKE_1OP_16FLAGS_INST(neg); MAKE_1OP_16_INST(not); MAKE_2OP_16_INST(mov); +MAKE_2OP_16EXT_INST(movzx); +MAKE_2OP_16EXT_INST(movsx); MAKE_2OP_16_INST(xchg); MAKE_2OP_16STR_INST(movs); @@ -478,6 +526,7 @@ MAKE_1OP_32FLAGS_INST(neg); MAKE_1OP_32_INST(not); MAKE_2OP_32_INST(mov); + MAKE_2OP_32_INST(xchg); @@ -505,6 +554,7 @@ MAKE_1OP_64_INST(not); MAKE_2OP_64_INST(mov); + MAKE_2OP_64_INST(xchg);