| Index: platforms/stm/disco_dartino/src/cmpctmalloc.c
|
| diff --git a/platforms/stm/disco_fletch/src/cmpctmalloc.c b/platforms/stm/disco_dartino/src/cmpctmalloc.c
|
| similarity index 97%
|
| rename from platforms/stm/disco_fletch/src/cmpctmalloc.c
|
| rename to platforms/stm/disco_dartino/src/cmpctmalloc.c
|
| index 7df68e487fce88ef6d4ef18a6a8abc0efcd6e1fd..77779094902d112a10eb9b62239afd242c27de04 100644
|
| --- a/platforms/stm/disco_fletch/src/cmpctmalloc.c
|
| +++ b/platforms/stm/disco_dartino/src/cmpctmalloc.c
|
| @@ -3,10 +3,10 @@
|
| // BSD-style license that can be found in the LICENSE.md file.
|
|
|
| // This code is ported from the LK repository. To keep the code in
|
| -// sync the define FLETCH_TARGET_OS_LK provides the code from the LK
|
| -// repository. Without the define FLETCH_TARGET_OS_LK this code will
|
| -// build and link for the disco_fletch project.
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +// sync the define DARTINO_TARGET_OS_LK provides the code from the LK
|
| +// repository. Without the define DARTINO_TARGET_OS_LK this code will
|
| +// build and link for the disco_dartino project.
|
| +#ifdef DARTINO_TARGET_OS_LK
|
|
|
| #include <debug.h>
|
| #include <trace.h>
|
| @@ -21,9 +21,9 @@
|
| #include <lib/heap.h>
|
| #include <lib/page_alloc.h>
|
|
|
| -#else // FLETCH_TARGET_OS_LK
|
| +#else // DARTINO_TARGET_OS_LK
|
|
|
| -#include "platforms/stm/disco_fletch/src/cmpctmalloc.h"
|
| +#include "platforms/stm/disco_dartino/src/cmpctmalloc.h"
|
|
|
| #include <inttypes.h>
|
| #include <stdbool.h>
|
| @@ -33,7 +33,7 @@
|
| #include <string.h>
|
| #include <unistd.h>
|
|
|
| -#include "platforms/stm/disco_fletch/src/globals.h"
|
| +#include "platforms/stm/disco_dartino/src/globals.h"
|
|
|
| void* page_alloc(size_t pages);
|
| void page_free(void* start, size_t pages);
|
| @@ -51,7 +51,7 @@ typedef uintptr_t vaddr_t;
|
| #define dprintf(...) fprintf(__VA_ARGS__)
|
| #define INFO stdout
|
|
|
| -#endif // FLETCH_TARGET_OS_LK
|
| +#endif // DARTINO_TARGET_OS_LK
|
|
|
| // Malloc implementation tuned for space.
|
| //
|
| @@ -63,7 +63,7 @@ typedef uintptr_t vaddr_t;
|
| #define CMPCT_DEBUG
|
| #endif
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| #define LOCAL_TRACE 0
|
| #endif
|
|
|
| @@ -71,7 +71,7 @@ typedef uintptr_t vaddr_t;
|
| #define FREE_FILL 0x77
|
| #define PADDING_FILL 0x55
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| #if WITH_KERNEL_VM && !defined(HEAP_GROW_SIZE)
|
| #define HEAP_GROW_SIZE (1 * 1024 * 1024) /* Grow aggressively */
|
| #elif !defined(HEAP_GROW_SIZE)
|
| @@ -115,7 +115,7 @@ typedef struct free_struct {
|
| struct heap {
|
| size_t size;
|
| size_t remaining;
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| mutex_t lock;
|
| #endif
|
| free_t *free_lists[NUMBER_OF_BUCKETS];
|
| @@ -132,14 +132,14 @@ static ssize_t heap_grow(size_t len, free_t **bucket);
|
|
|
| static void lock(void)
|
| {
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| mutex_acquire(&theheap.lock);
|
| #endif
|
| }
|
|
|
| static void unlock(void)
|
| {
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| mutex_release(&theheap.lock);
|
| #endif
|
| }
|
| @@ -390,7 +390,7 @@ static void TestTrimFreeHelper(char *block)
|
| }
|
| }
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| static void cmpct_test_trim(void)
|
| #else
|
| void cmpct_test_trim(void)
|
| @@ -493,7 +493,7 @@ void cmpct_test_trim(void)
|
| }
|
|
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| static void cmpct_test_buckets(void)
|
| #else
|
| void cmpct_test_buckets(void)
|
| @@ -575,7 +575,7 @@ static void cmpct_test_get_back_newly_freed_helper(size_t size)
|
| cmpct_free(allocated3);
|
| }
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| static void cmpct_test_get_back_newly_freed(void)
|
| #else
|
| void cmpct_test_get_back_newly_freed(void)
|
| @@ -594,7 +594,7 @@ void cmpct_test_get_back_newly_freed(void)
|
| }
|
| }
|
|
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| static void cmpct_test_return_to_os(void)
|
| #else
|
| void cmpct_test_return_to_os(void)
|
| @@ -882,7 +882,7 @@ void cmpct_init(void)
|
| LTRACE_ENTRY;
|
|
|
| // Create a mutex.
|
| -#ifdef FLETCH_TARGET_OS_LK
|
| +#ifdef DARTINO_TARGET_OS_LK
|
| mutex_init(&theheap.lock);
|
| #endif
|
|
|
|
|