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_dsp_r1_maddu.c (574B)


      1#include<stdio.h>
      2#include<assert.h>
      3
      4int main()
      5{
      6    int rt, rs;
      7    int achi, acli;
      8    int acho, aclo;
      9    int resulth, resultl;
     10
     11    achi = 0x05;
     12    acli = 0xB4CB;
     13    rs  = 0x01;
     14    rt  = 0x01;
     15    resulth = 0x05;
     16    resultl = 0xB4CC;
     17
     18    __asm
     19        ("mthi %2, $ac1\n\t"
     20         "mtlo %3, $ac1\n\t"
     21         "madd $ac1, %4, %5\n\t"
     22         "mfhi %0, $ac1\n\t"
     23         "mflo %1, $ac1\n\t"
     24         : "=r"(acho), "=r"(aclo)
     25         : "r"(achi), "r"(acli), "r"(rs), "r"(rt)
     26        );
     27    assert(resulth == acho);
     28    assert(resultl == aclo);
     29
     30    return 0;
     31}