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_lf_add.c (563B)


      1#include <stdio.h>
      2
      3int main(void)
      4{
      5    float a, b;
      6    float res2;
      7
      8    a = 1.5;
      9    b = 2.5;
     10    res2 = 4.0;
     11    __asm
     12    ("lf.add.s  %0, %0, %1\n\t"
     13     : "+r"(a)
     14     : "r"(b)
     15    );
     16    if (a != res2) {
     17        printf("lf.add.s error, %f\n", a);
     18        return -1;
     19    }
     20
     21/*    double c, d;
     22    double res1;
     23
     24    c = 1.5;
     25    d = 1.5;
     26    res1 = 3.00;
     27    __asm
     28    ("lf.add.d  %0, %1, %2\n\t"
     29     : "+r"(c)
     30     : "r"(d)
     31    );
     32
     33    if ((e - res1) > 0.002) {
     34        printf("lf.add.d error, %f\n", e - res1);
     35        return -1;
     36    }*/
     37
     38    return 0;
     39}