Index: c/src/lib/libbsp/powerpc/ChangeLog
===================================================================
--- c/src/lib/libbsp/powerpc/ChangeLog	(revision af2eb770c7eea77967c19876ba907bd5a46176ec)
+++ c/src/lib/libbsp/powerpc/ChangeLog	(revision 7a2125ca39854c6bab1180dda7202a5af908357a)
@@ -1,2 +1,10 @@
+2008-09-19	Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* shared/start/start.S, shared/startup/bspgetworkarea.c,
+	shared/startup/bspstart.c, shared/startup/linkcmds: Modifications
+	which reflect those tested on psim. Hopefully they work on all
+	boards. The initialization stack is explicitly declared in the
+	linkcmds memory layout rather than magic math.
+
 2008-09-16	Joel Sherrill <joel.sherrill@oarcorp.com>
 
Index: c/src/lib/libbsp/powerpc/shared/start/start.S
===================================================================
--- c/src/lib/libbsp/powerpc/shared/start/start.S	(revision af2eb770c7eea77967c19876ba907bd5a46176ec)
+++ c/src/lib/libbsp/powerpc/shared/start/start.S	(revision 7a2125ca39854c6bab1180dda7202a5af908357a)
@@ -106,6 +106,6 @@
 	 * stack = &__rtems_end + 4096
 	 */
-	addis	r9,r0, __rtems_end+(4096-PPC_MINIMUM_STACK_FRAME_SIZE)@ha
-        addi	r9,r9, __rtems_end+(4096-PPC_MINIMUM_STACK_FRAME_SIZE)@l
+	addis	r9,r0, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@ha
+        addi	r9,r9, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@l
 	mr	r1, r9
 	/*
Index: c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c	(revision af2eb770c7eea77967c19876ba907bd5a46176ec)
+++ c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c	(revision 7a2125ca39854c6bab1180dda7202a5af908357a)
@@ -30,13 +30,23 @@
   uintptr_t spared;
 
-  reserve  = (uintptr_t)BSP_INIT_STACK_SIZE;
-  reserve += rtems_configuration_get_interrupt_stack_size();
-  size     = (uintptr_t)BSP_mem_size - (uintptr_t)&__rtems_end + reserve;
+  reserve  = rtems_configuration_get_interrupt_stack_size();
+  size     = (uintptr_t)BSP_mem_size - (uintptr_t)&__rtems_end - reserve;
 
-  *work_area_start = (void *)(&__rtems_end + reserve);
+  *work_area_start = (void *)((uintptr_t) &__rtems_end + reserve);
   *work_area_size  = size;
   spared = _bsp_sbrk_init( *work_area_start, work_area_size );
   *heap_start      = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
   *heap_size       = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
+
+  /*
+   *  The following may be helpful in debugging what goes wrong when
+   *  you are allocating the Work Area in a new BSP.
+   */
+  #if 0
+    printk( "Work Area Base %d %x\n", *work_area_start, *work_area_start );
+    printk( "Work Area Size %d %x\n", *work_area_size, *work_area_size );
+    printk( "Work Area End %d %x\n",
+      *work_area_start + size, *work_area_start + size );
+  #endif
 }
 
Index: c/src/lib/libbsp/powerpc/shared/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/powerpc/shared/startup/bspstart.c	(revision af2eb770c7eea77967c19876ba907bd5a46176ec)
+++ c/src/lib/libbsp/powerpc/shared/startup/bspstart.c	(revision 7a2125ca39854c6bab1180dda7202a5af908357a)
@@ -88,8 +88,4 @@
  */
 unsigned int BSP_time_base_divisor;
-/*
- * system init stack
- */
-#define INIT_STACK_SIZE 0x1000
 
 void BSP_panic(char *s)
@@ -144,5 +140,4 @@
 void bsp_start( void )
 {
-  unsigned char *stack;
 #if !defined(mvme2100)
   unsigned l2cr;
@@ -213,18 +208,7 @@
 
   /*
-   * the initial stack  has aready been set to this value in start.S
-   * so there is no need to set it in r1 again... It is just for info
-   * so that It can be printed without accessing R1.
-   */
-  stack = ((unsigned char*) __rtems_end) +
-               INIT_STACK_SIZE - PPC_MINIMUM_STACK_FRAME_SIZE;
-
-  /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
-  *((uint32_t*)stack) = 0;
-
-  /*
    * Initialize the interrupt related settings.
    */
-  intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
+  intrStackStart = (uint32_t) __rtems_end;
   intrStackSize = rtems_configuration_get_interrupt_stack_size();
 
Index: c/src/lib/libbsp/powerpc/shared/startup/linkcmds
===================================================================
--- c/src/lib/libbsp/powerpc/shared/startup/linkcmds	(revision af2eb770c7eea77967c19876ba907bd5a46176ec)
+++ c/src/lib/libbsp/powerpc/shared/startup/linkcmds	(revision 7a2125ca39854c6bab1180dda7202a5af908357a)
@@ -225,4 +225,6 @@
   } > CODE
   . = ALIGN(16);
+  . += 0x1000;
+  __stack = .;
   _end = . ;
   __rtems_end = . ;
