source: rtems/c/src/lib/libbsp/i386/pc386/start/start.s @ 2d7d605

4.104.114.84.95
Last change on this file since 2d7d605 was 2d7d605, checked in by Joel Sherrill <joel.sherrill@…>, on 08/19/98 at 14:41:23

Patch from Aleksey <qqi@…>:

It fixes netboot build problem, KA9Q configuration
for pc386, some compiler wardning, it also removed some stuff
ifdef'ed with '#if 0'.

  • Property mode set to 100644
File size: 6.3 KB
RevLine 
[7150f00f]1/*-------------------------------------------------------------------------+
2| start.s v1.1 - PC386 BSP - 1997/08/07
3+--------------------------------------------------------------------------+
4| This file contains the entry point for the application.
5| The name of this entry point is compiler dependent.
6| It jumps to the BSP which is responsible for performing all initialization.
7+--------------------------------------------------------------------------+
8| (C) Copyright 1997 -
9| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
10|
11| http://pandora.ist.utl.pt
12|
13| Instituto Superior Tecnico * Lisboa * PORTUGAL
14+--------------------------------------------------------------------------+
[2efdd08]15| Modified the 20/05/1998  by valette@crf.canon.fr in order to give a working
16| example of eraly stage debugging via the DEBUG_EARLY_START define.
17+--------------------------------------------------------------------------+
[7150f00f]18| Disclaimer:
19|
20| This file is provided "AS IS" without warranty of any kind, either
21| expressed or implied.
22+--------------------------------------------------------------------------+
23| This code is based on an earlier generation RTEMS i386 start.s and the
24| following copyright applies:
25|
26| **************************************************************************
[60b791ad]27| *  COPYRIGHT (c) 1989-1998.
[7150f00f]28| *  On-Line Applications Research Corporation (OAR).
29| *  Copyright assigned to U.S. Government, 1994.
30| *
31| *  The license and distribution terms for this file may be
32| *  found in the file LICENSE in this distribution or at
33| *  http://www.OARcorp.com/rtems/license.html.
34| **************************************************************************
35|
[6f9c75c3]36|  $Id$
[7150f00f]37+--------------------------------------------------------------------------*/
38
[4050a7f]39/*
40 * The most trivial start.s possible. It does not know anything
41 * about system it is running on, so it will jump to appropriate
42 * place in BSP specific place to do things it knows nothing about
43 */
[7150f00f]44
45#include "asm.h"
46
[96d56b3]47/*----------------------------------------------------------------------------+
48| Size of heap and stack:       
49+----------------------------------------------------------------------------*/
50
[4050a7f]51.set HEAP_SIZE,  256
[96d56b3]52.set STACK_SIZE, 0x1000
53
[7150f00f]54/*----------------------------------------------------------------------------+
55| CODE section
56+----------------------------------------------------------------------------*/
57
58BEGIN_CODE
59
60        PUBLIC (start)          # GNU default entry point
61
[e2a2ec60]62        EXTERN (boot_card)
[4050a7f]63        EXTERN (_load_segments)
64        EXTERN (_return_to_monitor)
[2efdd08]65        EXTERN (_IBMPC_initVideo)
[4050a7f]66        EXTERN (debugPollingGetChar)
[ab0df696]67        EXTERN (checkCPUtypeSetCr0)
68       
[2efdd08]69
70/*
[4050a7f]71 * In case this crashes on your machine and this is not due
[2efdd08]72 * to video mode set by the loader, you may try to define
[4050a7f]73 * the following variable:
[2efdd08]74 */
[5d18fb0]75/* #define DEBUG_EARLY_START */
[7150f00f]76
[4050a7f]77SYM (start):
[bb6d368]78        /*
79         *  When things are really, REALLY!, bad -- turn on the speaker and
80         *  lock up.  This shows whether or not we make it to a certain
81         *  location.
82         */
83#if 0
84        inb     $0x61, al
85        orb     $0x03, al
86        outb    al, $0x61       # enable the speaker
87speakl: jmp     speakl             # and SPIN!!!
88#endif
89
[7150f00f]90        nop
91        cli                     # DISABLE INTERRUPTS!!!
[2efdd08]92        cld
[ab0df696]93#ifdef DEBUG_EARLY_START
[2efdd08]94        /*
95         * Must get video attribute to have a working printk.
96         * Note that the following code assume we already have
97         * valid segments and a stack. It should be true for
98         * any loader starting RTEMS in protected mode (or
99         * at least I hope so : -)).
100         */
101        call _IBMPC_initVideo
102        /*
103         * try printk and a getchar in polling mode ASAP
104         */
105        pushl   $welcome_msg
106        call    printk
107        addl    $4, esp
108
[2d7d605]109        /* call debugPollingGetChar */
[67a2288]110       
[2efdd08]111#endif 
[7150f00f]112
113/*----------------------------------------------------------------------------+
114| Load the segment registers (this is done by the board's BSP) and perform any
[4050a7f]115| other board specific initialization procedures, this piece of code
116| does not know anything about
[7150f00f]117|
118| NOTE: Upon return, gs will contain the segment descriptor for a segment which
119|       maps directly to all of physical memory.
120+----------------------------------------------------------------------------*/
121
122        jmp     SYM (_load_segments)    # load board dependent segments
123
124/*----------------------------------------------------------------------------+
125| Set up the stack
126+----------------------------------------------------------------------------*/
127
128        PUBLIC (_establish_stack)
129SYM (_establish_stack):
130
131        movl    $_end, eax              # eax = end of bss/start of heap
[4050a7f]132        addl    _heap_size, eax         # eax = end of heap
[96d56b3]133        addl    $STACK_SIZE, eax        # make room for stack
[7150f00f]134        andl    $0xffffffc0, eax        # align it on 16 byte boundary
135        movl    eax, esp                # set stack pointer
136        movl    eax, ebp                # set base pointer
137
138/*----------------------------------------------------------------------------+
139| Zero out the BSS segment
140+----------------------------------------------------------------------------*/
141
142SYM (zero_bss):
143        cld                             # make direction flag count up
144        movl    $ SYM (_end), ecx       # find end of .bss
145        movl    $ SYM (_bss_start), edi # edi = beginning of .bss
146        subl    edi, ecx                # ecx = size of .bss in bytes
[f02ffca]147        shrl    ecx                     # size of .bss in longs
148        shrl    ecx
[7150f00f]149        xorl    eax, eax                # value to clear out memory
150        repne                           # while ecx != 0
151        stosl                           #   clear a long in the bss
152
[4050a7f]153/*---------------------------------------------------------------------+
[ab0df696]154| Check CPU type. Enable Cache and init coprocessor if needed.
[4050a7f]155+---------------------------------------------------------------------*/
[ab0df696]156        call checkCPUtypeSetCr0
[4050a7f]157/*---------------------------------------------------------------------+
158| Transfer control to User's Board Support Package
159+---------------------------------------------------------------------*/
[7150f00f]160
161        pushl   $0                      # environp
162        pushl   $0                      # argv
163        pushl   $0                      # argc
[e2a2ec60]164        call    SYM (boot_card)
[7150f00f]165        addl    $12, esp
166
[4050a7f]167/*---------------------------------------------------------------------+
168| Clean up - we do not know anything about it, so we will
169| jump to BSP specific code to do cleanup
170+---------------------------------------------------------------------*/
[7150f00f]171
172        jmp     SYM (_return_to_monitor)
173
174END_CODE
175
176BEGIN_DATA
177
[4050a7f]178        PUBLIC(_heap_size)
179SYM(_heap_size):
180        .long HEAP_SIZE << 10
[7150f00f]181
[4050a7f]182        PUBLIC(_stack_size)
183SYM(_stack_size):
184        .long STACK_SIZE
[7150f00f]185
[2efdd08]186#ifdef DEBUG_EARLY_START
[4050a7f]187
[2efdd08]188        PUBLIC (welcome_msg)
189SYM (welcome_msg) :
190        .string "Ready to debug RTEMS ?\nEnter <CR>\n"
191
[4050a7f]192        PUBLIC (hex_msg)
193SYM (hex_msg) :
194        .string "0x%x\n"
[7150f00f]195
[4050a7f]196        PUBLIC (made_it_msg)
197SYM (made_it_msg) :
198        .string "made it to %d\n"
[7150f00f]199
[4050a7f]200#endif
[7150f00f]201
[4050a7f]202END_DATA
[7150f00f]203
[4050a7f]204END
[7150f00f]205
206
207
208
Note: See TracBrowser for help on using the repository browser.