summaryrefslogtreecommitdiffstats
path: root/cpukit/include
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-02-18 11:46:22 +1100
committerChris Johns <chrisj@rtems.org>2019-02-20 09:08:14 +1100
commit22afb03411133bcf928aeb85233648a94f259b44 (patch)
treee03f9e303646d3efbbce250db37d9566d50ec1c6 /cpukit/include
parentbsps/arm: Move device tree copy (diff)
downloadrtems-22afb03411133bcf928aeb85233648a94f259b44.tar.bz2
libdl/alloc: Add a locking interface to the allocator.
- Allow an allocator to lock the allocations. This is needed to lock the heap allocator so the text and trampoline table are as close together as possible to allow for the largest possible object file size. - Update the default heap allocator to lock the heap allocator. - Update ELF loading to lock the allocator. Updates #3685
Diffstat (limited to 'cpukit/include')
-rw-r--r--cpukit/include/rtems/rtl/rtl-allocator.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/cpukit/include/rtems/rtl/rtl-allocator.h b/cpukit/include/rtems/rtl/rtl-allocator.h
index 1a5d615582..da221fef68 100644
--- a/cpukit/include/rtems/rtl/rtl-allocator.h
+++ b/cpukit/include/rtems/rtl/rtl-allocator.h
@@ -50,6 +50,8 @@ typedef enum rtems_rtl_alloc_tags rtems_rtl_alloc_tag;
enum rtems_rtl_alloc_cmd {
RTEMS_RTL_ALLOC_NEW, /**< Allocate new memory. */
RTEMS_RTL_ALLOC_DEL, /**< Delete allocated memory. */
+ RTEMS_RTL_ALLOC_LOCK, /**< Lock the allocator. */
+ RTEMS_RTL_ALLOC_UNLOCK, /**< Unlock the allocator. */
RTEMS_RTL_ALLOC_WR_ENABLE, /**< Enable writes to the memory. */
RTEMS_RTL_ALLOC_WR_DISABLE, /**< Disable writes to the memory. */
};
@@ -122,6 +124,24 @@ void* rtems_rtl_alloc_new (rtems_rtl_alloc_tag tag, size_t size, bool zero);
void rtems_rtl_alloc_del (rtems_rtl_alloc_tag tag, void* address);
/**
+ * The Runtime Loader allocator lock. An allocator that depends on a
+ * separate allocation process, for example the heap, may need to be
+ * locked during loading of an object file to make sure the locality
+ * of the memory. This call be used to lock such an allocator.
+ * Allocator calls in this interface are protected by the RTL lock.
+ */
+void rtems_rtl_alloc_lock (void);
+
+/**
+ * The Runtime Loader allocator unlock. An allocator that depends on a
+ * separate allocation process, for example the heap, may need to be
+ * locked during loading of an object file to make sure the locality
+ * of the memory. This call can be used to unlock such an allocator.
+ * Allocator calls in this interface are protected by the RTL lock.
+ */
+void rtems_rtl_alloc_unlock (void);
+
+/**
* The Runtime Loader allocator enable write on a bloc of allocated memory.
*
* @param tag The type of allocation request. Must match the address.