Changeset 0375c72 in rtems


Ignore:
Timestamp:
Aug 19, 1998, 2:47:39 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
7549e14
Parents:
2d7d605
Message:

Patch from Aleksey <qqi@…>:

This patch has same changes as one I sent to you earlier plus
it fixes _heap_size problem for pc386 we had discussed earlier.

Now, _heap_size is defined and set to 0 in pc386/startup/bspstart.c

It can be patched to desireable value in binary image. If it is
left unpatched, then startup code will determine size of memory
(on the assumption that at least 2MB are present) and use
max possible heap.

Location:
c/src/lib/libbsp/i386/pc386
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/start/start.s

    r2d7d605 r0375c72  
    4949+----------------------------------------------------------------------------*/
    5050
    51 .set HEAP_SIZE,  256
    5251.set STACK_SIZE, 0x1000
    5352
     
    130129
    131130        movl    $_end, eax              # eax = end of bss/start of heap
    132         addl    _heap_size, eax         # eax = end of heap
    133131        addl    $STACK_SIZE, eax        # make room for stack
    134132        andl    $0xffffffc0, eax        # align it on 16 byte boundary
     
    176174BEGIN_DATA
    177175
    178         PUBLIC(_heap_size)
    179 SYM(_heap_size):
    180         .long HEAP_SIZE << 10
    181 
    182176        PUBLIC(_stack_size)
    183177SYM(_stack_size):
  • c/src/lib/libbsp/i386/pc386/startup/bspstart.c

    r2d7d605 r0375c72  
    4343| Global Variables
    4444+--------------------------------------------------------------------------*/
    45 extern rtems_unsigned32 _end;           /* End of BSS. Defined in 'linkcmds'. */
    46 extern rtems_unsigned32 _heap_size;   /* Size of stack. Defined in 'start.s'. */
    47 extern rtems_unsigned32 _stack_size;  /* Size of heap. Defined in 'start.s'.  */
     45extern rtems_unsigned32 _end;         /* End of BSS. Defined in 'linkcmds'. */
     46
     47/*
     48 * Size of heap if it is 0 it will be dynamically defined by memory size,
     49 * otherwise the value should be changed by binary patch
     50 */
     51rtems_unsigned32 _heap_size = 0;
     52
     53/* Size of stack used during initialization. Defined in 'start.s'.  */
     54extern rtems_unsigned32 _stack_size;
    4855
    4956rtems_unsigned32 rtemsFreeMemStart;
     
    8289void bsp_pretasking_hook(void)
    8390{
     91  rtems_unsigned32 topAddr, val;
     92  int i;
     93 
     94 
    8495  if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1))  /* not aligned => align it */
    8596    rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    8697
     98  if(_heap_size == 0)
     99    {
     100      /*
     101       * We have to dynamically size memory. Memory size can be anything
     102       * between 2M and 2048M.
     103       * let us first write
     104       */
     105      for(i=2048; i>=2; i--)
     106        {
     107          topAddr = i*1024*1024 - 4;
     108          *(volatile rtems_unsigned32 *)topAddr = topAddr;
     109        }
     110
     111      printk("\n");
     112
     113      for(i=2; i<=2048; i++)
     114        {
     115          topAddr = i*1024*1024 - 4;
     116          val =  *(rtems_unsigned32 *)topAddr;
     117          if(val != topAddr)
     118            {
     119              break;
     120            }
     121        }
     122     
     123      topAddr = (i-1)*1024*1024 - 4;
     124
     125      _heap_size = topAddr - rtemsFreeMemStart;
     126    }
     127     
    87128  bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
    88129  rtemsFreeMemStart += _heap_size;           /* HEAP_SIZE  in KBytes */
     
    106147void bsp_start( void )
    107148{
    108   rtemsFreeMemStart = (rtems_unsigned32)&_end + _heap_size + _stack_size;
     149  rtemsFreeMemStart = (rtems_unsigned32)&_end + _stack_size;
    109150                                    /* set the value of start of free memory. */
    110151
Note: See TracChangeset for help on using the changeset viewer.