Files
rtems/cpukit/libdl/rtl-alloc-heap.c
Chris Johns 22afb03411 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
2019-02-20 09:08:14 +11:00

47 lines
988 B
C

/*
* COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
/**
* @file
*
* @ingroup rtems_rtl
*
* @brief RTEMS Run-Time Linker Allocator for the standard heap.
*/
#include <stdlib.h>
#include "rtl-alloc-heap.h"
#include <rtems/score/apimutex.h>
void
rtems_rtl_alloc_heap (rtems_rtl_alloc_cmd cmd,
rtems_rtl_alloc_tag tag,
void** address,
size_t size)
{
switch (cmd)
{
case RTEMS_RTL_ALLOC_NEW:
*address = malloc (size);
break;
case RTEMS_RTL_ALLOC_DEL:
free (*address);
*address = NULL;
break;
case RTEMS_RTL_ALLOC_LOCK:
_RTEMS_Lock_allocator();
break;
case RTEMS_RTL_ALLOC_UNLOCK:
_RTEMS_Unlock_allocator();
break;
default:
break;
}
}