/** This function looks up the entry in the shadow table corresponding to a
* given address.*/
-static uint64_t * lookupAddressEntry(void * address) {
+static uint64_t * lookupAddressEntry(const void * address) {
struct ShadowTable *currtable=root;
#if BIT48
currtable=(struct ShadowTable *) currtable->array[(((uintptr_t)address)>>32)&MASK16BIT];
}
/** This function is called when we detect a data race.*/
-static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool isoldwrite, ModelAction *newaction, bool isnewwrite, void *address) {
+static void reportDataRace(thread_id_t oldthread, modelclock_t oldclock, bool isoldwrite, ModelAction *newaction, bool isnewwrite, const void *address) {
struct DataRace *race = (struct DataRace *)snapshot_malloc(sizeof(struct DataRace));
race->oldthread=oldthread;
race->oldclock=oldclock;
}
/** This function does race detection on a read for an expanded record. */
-void fullRaceCheckRead(thread_id_t thread, void *location, uint64_t * shadow, ClockVector *currClock) {
+void fullRaceCheckRead(thread_id_t thread, const void *location, uint64_t * shadow, ClockVector *currClock) {
struct RaceRecord * record=(struct RaceRecord *) (*shadow);
/* Check for datarace against last write. */
}
/** This function does race detection on a read. */
-void raceCheckRead(thread_id_t thread, void *location, ClockVector *currClock) {
+void raceCheckRead(thread_id_t thread, const void *location, ClockVector *currClock) {
uint64_t * shadow=lookupAddressEntry(location);
uint64_t shadowval=*shadow;
(*(uint64_t *)addr) = val;
}
-uint8_t load_8(void *addr)
+uint8_t load_8(const void *addr)
{
DEBUG("addr = %p\n", addr);
thread_id_t tid=thread_current()->get_id();
return *((uint8_t *)addr);
}
-uint16_t load_16(void *addr)
+uint16_t load_16(const void *addr)
{
DEBUG("addr = %p\n", addr);
thread_id_t tid=thread_current()->get_id();
ClockVector * cv=model->get_cv(tid);
raceCheckRead(tid, addr, cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+1), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+1), cv);
return *((uint16_t *)addr);
}
-uint32_t load_32(void *addr)
+uint32_t load_32(const void *addr)
{
DEBUG("addr = %p\n", addr);
thread_id_t tid=thread_current()->get_id();
ClockVector * cv=model->get_cv(tid);
raceCheckRead(tid, addr, cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+1), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+2), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+3), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+1), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+2), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+3), cv);
return *((uint32_t *)addr);
}
-uint64_t load_64(void *addr)
+uint64_t load_64(const void *addr)
{
DEBUG("addr = %p\n", addr);
thread_id_t tid=thread_current()->get_id();
ClockVector * cv=model->get_cv(tid);
raceCheckRead(tid, addr, cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+1), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+2), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+3), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+4), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+5), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+6), cv);
- raceCheckRead(tid, (void *)(((uintptr_t)addr)+7), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+1), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+2), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+3), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+4), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+5), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+6), cv);
+ raceCheckRead(tid, (const void *)(((uintptr_t)addr)+7), cv);
return *((uint64_t *)addr);
}