summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-03 21:33:39 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-03 21:33:39 +0000
commite746a88b22c99f4ffe808fe2e9fb8816121cd608 (patch)
tree4305f0a400a0aed7e7792f43046c7011cf67f106 /cpukit/score/src
parent2007-05-03 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-e746a88b22c99f4ffe808fe2e9fb8816121cd608.tar.bz2
2007-05-03 Joel Sherrill <joel@OARcorp.com>
* ChangeLog, libcsupport/src/malloc.c, libcsupport/src/mallocfreespace.c, sapi/include/confdefs.h, score/Makefile.am, score/preinstall.am: malloc never blocks so the Region Manager is quite heavy for implementing this. This patch implements the C Program Heap directly in terms of the new Protected Heap handler. This handler is a direct use of a SuperCore Heap in conjunction with the Allocator Mutex used internally by RTEMS. This saves 3184 bytes on most SPARC test executables. * score/include/rtems/score/protectedheap.h, score/src/pheapallocate.c, score/src/pheapallocatealigned.c, score/src/pheapextend.c, score/src/pheapfree.c, score/src/pheapgetblocksize.c, score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c, score/src/pheapinit.c, score/src/pheapresizeblock.c, score/src/pheapwalk.c: New files.
Diffstat (limited to '')
-rw-r--r--cpukit/score/src/pheapallocate.c31
-rw-r--r--cpukit/score/src/pheapallocatealigned.c31
-rw-r--r--cpukit/score/src/pheapextend.c33
-rw-r--r--cpukit/score/src/pheapfree.c30
-rw-r--r--cpukit/score/src/pheapgetblocksize.c32
-rw-r--r--cpukit/score/src/pheapgetfreeinfo.c28
-rw-r--r--cpukit/score/src/pheapgetinfo.c29
-rw-r--r--cpukit/score/src/pheapinit.c19
-rw-r--r--cpukit/score/src/pheapresizeblock.c35
-rw-r--r--cpukit/score/src/pheapwalk.c31
10 files changed, 299 insertions, 0 deletions
diff --git a/cpukit/score/src/pheapallocate.c b/cpukit/score/src/pheapallocate.c
new file mode 100644
index 0000000000..a0841bc653
--- /dev/null
+++ b/cpukit/score/src/pheapallocate.c
@@ -0,0 +1,31 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+void *_Protected_heap_Allocate(
+ Heap_Control *the_heap,
+ size_t size
+)
+{
+ void *p;
+
+ _RTEMS_Lock_allocator();
+ p = _Heap_Allocate( the_heap, size );
+ _RTEMS_Unlock_allocator();
+ return p;
+}
+
diff --git a/cpukit/score/src/pheapallocatealigned.c b/cpukit/score/src/pheapallocatealigned.c
new file mode 100644
index 0000000000..897236f370
--- /dev/null
+++ b/cpukit/score/src/pheapallocatealigned.c
@@ -0,0 +1,31 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+boolean _Protected_heap_Get_block_size(
+ Heap_Control *the_heap,
+ void *starting_address,
+ size_t *size
+)
+{
+ boolean status;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Size_of_user_area( the_heap, starting_address, size );
+ _RTEMS_Unlock_allocator();
+ return status;
+}
diff --git a/cpukit/score/src/pheapextend.c b/cpukit/score/src/pheapextend.c
new file mode 100644
index 0000000000..1d1943747f
--- /dev/null
+++ b/cpukit/score/src/pheapextend.c
@@ -0,0 +1,33 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+boolean _Protected_heap_Extend(
+ Heap_Control *the_heap,
+ void *starting_address,
+ size_t size
+)
+{
+ Heap_Extend_status status;
+ uint32_t amount_extended;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Extend(the_heap, starting_address, size, &amount_extended);
+ _RTEMS_Unlock_allocator();
+ return (status == HEAP_EXTEND_SUCCESSFUL);
+}
+
diff --git a/cpukit/score/src/pheapfree.c b/cpukit/score/src/pheapfree.c
new file mode 100644
index 0000000000..0d5737aac6
--- /dev/null
+++ b/cpukit/score/src/pheapfree.c
@@ -0,0 +1,30 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+boolean _Protected_heap_Free(
+ Heap_Control *the_heap,
+ void *start_address
+)
+{
+ boolean status;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Free( the_heap, start_address );
+ _RTEMS_Unlock_allocator();
+ return status;
+}
diff --git a/cpukit/score/src/pheapgetblocksize.c b/cpukit/score/src/pheapgetblocksize.c
new file mode 100644
index 0000000000..1e1706063b
--- /dev/null
+++ b/cpukit/score/src/pheapgetblocksize.c
@@ -0,0 +1,32 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+void *_Protected_heap_Allocate_aligned(
+ Heap_Control *the_heap,
+ size_t size,
+ uint32_t alignment
+)
+{
+ void *p;
+
+ _RTEMS_Lock_allocator();
+ p = _Heap_Allocate_aligned( the_heap, size, alignment );
+ _RTEMS_Unlock_allocator();
+ return p;
+}
+
diff --git a/cpukit/score/src/pheapgetfreeinfo.c b/cpukit/score/src/pheapgetfreeinfo.c
new file mode 100644
index 0000000000..bba8a90b18
--- /dev/null
+++ b/cpukit/score/src/pheapgetfreeinfo.c
@@ -0,0 +1,28 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+void _Protected_heap_Get_free_information(
+ Heap_Control *the_heap,
+ Heap_Information *info
+)
+{
+ _RTEMS_Lock_allocator();
+ _Heap_Get_free_information( the_heap, info );
+ _RTEMS_Unlock_allocator();
+}
+
diff --git a/cpukit/score/src/pheapgetinfo.c b/cpukit/score/src/pheapgetinfo.c
new file mode 100644
index 0000000000..26e15d1d5c
--- /dev/null
+++ b/cpukit/score/src/pheapgetinfo.c
@@ -0,0 +1,29 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+void _Protected_heap_Get_information(
+ Heap_Control *the_heap,
+ Heap_Information_block *the_info
+)
+{
+ Heap_Get_information_status status;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Get_information( the_heap, the_info );
+ _RTEMS_Unlock_allocator();
+}
diff --git a/cpukit/score/src/pheapinit.c b/cpukit/score/src/pheapinit.c
new file mode 100644
index 0000000000..1d99fcd5f2
--- /dev/null
+++ b/cpukit/score/src/pheapinit.c
@@ -0,0 +1,19 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+
diff --git a/cpukit/score/src/pheapresizeblock.c b/cpukit/score/src/pheapresizeblock.c
new file mode 100644
index 0000000000..5f9946cb0f
--- /dev/null
+++ b/cpukit/score/src/pheapresizeblock.c
@@ -0,0 +1,35 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+boolean _Protected_heap_Resize_block(
+ Heap_Control *the_heap,
+ void *starting_address,
+ size_t size
+)
+{
+ Heap_Resize_status status;
+ uint32_t old_mem_size;
+ uint32_t avail_mem_size;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Resize_block(
+ the_heap, starting_address, size, &old_mem_size, &avail_mem_size );
+ _RTEMS_Unlock_allocator();
+ return (status == HEAP_RESIZE_SUCCESSFUL);
+}
+
diff --git a/cpukit/score/src/pheapwalk.c b/cpukit/score/src/pheapwalk.c
new file mode 100644
index 0000000000..963be088c3
--- /dev/null
+++ b/cpukit/score/src/pheapwalk.c
@@ -0,0 +1,31 @@
+/**
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/protectedheap.h>
+
+boolean _Protected_heap_Walk(
+ Heap_Control *the_heap,
+ int source,
+ boolean do_dump
+)
+{
+ boolean status;
+
+ _RTEMS_Lock_allocator();
+ status = _Heap_Walk( the_heap, source, do_dump );
+ _RTEMS_Unlock_allocator();
+ return status;
+}