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_msub.c (612B)


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