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_insv.c (629B)


      1#include<stdio.h>
      2#include<assert.h>
      3
      4int main()
      5{
      6    int rt, rs, dsp;
      7    int result;
      8
      9    /* msb = 10, lsb = 5 */
     10    dsp    = 0x305;
     11    rt     = 0x12345678;
     12    rs     = 0x87654321;
     13    result = 0x12345438;
     14    __asm
     15        ("wrdsp %2, 0x03\n\t"
     16         "insv  %0, %1\n\t"
     17         : "+r"(rt)
     18         : "r"(rs), "r"(dsp)
     19        );
     20    assert(rt == result);
     21
     22    dsp    = 0x1000;
     23    rt     = 0xF0F0F0F0;
     24    rs     = 0xA5A5A5A5;
     25    result = 0xA5A5A5A5;
     26
     27    __asm
     28        ("wrdsp %2\n\t"
     29         "insv  %0, %1\n\t"
     30         : "+r"(rt)
     31         : "r"(rs), "r"(dsp)
     32        );
     33    assert(rt == result);
     34
     35    return 0;
     36}