CCTLib
Calling-context and data-object attribution library for Intel Pin
deadspy_partial_qword_then_byte_high_tp.c
Go to the documentation of this file.
1 // Deadspy ISA edge case: byte-at-HIGH-offset partial overlap.
2 // Companion to deadspy_partial_qword_then_byte_tp.c which tests offset 0.
3 // Here the byte store hits offset 7 of the qword. The high byte of the
4 // qword is dead; bytes 0..6 remain live. Verifies deadspy's per-byte
5 // tracking symmetrically at both ends of a word.
6 #include <stdint.h>
7 #define WORK_COUNT 20000
8 static volatile uint64_t sink;
9 static uint64_t buf[WORK_COUNT];
10 int main(int argc, char** argv) {
11  (void)argc; (void)argv;
12  for (int i = 0; i < WORK_COUNT; ++i) {
13  uint64_t qval = 0xDEADBEEFULL;
14  uint8_t bval = 0x5A;
15  __asm__ __volatile__(
16  "movq %1, (%0)\n\t" // 8B write at &buf[i]
17  "movb %2, 7(%0)\n\t" // 1B write at byte offset 7 -- kills byte 7
18  :
19  : "r"(&buf[i]), "r"(qval), "r"(bval)
20  : "memory");
21  }
22  sink = buf[0];
23  return 0;
24 }
int main(int argc, char **argv)
static uint64_t buf[WORK_COUNT]
static volatile uint64_t sink