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_addi.c (480B)


      1#include <stdio.h>
      2
      3int main(void)
      4{
      5    int a, b;
      6    int result;
      7
      8    b = 0x01;
      9    result = 0x00;
     10    __asm
     11    ("l.addi  %0, %1, 0xffff\n\t"
     12     : "=r"(a)
     13     : "r"(b)
     14    );
     15    if (a != result) {
     16        printf("addi error\n\t");
     17        return -1;
     18    }
     19
     20    b = 0x010000;
     21    result = 0xffff;
     22    __asm
     23    ("l.addi  %0, %1, 0xffff\n\t"
     24     : "=r"(a)
     25     : "r"(b)
     26    );
     27    if (a != result) {
     28        printf("addi error\n");
     29        return -1;
     30    }
     31
     32    return 0;
     33}