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

test_fx.c (804B)


      1#include <stdio.h>
      2
      3int main(void)
      4{
      5    int a, b;
      6    int result;
      7
      8    b = 0x123;
      9    result = 1;
     10    __asm
     11    ("l.ff1 %0, %1\n\t"
     12     : "=r"(a)
     13     : "r"(b)
     14    );
     15    if (a != result) {
     16        printf("ff1 error\n");
     17        return -1;
     18    }
     19
     20    b = 0x0;
     21    result = 0;
     22    __asm
     23    ("l.ff1 %0, %1\n\t"
     24     : "=r"(a)
     25     : "r"(b)
     26    );
     27    if (a != result) {
     28        printf("ff1 error\n");
     29        return -1;
     30    }
     31
     32    b = 0x123;
     33    result = 9;
     34    __asm
     35    ("l.fl1 %0, %1\n\t"
     36     : "=r"(a)
     37     : "r"(b)
     38    );
     39    if (a != result) {
     40        printf("fl1 error\n");
     41        return -1;
     42    }
     43
     44    b = 0x0;
     45    result = 0;
     46    __asm
     47    ("l.fl1 %0, %1\n\t"
     48     : "=r"(a)
     49     : "r"(b)
     50    );
     51    if (a != result) {
     52        printf("fl1 error\n");
     53        return -1;
     54    }
     55
     56    return 0;
     57}