-
Notifications
You must be signed in to change notification settings - Fork 0
/
librace.cc
84 lines (74 loc) · 1.75 KB
/
librace.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "librace.h"
#include "common.h"
#include "datarace.h"
#include "model.h"
#include "threads-model.h"
#include "snapshot-interface.h"
/**
* Helper functions used by CDSPass
* The CDSPass implementation does not replace normal load/stores with cds load/stores,
* but inserts cds load/stores to check dataraces. Thus, the cds load/stores do not
* return anything.
*/
void cds_store8(void *addr)
{
//DEBUG("addr = %p, val = %" PRIu8 "\n", addr, val);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckWrite8(tid, addr);
}
void cds_store16(void *addr)
{
//DEBUG("addr = %p, val = %" PRIu16 "\n", addr, val);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckWrite16(tid, addr);
}
void cds_store32(void *addr)
{
//DEBUG("addr = %p, val = %" PRIu32 "\n", addr, val);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckWrite32(tid, addr);
}
void cds_store64(void *addr)
{
//DEBUG("addr = %p, val = %" PRIu64 "\n", addr, val);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckWrite64(tid, addr);
}
void cds_load8(const void *addr) {
DEBUG("addr = %p\n", addr);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckRead8(tid, addr);
}
void cds_load16(const void *addr) {
DEBUG("addr = %p\n", addr);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckRead16(tid, addr);
}
void cds_load32(const void *addr) {
DEBUG("addr = %p\n", addr);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckRead32(tid, addr);
}
void cds_load64(const void *addr) {
DEBUG("addr = %p\n", addr);
if (!model)
return;
thread_id_t tid = thread_current_id();
raceCheckRead64(tid, addr);
}