[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

_Heap_Allocate



Hi,

I'm trying to get rtems 4.0.0 running on a 68302 board. I've modified
the start302 for the board requirements. I'm having a problem which I
can only guess might be stack alignment. When _Heap_Allocate is called
and the variable "excess" is used, the application crashes. I've
commented that line out and it doesn't crash. If I replace it with
another variable it doesn't crash. I've assembled the heap.c file to
check the difference. The only change is the offset from -4 to -8. 

void *_Heap_Allocate(
  Heap_Control        *the_heap,
  unsigned32           size
)
{
  unsigned32  excess;
  unsigned32  the_size;
.
.
.
.
.

/* This crashes. */
  excess = size % 3;
	move.l 12(%a6),%d0
	move.l %d0,%d1
	mulu.l #0xaaaaaaab,%d2:%d1
	move.l %d2,%d1
	lsr.l #1,%d1
	move.l %d1,%d3
	move.l %d3,%d2
	add.l %d2,%d2
	add.l %d1,%d2
	sub.l %d2,%d0
	move.l %d0,-4(%a6)
	
/* This doesn't. */
|  the_size = size % 3;
	move.l 12(%a6),%d0
	move.l %d0,%d1
	mulu.l #0xaaaaaaab,%d2:%d1
	move.l %d2,%d1
	lsr.l #1,%d1
	move.l %d1,%d3
	move.l %d3,%d2
	add.l %d2,%d2
	add.l %d1,%d2
	sub.l %d2,%d0
	move.l %d0,-8(%a6)

Any help/pointers/suggestions/guesses gratefully received.


Thanks
russ