diff options
author | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
---|---|---|
committer | Joshua Bakita <bakitajoshua@gmail.com> | 2019-10-07 19:13:39 -0400 |
commit | 386b7d3366f1359a265da207a9cafa3edf553b64 (patch) | |
tree | c76120c2c138faed822e4ae386be6ef22a738a78 /baseline/source/susan/wccmalloc.c | |
parent | 54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff) |
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'baseline/source/susan/wccmalloc.c')
-rw-r--r-- | baseline/source/susan/wccmalloc.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/baseline/source/susan/wccmalloc.c b/baseline/source/susan/wccmalloc.c new file mode 100644 index 0000000..edf01cc --- /dev/null +++ b/baseline/source/susan/wccmalloc.c | |||
@@ -0,0 +1,51 @@ | |||
1 | #include "wccmalloc.h" | ||
2 | |||
3 | // This must be redefined for each new benchmark | ||
4 | #define HEAP_SIZE 30000 | ||
5 | |||
6 | char susan_simulated_heap[HEAP_SIZE]; | ||
7 | unsigned int susan_freeHeapPos; | ||
8 | |||
9 | void* susan_wccmalloc( unsigned int numberOfBytes ) | ||
10 | { | ||
11 | // Get a 4-byte adress for alignment purposes | ||
12 | unsigned int offset = ( (unsigned long)susan_simulated_heap + susan_freeHeapPos ) % 4; | ||
13 | if ( offset ) { | ||
14 | susan_freeHeapPos += 4 - offset; | ||
15 | } | ||
16 | void* currentPos = (void*)&susan_simulated_heap[susan_freeHeapPos]; | ||
17 | susan_freeHeapPos += numberOfBytes; | ||
18 | return currentPos; | ||
19 | } | ||
20 | void susan_wccfreeall( void ) | ||
21 | { | ||
22 | susan_freeHeapPos = 0; | ||
23 | } | ||
24 | |||
25 | void* susan_wccmemcpy(void* dstpp, const void* srcpp, unsigned int len) | ||
26 | { | ||
27 | unsigned long int dstp = (long int) dstpp; | ||
28 | unsigned long int srcp = (long int) srcpp; | ||
29 | |||
30 | _Pragma("loopbound min 76 max 76") | ||
31 | while (len > 0) { | ||
32 | char __x = ((char *) srcp)[0]; | ||
33 | srcp += 1; | ||
34 | len -= 1; | ||
35 | ((char *) dstp)[0] = __x; | ||
36 | dstp += 1; | ||
37 | } | ||
38 | |||
39 | return dstpp; | ||
40 | } | ||
41 | |||
42 | void susan_wccmemset( void *p, int value, unsigned int num ) | ||
43 | { | ||
44 | unsigned long i; | ||
45 | char *char_ptr = (char*)p; | ||
46 | |||
47 | _Pragma( "loopbound min 7220 max 28880" ) | ||
48 | for ( i = 0; i < num; ++i ) { | ||
49 | *char_ptr++ = (unsigned char)value; | ||
50 | } | ||
51 | } | ||