qemu/tests/tcg/s390x/csst.c
<<
>>
Prefs
   1#include <stdint.h>
   2#include <unistd.h>
   3
   4int main(void)
   5{
   6    uint64_t parmlist[] = {
   7        0xfedcba9876543210ull,
   8        0,
   9        0x7777777777777777ull,
  10        0,
  11    };
  12    uint64_t op1 = 0x0123456789abcdefull;
  13    uint64_t op2 = 0;
  14    uint64_t op3 = op1;
  15    uint64_t cc;
  16
  17    asm volatile(
  18        "    lghi %%r0,%[flags]\n"
  19        "    la %%r1,%[parmlist]\n"
  20        "    csst %[op1],%[op2],%[op3]\n"
  21        "    ipm %[cc]\n"
  22        : [op1] "+m" (op1),
  23          [op2] "+m" (op2),
  24          [op3] "+r" (op3),
  25          [cc] "=r" (cc)
  26        : [flags] "K" (0x0301),
  27          [parmlist] "m" (parmlist)
  28        : "r0", "r1", "cc", "memory");
  29    cc = (cc >> 28) & 3;
  30    if (cc) {
  31        write(1, "bad cc\n", 7);
  32        return 1;
  33    }
  34    if (op1 != parmlist[0]) {
  35        write(1, "bad op1\n", 8);
  36        return 1;
  37    }
  38    if (op2 != parmlist[2]) {
  39        write(1, "bad op2\n", 8);
  40        return 1;
  41    }
  42    return 0;
  43}
  44