X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_instr_emulator.h;h=84b07a41f80d86ec67f9f866126cbb34f3ce6243;hb=0ab69a6bdddef0ae09d8beb82b9c6c051e1a564d;hp=89753d99f0b908d42ccbee570e3056a23fc8ce00;hpb=90c92392972d3ad76753f21a31a8e7db796073cc;p=palacios.git diff --git a/palacios/include/palacios/vmm_instr_emulator.h b/palacios/include/palacios/vmm_instr_emulator.h index 89753d9..84b07a4 100644 --- a/palacios/include/palacios/vmm_instr_emulator.h +++ b/palacios/include/palacios/vmm_instr_emulator.h @@ -22,192 +22,192 @@ #define MAKE_1OP_8FLAGS_INST(iname) static inline void iname##8(addr_t * dst, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %2; " \ - "popf; " \ - #iname"b %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint8_t *)dst),"=q"(*flags) \ - : "q"(*flags), "0"(*(uint8_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ + asm volatile ( \ + "pushf; " \ + "push %2; " \ + "popf; " \ + #iname"b %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint8_t *)dst),"=q"(*flags) \ + : "q"(*flags), "0"(*(uint8_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ \ - } + } #define MAKE_1OP_16FLAGS_INST(iname) static inline void iname##16(addr_t * dst, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %2; " \ - "popf; " \ - #iname"w %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint16_t *)dst),"=q"(*flags) \ - : "q"(*flags), "0"(*(uint16_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ + asm volatile ( \ + "pushf; " \ + "push %2; " \ + "popf; " \ + #iname"w %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint16_t *)dst),"=q"(*flags) \ + : "q"(*flags), "0"(*(uint16_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ \ - } + } #define MAKE_1OP_32FLAGS_INST(iname) static inline void iname##32(addr_t * dst, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %2; " \ - "popf; " \ - #iname"l %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint32_t *)dst),"=q"(*flags) \ - : "q"(*flags), "0"(*(uint32_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ + asm volatile ( \ + "pushf; " \ + "push %2; " \ + "popf; " \ + #iname"l %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint32_t *)dst),"=q"(*flags) \ + : "q"(*flags), "0"(*(uint32_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ \ - } + } #define MAKE_1OP_64FLAGS_INST(iname) static inline void iname##64(addr_t * dst, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushfq; " \ - "push %2; " \ - "popfq; " \ - #iname"q %0; " \ - "pushfq; " \ - "pop %1; " \ - "popfq; " \ - : "=q"(*(uint64_t *)dst),"=q"(*flags) \ - : "q"(*flags), "0"(*(uint64_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ + asm volatile ( \ + "pushfq; " \ + "push %2; " \ + "popfq; " \ + #iname"q %0; " \ + "pushfq; " \ + "pop %1; " \ + "popfq; " \ + : "=q"(*(uint64_t *)dst),"=q"(*flags) \ + : "q"(*flags), "0"(*(uint64_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ \ - } + } #define MAKE_1OP_8_INST(iname) static inline void iname##8(addr_t * dst) { \ - asm volatile ( \ - #iname"b %0; " \ - : "=q"(*(uint8_t *)dst) \ - : "0"(*(uint8_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"b %0; " \ + : "=q"(*(uint8_t *)dst) \ + : "0"(*(uint8_t *)dst) \ + ); \ + } #define MAKE_1OP_16_INST(iname) static inline void iname##16(addr_t * dst) { \ - asm volatile ( \ - #iname"w %0; " \ - : "=q"(*(uint16_t *)dst) \ - : "0"(*(uint16_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"w %0; " \ + : "=q"(*(uint16_t *)dst) \ + : "0"(*(uint16_t *)dst) \ + ); \ + } #define MAKE_1OP_32_INST(iname) static inline void iname##32(addr_t * dst) { \ - asm volatile ( \ - #iname"l %0; " \ - : "=q"(*(uint32_t *)dst) \ - : "0"(*(uint32_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"l %0; " \ + : "=q"(*(uint32_t *)dst) \ + : "0"(*(uint32_t *)dst) \ + ); \ + } #define MAKE_1OP_64_INST(iname) static inline void iname##64(addr_t * dst) { \ - asm volatile ( \ - #iname"q %0; " \ - : "=q"(*(uint64_t *)dst) \ - : "0"(*(uint64_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"q %0; " \ + : "=q"(*(uint64_t *)dst) \ + : "0"(*(uint64_t *)dst) \ + ); \ + } #define MAKE_2OP_64FLAGS_INST(iname) static inline void iname##64(addr_t * dst, addr_t * src, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushfq\r\n" \ - "push %3\r\n" \ - "popfq\r\n" \ - #iname"q %2, %0\r\n" \ - "pushfq\r\n" \ - "pop %1\r\n" \ - "popfq\r\n" \ - : "=q"(*(uint64_t *)dst),"=q"(*flags) \ - : "q"(*(uint64_t *)src),"q"(*flags), "0"(*(uint64_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ + asm volatile ( \ + "pushfq\r\n" \ + "push %3\r\n" \ + "popfq\r\n" \ + #iname"q %2, %0\r\n" \ + "pushfq\r\n" \ + "pop %1\r\n" \ + "popfq\r\n" \ + : "=q"(*(uint64_t *)dst),"=q"(*flags) \ + : "q"(*(uint64_t *)src),"q"(*flags), "0"(*(uint64_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ \ - } + } #define MAKE_2OP_32FLAGS_INST(iname) static inline void iname##32(addr_t * dst, addr_t * src, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %3; " \ - "popf; " \ - #iname"l %2, %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint32_t *)dst),"=q"(*flags) \ - : "q"(*(uint32_t *)src),"q"(*flags), "0"(*(uint32_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %3; " \ + "popf; " \ + #iname"l %2, %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint32_t *)dst),"=q"(*flags) \ + : "q"(*(uint32_t *)src),"q"(*flags), "0"(*(uint32_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_16FLAGS_INST(iname) static inline void iname##16(addr_t * dst, addr_t * src, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %3; " \ - "popf; " \ - #iname"w %2, %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint16_t *)dst),"=q"(*flags) \ - : "q"(*(uint16_t *)src),"q"(*flags), "0"(*(uint16_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %3; " \ + "popf; " \ + #iname"w %2, %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint16_t *)dst),"=q"(*flags) \ + : "q"(*(uint16_t *)src),"q"(*flags), "0"(*(uint16_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_8FLAGS_INST(iname) static inline void iname##8(addr_t * dst, addr_t * src, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %3; " \ - "popf; " \ - #iname"b %2, %0; " \ - "pushf; " \ - "pop %1; " \ - "popf; " \ - : "=q"(*(uint8_t *)dst),"=q"(*flags) \ - : "q"(*(uint8_t *)src),"q"(*flags), "0"(*(uint8_t *)dst) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %3; " \ + "popf; " \ + #iname"b %2, %0; " \ + "pushf; " \ + "pop %1; " \ + "popf; " \ + : "=q"(*(uint8_t *)dst),"=q"(*flags) \ + : "q"(*(uint8_t *)src),"q"(*flags), "0"(*(uint8_t *)dst) \ + ); \ + *flags |= flags_rsvd; \ + } @@ -216,89 +216,89 @@ #define MAKE_2OP_64STR_INST(iname) static inline void iname##64(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushfq; " \ - "pushq %4; " \ - "popfq; " \ - "rep; " \ - #iname"q; " \ - "pushfq; " \ - "popq %0; " \ - "popfq; " \ - : "=q"(*flags) \ - : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushfq; " \ + "pushq %4; " \ + "popfq; " \ + "rep; " \ + #iname"q; " \ + "pushfq; " \ + "popq %0; " \ + "popfq; " \ + : "=q"(*flags) \ + : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_32STR_INST(iname) static inline void iname##32(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"l; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"l; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_16STR_INST(iname) static inline void iname##16(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"w; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"w; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_8STR_INST(iname) static inline void iname##8(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"b; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"b; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"S"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } @@ -306,202 +306,202 @@ #define MAKE_1OP_64STR_INST(iname) static inline void iname##64(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushfq; " \ - "pushq %4; " \ - "popfq; " \ - "rep; " \ - #iname"q; " \ - "pushfq; " \ - "popq %0; " \ - "popfq; " \ - : "=q"(*flags) \ - : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ - ); \ + asm volatile ( \ + "pushfq; " \ + "pushq %4; " \ + "popfq; " \ + "rep; " \ + #iname"q; " \ + "pushfq; " \ + "popq %0; " \ + "popfq; " \ + : "=q"(*flags) \ + : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ + ); \ \ - *flags |= flags_rsvd; \ - } + *flags |= flags_rsvd; \ + } #define MAKE_1OP_32STR_INST(iname) static inline void iname##32(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"l; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*(uint32_t *)dst),"a"(*(uint32_t *)src),"c"(*(uint32_t *)ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"l; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_1OP_16STR_INST(iname) static inline void iname##16(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"w; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"w; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_1OP_8STR_INST(iname) static inline void iname##8(addr_t * dst, \ addr_t * src, \ addr_t * ecx, addr_t * flags) { \ - /* Some of the flags values are not copied out in a pushf, we save them here */ \ - addr_t flags_rsvd = *flags & ~0xfffe7fff; \ + /* Some of the flags values are not copied out in a pushf, we save them here */ \ + addr_t flags_rsvd = *flags & ~0xfffe7fff; \ \ - asm volatile ( \ - "pushf; " \ - "push %4; " \ - "popf; " \ - "rep; " \ - #iname"b; " \ - "pushf; " \ - "pop %0; " \ - "popf; " \ - : "=q"(*flags) \ - : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ - ); \ - *flags |= flags_rsvd; \ - } + asm volatile ( \ + "pushf; " \ + "push %4; " \ + "popf; " \ + "rep; " \ + #iname"b; " \ + "pushf; " \ + "pop %0; " \ + "popf; " \ + : "=q"(*flags) \ + : "D"(*dst),"a"(*src),"c"(*ecx),"q"(*flags) \ + ); \ + *flags |= flags_rsvd; \ + } #define MAKE_2OP_64_INST(iname) static inline void iname##64(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"q %1, %0; " \ - : "=q"(*(uint64_t *)dst) \ - : "q"(*(uint64_t *)src), "0"(*(uint64_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"q %1, %0; " \ + : "=q"(*(uint64_t *)dst) \ + : "q"(*(uint64_t *)src), "0"(*(uint64_t *)dst) \ + ); \ + } #define MAKE_2OP_32_INST(iname) static inline void iname##32(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"l %1, %0; " \ - : "=q"(*(uint32_t *)dst) \ - : "q"(*(uint32_t *)src), "0"(*(uint32_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"l %1, %0; " \ + : "=q"(*(uint32_t *)dst) \ + : "q"(*(uint32_t *)src), "0"(*(uint32_t *)dst) \ + ); \ + } #define MAKE_2OP_16_INST(iname) static inline void iname##16(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"w %1, %0; " \ - : "=q"(*(uint16_t *)dst) \ - : "q"(*(uint16_t *)src), "0"(*(uint16_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"w %1, %0; " \ + : "=q"(*(uint16_t *)dst) \ + : "q"(*(uint16_t *)src), "0"(*(uint16_t *)dst) \ + ); \ + } #define MAKE_2OP_8_INST(iname) static inline void iname##8(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"b %1, %0; " \ - : "=q"(*(uint8_t *)dst) \ - : "q"(*(uint8_t *)src), "0"(*(uint8_t *)dst) \ - ); \ - } + asm volatile ( \ + #iname"b %1, %0; " \ + : "=q"(*(uint8_t *)dst) \ + : "q"(*(uint8_t *)src), "0"(*(uint8_t *)dst) \ + ); \ + } #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) \ - ); \ - } \ - } + 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) \ - ); \ - } \ - } + 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) \ + ); \ + } \ + } #define MAKE_2OUT_64_INST(iname) static inline void iname##64(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"q %1, %0; " \ - : "=q"(*(uint64_t *)dst), "=q"(*(uint64_t *)src) \ - : "0"(*(uint64_t *)dst), "1"(*(uint64_t *)src) \ - ); \ - } + asm volatile ( \ + #iname"q %1, %0; " \ + : "=q"(*(uint64_t *)dst), "=q"(*(uint64_t *)src) \ + : "0"(*(uint64_t *)dst), "1"(*(uint64_t *)src) \ + ); \ + } #define MAKE_2OUT_32_INST(iname) static inline void iname##32(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"l %1, %0; " \ - : "=q"(*(uint32_t *)dst), "=q"(*(uint32_t *)src) \ - : "0"(*(uint32_t *)dst), "1"(*(uint32_t *)src) \ - ); \ - } + asm volatile ( \ + #iname"l %1, %0; " \ + : "=q"(*(uint32_t *)dst), "=q"(*(uint32_t *)src) \ + : "0"(*(uint32_t *)dst), "1"(*(uint32_t *)src) \ + ); \ + } #define MAKE_2OUT_16_INST(iname) static inline void iname##16(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"w %1, %0; " \ - : "=q"(*(uint16_t *)dst), "=q"(*(uint16_t *)src) \ - : "0"(*(uint16_t *)dst), "1"(*(uint16_t *)src) \ - ); \ - } + asm volatile ( \ + #iname"w %1, %0; " \ + : "=q"(*(uint16_t *)dst), "=q"(*(uint16_t *)src) \ + : "0"(*(uint16_t *)dst), "1"(*(uint16_t *)src) \ + ); \ + } #define MAKE_2OUT_8_INST(iname) static inline void iname##8(addr_t * dst, addr_t * src) { \ - asm volatile ( \ - #iname"b %1, %0; " \ - : "=q"(*(uint8_t *)dst), "=q"(*(uint8_t *)src) \ - : "0"(*(uint8_t *)dst), "1"(*(uint8_t *)src) \ - ); \ - } + asm volatile ( \ + #iname"b %1, %0; " \ + : "=q"(*(uint8_t *)dst), "=q"(*(uint8_t *)src) \ + : "0"(*(uint8_t *)dst), "1"(*(uint8_t *)src) \ + ); \ + }