2009-02-27 Joel Sherrill <joel.sherrill@OARcorp.com>

* bspgetworkarea.c: Add check to determine if current stack pointer is
	in work area.
This commit is contained in:
Joel Sherrill
2009-02-27 15:09:37 +00:00
parent 67cad729e6
commit 5d01560bb4
2 changed files with 29 additions and 5 deletions

View File

@@ -1,3 +1,8 @@
2009-02-27 Joel Sherrill <joel.sherrill@OARcorp.com>
* bspgetworkarea.c: Add check to determine if current stack pointer is
in work area.
2009-02-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/utility.h: Added define.

View File

@@ -63,11 +63,30 @@ void bsp_get_work_area(
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = (ssize_t) HeapSize;
/*
* The following may be helpful in debugging what goes wrong when
* you are allocating the Work Area in a new BSP.
*/
#ifdef BSP_GET_WORK_AREA_DEBUG
printk( "work_area_start = %p\n", *work_area_start );
printk( "work_area_size = %d 0x%08x\n", *work_area_size, *work_area_size );
printk( "end = %p\n", *work_area_start + *work_area_size );
printk( "heap_start = %p\n", *heap_start );
printk( "heap_size = %d\n", *heap_size );
{
void *sp = __builtin_frame_address(0);
void *end = *work_area_start + *work_area_size;
printk(
"work_area_start = 0x%p\n"
"work_area_size = %d 0x%08x\n"
"end = 0x%p\n"
"heap_start = 0x%p\n"
"heap_size = %d\n"
"current stack pointer = 0x%p%s\n",
*work_area_start,
*work_area_size, /* decimal */
*work_area_size, /* hexadecimal */
end,
*heap_start,
*heap_size,
sp,
((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
);
}
#endif
}