diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-01-13 15:07:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-01-13 15:07:03 +0000 |
commit | 9b2c9693692991016e1674856fa147b65156a718 (patch) | |
tree | 55e30d6264f3f1231f05e61173787220cc56835d /c/src/lib/libbsp/m68k/shared | |
parent | New patch from Eric Norum plus some minor mods by Joel. (diff) | |
download | rtems-9b2c9693692991016e1674856fa147b65156a718.tar.bz2 |
Made sweep of changes to get all BSPs to the same point on the linkcmds
and memory layout. Next step is to share the same bsp_pretasking_hook.
Diffstat (limited to 'c/src/lib/libbsp/m68k/shared')
-rw-r--r-- | c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c | 62 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/shared/start.S | 4 |
2 files changed, 64 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c b/c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c new file mode 100644 index 0000000000..b81acbb6cf --- /dev/null +++ b/c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c @@ -0,0 +1,62 @@ +/* + * This routine is an implementation of the bsp_pretasking_hook + * that can be used by all m68k BSPs following linkcmds conventions + * regarding heap, stack, and workspace allocation. + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <rtems.h> +#include <bsp.h> +#include <libcsupport.h> + +/* + * Function: bsp_pretasking_hook + * Created: 95/03/10 + * + * Description: + * BSP pretasking hook. Called just before drivers are initialized. + * Used to setup libc and install any BSP extensions. + * + * NOTES: + * Must not use libc (to do io) from here, since drivers are + * not yet initialized. + * + */ + +extern void bsp_libc_init( void *, unsigned long, int ); +extern rtems_configuration_table BSP_Configuration; + +extern unsigned long _RamSize; +extern void *_WorkspaceBase; +extern void *_HeapSize; + +void bsp_pretasking_hook(void) +{ + void *heapStart; + unsigned long heapSize = (unsigned long)&_HeapSize; + unsigned long ramSpace; + + heapStart = (void *) + ((unsigned long)&_WorkspaceBase + BSP_Configuration.work_space_size); + ramSpace = _RamSize - (unsigned long) heapStart; + + if (heapSize == 0) + heapSize = ramSpace; + else if (heapSize > ramSpace) + rtems_fatal_error_occurred (('H'<<24) | ('E'<<16) | ('A'<<8) | 'P'); + + bsp_libc_init(heapStart, heapSize, 0); + +#ifdef RTEMS_DEBUG + rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); +#endif + +} diff --git a/c/src/lib/libbsp/m68k/shared/start.S b/c/src/lib/libbsp/m68k/shared/start.S index 2791fab91e..50099d9c43 100644 --- a/c/src/lib/libbsp/m68k/shared/start.S +++ b/c/src/lib/libbsp/m68k/shared/start.S @@ -68,8 +68,8 @@ SYM (start_around): | zero out uninitialized data area | zerobss: - moveal # SYM (end),a0 | find end of .bss - moveal # SYM (_bss_start),a1 | find beginning of .bss + moveal # SYM (_clear_end),a0 | find end of .bss + moveal # SYM (_clear_start),a1 | find beginning of .bss movel #0,d0 loop: movel #0,a1@+ | to zero out uninitialized |