summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-07 19:39:25 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-07 19:39:25 +0000
commit5ae327bcf7998573c437fafbc0c298c252c7eec1 (patch)
tree553bbfadcf4d4ac41e893ff29c2716a45f3cc591 /cpukit
parent2007-09-07 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-5ae327bcf7998573c437fafbc0c298c252c7eec1.tar.bz2
2007-09-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/src/heap.c: Style. * score/src/heapwalk.c: Add more information to prints. * score/src/pheapwalk.c: Do not lock allocator mutex if dispatching is disabled.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog7
-rw-r--r--cpukit/score/src/heap.c12
-rw-r--r--cpukit/score/src/heapwalk.c8
-rw-r--r--cpukit/score/src/pheapwalk.c15
4 files changed, 31 insertions, 11 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index f67ffece3c..bf9ae7ad19 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-07 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * score/src/heap.c: Style.
+ * score/src/heapwalk.c: Add more information to prints.
+ * score/src/pheapwalk.c: Do not lock allocator mutex if dispatching
+ is disabled.
+
2007-09-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/Makefile.am, libcsupport/src/printk.c:
diff --git a/cpukit/score/src/heap.c b/cpukit/score/src/heap.c
index ccfb405fb7..5273678d1a 100644
--- a/cpukit/score/src/heap.c
+++ b/cpukit/score/src/heap.c
@@ -117,14 +117,14 @@ uint32_t _Heap_Initialize(
uint32_t page_size
)
{
- Heap_Block *the_block;
- uint32_t the_size;
- _H_uptr_t start;
- _H_uptr_t aligned_start;
- uint32_t overhead;
+ Heap_Block *the_block;
+ uint32_t the_size;
+ _H_uptr_t start;
+ _H_uptr_t aligned_start;
+ uint32_t overhead;
Heap_Statistics *const stats = &the_heap->stats;
- if(page_size == 0)
+ if (page_size == 0)
page_size = CPU_ALIGNMENT;
else
_Heap_Align_up( &page_size, CPU_ALIGNMENT );
diff --git a/cpukit/score/src/heapwalk.c b/cpukit/score/src/heapwalk.c
index db8555cd87..0167bbba53 100644
--- a/cpukit/score/src/heapwalk.c
+++ b/cpukit/score/src/heapwalk.c
@@ -99,7 +99,7 @@ boolean _Heap_Walk(
error = 1;
}
- while ( the_block < end ) {
+ while ( the_block != end ) {
uint32_t const the_size = _Heap_Block_size(the_block);
Heap_Block *const next_block = _Heap_Block_at(the_block, the_size);
boolean prev_used = _Heap_Is_prev_used(the_block);
@@ -165,12 +165,14 @@ boolean _Heap_Walk(
}
if (the_block != end) {
- printk("PASS: %d !last block address isn't equal to 'final'\n", source);
+ printk("PASS: %d !last block address isn't equal to 'final' %p %p\n",
+ source, the_block, end);
error = 1;
}
if (_Heap_Block_size(the_block) != the_heap->page_size) {
- printk("PASS: %d !last block's size isn't page_size\n", source);
+ printk("PASS: %d !last block's size isn't page_size (%d != %d)\n", source,
+ _Heap_Block_size(the_block), the_heap->page_size);
error = 1;
}
diff --git a/cpukit/score/src/pheapwalk.c b/cpukit/score/src/pheapwalk.c
index 963be088c3..e20cf124d7 100644
--- a/cpukit/score/src/pheapwalk.c
+++ b/cpukit/score/src/pheapwalk.c
@@ -24,8 +24,19 @@ boolean _Protected_heap_Walk(
{
boolean status;
- _RTEMS_Lock_allocator();
+ /*
+ * If we are called from within a dispatching critical section,
+ * then it is forbidden to lock a mutex. But since we are inside
+ * a critical section, it should be safe to walk it unlocked.
+ *
+ * NOTE: Dispatching is also disabled during initialization.
+ */
+ if ( !_Thread_Dispatch_disable_level ) {
+ _RTEMS_Lock_allocator();
+ status = _Heap_Walk( the_heap, source, do_dump );
+ _RTEMS_Unlock_allocator();
+ } else {
status = _Heap_Walk( the_heap, source, do_dump );
- _RTEMS_Unlock_allocator();
+ }
return status;
}