Permalink
Browse files

add Darwin support also (not run, just compile tested so far)

  • Loading branch information...
1 parent df1f30c commit 2d45f6f9918d159cac0656de945254326d7ba445 @avsm committed Dec 3, 2011
Showing with 16 additions and 3 deletions.
  1. +8 −1 Makefile
  2. +8 −2 test.c
View
@@ -6,10 +6,16 @@ endif
ifeq ($(uname),OpenBSD)
all_target := openbsd
endif
+ifeq ($(uname),Darwin)
+all_target := darwin
+endif
+
.PHONY: all clean run
-CFLAGS := -g -Wall -O3 -D_GNU_SOURCE -DNDEBUG -std=gnu99
+CFLAGS_Linux = -DUSE_INLINE_ASM
+CFLAGS_OpenBSD = -DUSE_INLINE_ASM
+CFLAGS += -g -Wall -O3 -D_GNU_SOURCE -DNDEBUG -std=gnu99 $(CFLAGS_$(uname))
LDFLAGS_Linux := -lrt -lnuma
LDFLAGS += -lm $(LDFLAGS_$(uname))
@@ -23,6 +29,7 @@ TARGETS_Linux += shmem_pipe_thr futex_lat
TARGETS_POSIX += summarise_tsc_counters
TARGETS_OpenBSD :=
+TARGETS_Darwin :=
TARGETS := $(TARGETS_POSIX) $(TARGETS_$(uname))
View
@@ -71,6 +71,7 @@ wait_for_children_to_finish(void)
}
static void stosmemset(void* buf, int byte, size_t count) {
+#ifdef USE_INLINE_ASM
int clobber;
assert(count % 8 == 0);
asm volatile ("rep stosq\n"
@@ -79,10 +80,13 @@ static void stosmemset(void* buf, int byte, size_t count) {
"D" (buf),
"0" (count / 8)
: "memory");
+#else
+ errx(1, "stosmemset: not implemented");
+#endif
}
static int repmemcmp(void* buf, int byte, size_t count) {
-
+#ifdef USE_INLINE_ASM
unsigned long clobber;
void* clobber2;
char result;
@@ -97,7 +101,9 @@ static int repmemcmp(void* buf, int byte, size_t count) {
"D" (buf)
);
return result;
-
+#else
+ errx(1, "repmemcmp: not implemented");
+#endif
}
void parent_main(test_t* test, test_data* td, int is_latency_test) {

0 comments on commit 2d45f6f

Please sign in to comment.