Commit 953e3065 authored by Caleb C. Sander's avatar Caleb C. Sander
Browse files

Fix #2

parent b3903296
No related merge requests found
Showing with 67 additions and 56 deletions
+67 -56
bin/*
out/*
.debug
#
# Makefile for the malloc lab driver
#
CC = clang
CFLAGS = -Werror -Wall -Wextra -O3 -g
all: bin/mdriver-implicit bin/mdriver-explicit
CLEAN_COMMAND = rm -f out/* bin/*
ifdef DEBUG
CC = clang-with-asan
CFLAGS = -Werror -Wall -Wextra
ifeq ($(wildcard .debug),)
$(shell $(CLEAN_COMMAND))
$(shell touch .debug)
endif
else
CC = clang
CFLAGS = -Werror -Wall -Wextra -O3 -g
ifneq ($(wildcard .debug),)
$(shell $(CLEAN_COMMAND) .debug)
endif
endif
bin/mdriver-implicit: out/mdriver-implicit.o out/mm-implicit.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o out/ftimer.o
$(CC) $(CFLAGS) $^ -o $@
all: bin/mdriver-implicit bin/mdriver-explicit
bin/mdriver-explicit: out/mdriver-explicit.o out/mm-explicit.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o out/ftimer.o
bin/mdriver-%: out/mdriver-%.o out/mm-%.o out/memlib.o out/fsecs.o out/fcyc.o out/clock.o
$(CC) $(CFLAGS) $^ -o $@
out/mdriver-implicit.o: driver/mdriver.c
......@@ -25,4 +36,6 @@ out/%.o: driver/%.c
$(CC) $(CFLAGS) -c $^ -o $@
clean:
rm -f out/* bin/*
$(CLEAN_COMMAND)
.PRECIOUS: bin/mdriver-% out/mdriver-implicit.o out/mdriver-explicit.o out/%.o
......@@ -93,11 +93,9 @@ static int has_converged()
/*
* clear - Code to clear cache
*/
static volatile int sink = 0;
static void clear()
{
int x = sink;
int *cptr, *cend;
int incr = cache_block/sizeof(int);
if (!cache_buf) {
......@@ -110,10 +108,9 @@ static void clear()
cptr = (int *) cache_buf;
cend = cptr + cache_bytes/sizeof(int);
while (cptr < cend) {
x += *cptr;
*(volatile int *) cptr;
cptr += incr;
}
sink = x;
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment