source: rtems/c/src/lib/libbsp/i386/go32/startup/bspstart.c @ 9e738b65

4.104.114.84.95
Last change on this file since 9e738b65 was 4ca27cf, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 18, 1995 at 9:19:53 PM

committing for rtems-3.2.01 snapshot

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
13 *  On-Line Applications Research Corporation (OAR).
14 *  All rights assigned to U.S. Government, 1994.
15 *
16 *  This material may be reproduced by or for the U.S. Government pursuant
17 *  to the copyright license under the clause at DFARS 252.227-7013.  This
18 *  notice must appear in all copies of this file and its derivatives.
19 *
20 *  $Id$
21 */
22
23#include <rtems.h>
24#include <bsp.h>
25#include <libcsupport.h>
26
27#include <stackchk.h>
28
29/*
30 *  The original table from the application and our copy of it with
31 *  some changes.
32 */
33
34extern rtems_configuration_table  Configuration;
35rtems_configuration_table  BSP_Configuration;
36
37rtems_cpu_table Cpu_table;
38
39/*      Initialize whatever libc we are using
40 *      called from postdriver hook
41 */
42
43void bsp_libc_init()
44{
45    rtems_unsigned32        heap_start;
46
47#if 0
48    extern int end;
49    heap_start = (rtems_unsigned32) &end;
50#else
51    void * sbrk( int );
52    heap_start = (rtems_unsigned32) sbrk( 64 * 1024 + CPU_ALIGNMENT );
53#endif
54    if (heap_start & (CPU_ALIGNMENT-1))
55        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
56
57    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
58
59    /*
60     * Set up for the libc handling.
61     */
62
63    if (BSP_Configuration.ticks_per_timeslice > 0)
64        libc_init(1);                /* reentrant if possible */
65    else
66        libc_init(0);                /* non-reentrant */
67
68    /*
69     *  Initialize the stack bounds checker
70     */
71
72#ifdef STACK_CHECKER_ON
73    Stack_check_Initialize();
74#endif
75
76}
77
78void bsp_start()
79{
80    extern void * sbrk( int );
81
82    Cpu_table.pretasking_hook           = NULL;
83    Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
84    Cpu_table.postdriver_hook = NULL;   /* Call our main() for constructors */
85    Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
86    Cpu_table.do_zero_of_workspace      = TRUE;
87    Cpu_table.interrupt_table_segment   = 0;/* get_ds(); */
88    Cpu_table.interrupt_table_offset    = (void *)0;
89    Cpu_table.interrupt_stack_size      = 4096;
90    Cpu_table.extra_system_initialization_stack = 0;
91
92    /*
93     *  Copy the table
94     */
95    BSP_Configuration = Configuration;
96
97    BSP_Configuration.work_space_start = sbrk( Configuration.work_space_size );
98    if ( BSP_Configuration.work_space_start == 0 )  {
99        /* Big trouble */
100        int     write( int, void *, int );
101        void    _exit( int );
102        char    msg[] = "bsp_start() couldn't sbrk() RTEMS work space\n";
103        write( 2, msg, sizeof msg - 1 );
104        _exit( 1 );
105    }
106
107    /*
108     * Add 1 region for Malloc in libc_low
109     */
110
111    BSP_Configuration.maximum_regions++;
112
113    /*
114     * Add 1 extension for newlib libc
115     */
116
117#ifdef RTEMS_NEWLIB
118    BSP_Configuration.maximum_extensions++;
119#endif
120
121    /*
122     * Add another extension if using the stack checker
123     */
124
125#ifdef STACK_CHECKER_ON
126    BSP_Configuration.maximum_extensions++;
127#endif
128
129    rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
130    /* does not return */
131
132    /* no cleanup necessary for GO32 */
133}
Note: See TracBrowser for help on using the repository browser.