cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

mvo.c (585B)


      1#include <stdint.h>
      2#include <stdio.h>
      3
      4int main(void)
      5{
      6    uint8_t dest[6] = {0xff, 0x77, 0x88, 0x99, 0x0c, 0xff};
      7    uint8_t src[5] = {0xee, 0x12, 0x34, 0x56, 0xee};
      8    uint8_t expected[6] = {0xff, 0x01, 0x23, 0x45, 0x6c, 0xff};
      9    int i;
     10
     11    asm volatile (
     12        "    mvo 0(4,%[dest]),0(3,%[src])\n"
     13        :
     14        : [dest] "d" (dest + 1),
     15          [src] "d" (src + 1)
     16        : "memory");
     17
     18    for (i = 0; i < sizeof(expected); i++) {
     19        if (dest[i] != expected[i]) {
     20            fprintf(stderr, "bad data\n");
     21            return 1;
     22        }
     23    }
     24    return 0;
     25}