From: Brian Norris Date: Wed, 25 Apr 2012 23:55:46 +0000 (-0700) Subject: librace: add load/store interface for checking data races X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=7af1e278a823b97b391f37da9ef6a013d58ac50e librace: add load/store interface for checking data races The compiler portion will need to replace loads/stores with calls to the store_X() and load_X() functions. --- diff --git a/Makefile b/Makefile index 52120a5f..1f91c5dd 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,9 @@ LIB_SO=lib$(LIB_NAME).so USER_O=userprog.o USER_H=libthreads.h libatomic.h -MODEL_CC=libthreads.cc schedule.cc libatomic.cc model.cc malloc.c threads.cc tree.cc -MODEL_O=libthreads.o schedule.o libatomic.o model.o malloc.o threads.o tree.o -MODEL_H=libthreads.h schedule.h common.h libatomic.h model.h threads.h tree.h +MODEL_CC=libthreads.cc schedule.cc libatomic.cc model.cc malloc.c threads.cc tree.cc librace.cc +MODEL_O=libthreads.o schedule.o libatomic.o model.o malloc.o threads.o tree.o librace.o +MODEL_H=libthreads.h schedule.h common.h libatomic.h model.h threads.h tree.h librace.h CPPFLAGS=-Wall -g LDFLAGS=-ldl diff --git a/librace.cc b/librace.cc new file mode 100644 index 00000000..1219bf32 --- /dev/null +++ b/librace.cc @@ -0,0 +1,46 @@ +#include "librace.h" +#include "common.h" + +void store_8(void *addr, uint8_t val) +{ + DEBUG("addr = %p, val = %u\n", addr, val); +} + +void store_16(void *addr, uint16_t val) +{ + DEBUG("addr = %p, val = %u\n", addr, val); +} + +void store_32(void *addr, uint32_t val) +{ + DEBUG("addr = %p, val = %u\n", addr, val); +} + +void store_64(void *addr, uint64_t val) +{ + DEBUG("addr = %p, val = %llu\n", addr, val); +} + +uint8_t load_8(void *addr) +{ + DEBUG("addr = %p\n", addr); + return 0; +} + +uint16_t load_16(void *addr) +{ + DEBUG("addr = %p\n", addr); + return 0; +} + +uint32_t load_32(void *addr) +{ + DEBUG("addr = %p\n", addr); + return 0; +} + +uint64_t load_64(void *addr) +{ + DEBUG("addr = %p\n", addr); + return 0; +} diff --git a/librace.h b/librace.h new file mode 100644 index 00000000..a8af6864 --- /dev/null +++ b/librace.h @@ -0,0 +1,24 @@ +#ifndef __LIBRACE_H__ +#define __LIBRACE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + void store_8(void *addr, uint8_t val); + void store_16(void *addr, uint16_t val); + void store_32(void *addr, uint32_t val); + void store_64(void *addr, uint64_t val); + + uint8_t load_8(void *addr); + uint16_t load_16(void *addr); + uint32_t load_32(void *addr); + uint64_t load_64(void *addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __LIBRACE_H__ */