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

ipm.c (457B)


      1#include <stdint.h>
      2#include <unistd.h>
      3
      4int main(void)
      5{
      6    uint32_t op1 = 0x55555555;
      7    uint32_t op2 = 0x44444444;
      8    uint64_t cc = 0xffffffffffffffffull;
      9
     10    asm volatile(
     11        "    clc 0(4,%[op1]),0(%[op2])\n"
     12        "    ipm %[cc]\n"
     13        : [cc] "+r" (cc)
     14        : [op1] "r" (&op1),
     15          [op2] "r" (&op2)
     16        : "cc");
     17    if (cc != 0xffffffff20ffffffull) {
     18        write(1, "bad cc\n", 7);
     19        return 1;
     20    }
     21    return 0;
     22}