source: rtems/c/src/lib/libbsp/i386/force386/startup/ldsegs.s @ 7150f00f

4.104.114.84.95
Last change on this file since 7150f00f was 98e4ebf5, checked in by Joel Sherrill <joel.sherrill@…>, on 10/08/97 at 15:45:54

Fixed typo in the pointer to the license terms.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*  _load_segments
2 *
3 *  This file assists the board independent startup code by
4 *  loading the proper segment register values.  The values
5 *  loaded are board dependent.
6 *
7 *  NOTE:  No stack has been established when this routine
8 *         is invoked.  It returns by jumping back to bspentry.
9 *
10 *  COPYRIGHT (c) 1989-1997.
11 *  On-Line Applications Research Corporation (OAR).
12 *  Copyright assigned to U.S. Government, 1994.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.OARcorp.com/rtems/license.html.
17 *
18 *  $Id$
19 */
20
21#include "asm.h"
22
23BEGIN_CODE
24
25/*
26 *  FORCEBUG loads us into a virtual address space which
27 *  really starts at PHYSICAL_ADDRESS_BASE.
28 */
29
30.set PHYSICAL_ADDRESS_BASE,    0x00002000
31
32/*
33 *  At reset time, FORCEBUG normally has the segment selectors preloaded.
34 *  If a human resets the instruction pointer, this will not have occurred.
35 *  However, no guarantee can be made of the other registers if cs:ip was
36 *  modified to restart the program.  Because of this, the BSP reloads all
37 *  segment registers (except cs) with the values they have following
38 *  a reset.
39 */
40
41
42.set RESET_SS, 0x40        # initial value of stack segment register
43.set RESET_DS, 0x40        # initial value of data segment register
44.set RESET_ES, 0x40        # initial value of extra segment register
45.set RESET_FS, 0x40        # initial value of "f" segment register
46.set RESET_GS, 0x30        # initial value of "g" segment register
47
48
49#define LOAD_SEGMENTS(_value,_segment) \
50        movw      $ ## _value, ax ; \
51        movw      ax, _segment
52
53        EXTERN (establish_stack)
54
55        PUBLIC (_load_segments)
56SYM (_load_segments):
57        LOAD_SEGMENTS( RESET_SS, ss )
58        LOAD_SEGMENTS( RESET_DS, ds )
59        LOAD_SEGMENTS( RESET_ES, es )
60        LOAD_SEGMENTS( RESET_FS, fs )
61        LOAD_SEGMENTS( RESET_GS, gs )
62
63        jmp     SYM (_establish_stack)  # return to the bsp entry code
64
65        PUBLIC (_return_to_monitor)
66SYM (_return_to_monitor):
67
68        call    SYM (Clock_exit)
69        movb    $0,al
70        int     $0x20                   # restart FORCEbug
71        jmp     SYM (start)             # FORCEbug does not reset PC
72
73END_CODE
74
75BEGIN_DATA
76
77        PUBLIC (_Do_Load_IDT)
78SYM (_Do_Load_IDT):
79       .byte 1
80
81        PUBLIC (_Do_Load_GDT)
82SYM (_Do_Load_GDT):
83       .byte 0
84
85END_DATA
86END
Note: See TracBrowser for help on using the repository browser.