source: rtems/doc/supplements/i386/bsp.t @ e4f7860f

4.104.114.84.95
Last change on this file since e4f7860f was e4f7860f, checked in by Joel Sherrill <joel.sherrill@…>, on 10/19/98 at 17:17:42

Makefiles in much better shape even though not all files have automatically
generated menus yet.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@ifinfo
10@node Board Support Packages, Board Support Packages Introduction, Default Fatal Error Processing Default Fatal Error Handler Operations, Top
11@end ifinfo
12@chapter Board Support Packages
13@ifinfo
14@menu
15* Board Support Packages Introduction::
16* Board Support Packages System Reset::
17* Board Support Packages Processor Initialization::
18@end menu
19@end ifinfo
20
21@ifinfo
22@node Board Support Packages Introduction, Board Support Packages System Reset, Board Support Packages, Board Support Packages
23@end ifinfo
24@section Introduction
25
26An RTEMS Board Support Package (BSP) must be designed to support a
27particular processor and target board combination.  This chapter presents a
28discussion of i386 specific BSP issues.  For more information on developing
29a BSP, refer to the chapter titled Board Support Packages in the RTEMS
30Applications User's Guide.
31
32@ifinfo
33@node Board Support Packages System Reset, Board Support Packages Processor Initialization, Board Support Packages Introduction, Board Support Packages
34@end ifinfo
35@section System Reset
36
37An RTEMS based application is initiated when the i386
38processor is reset.  When the i386 is reset,
39
40@itemize @bullet
41
42@item The EAX register is set to indicate the results of the processor's
43power-up self test.  If the self-test was not executed, the contents of
44this register are undefined.  Otherwise, a non-zero value indicates the
45processor is faulty and a zero value indicates a successful self-test.
46
47@item The DX register holds a component identifier and revision level.  DH
48contains 3 to indicate an i386 component and DL contains a unique revision
49level indicator.
50
51@item Control register zero (CR0) is set such that the processor is in real
52mode with paging disabled.  Other portions of CR0 are used to indicate the
53presence of a numeric coprocessor.
54
55@item All bits in the extended flags register (EFLAG) which are not
56permanently set are cleared.  This inhibits all maskable interrupts.
57
58@item The Interrupt Descriptor Register (IDTR) is set to point at address
59zero.
60
61@item All segment registers are set to zero.
62
63@item The instruction pointer is set to 0x0000FFF0.  The first instruction
64executed after a reset is actually at 0xFFFFFFF0 because the i386 asserts
65the upper twelve address until the first intersegment (FAR) JMP or CALL
66instruction.  When a JMP or CALL is executed, the upper twelve address
67lines are lowered and the processor begins executing in the first megabyte
68of memory.
69
70@end itemize
71
72Typically, an intersegment JMP to the application's initialization code is
73placed at address 0xFFFFFFF0.
74
75@ifinfo
76@node Board Support Packages Processor Initialization, Processor Dependent Information Table, Board Support Packages System Reset, Board Support Packages
77@end ifinfo
78@section Processor Initialization
79
80This initialization code is responsible for initializing all data
81structures required by the i386 in protected mode and for actually entering
82protected mode.  The i386 must be placed in protected mode and the segment
83registers and associated selectors must be initialized before the
84initialize_executive directive is invoked.
85
86The initialization code is responsible for initializing the Global
87Descriptor Table such that the i386 is in the thirty-two bit flat memory
88model with paging disabled.  In this mode, the i386 automatically converts
89every address from a logical to a physical address each time it is used.
90For more information on the memory model used by RTEMS, please refer to the
91Memory Model chapter in this document.
92
93Since the processor is in real mode upon reset, the processor must be
94switched to protected mode before RTEMS can execute.  Before switching to
95protected mode, at least one descriptor table and two descriptors must be
96created.  Descriptors are needed for a code segment and a data segment. (
97This will give you the flat memory model.)  The stack can be placed in a
98normal read/write data segment, so no descriptor for the stack is needed.
99Before the GDT can be used, the base address and limit must be loaded into
100the GDTR register using an LGDT instruction.
101
102If the hardware allows an NMI to be generated, you need to create the IDT
103and a gate for the NMI interrupt handler.  Before the IDT can be used, the
104base address and limit for the idt must be loaded into the IDTR register
105using an LIDT instruction.
106
107Protected mode is entered by setting thye PE bit in the CR0 register.
108Either a LMSW or MOV CR0 instruction may be used to set this bit. Because
109the processor overlaps the interpretation of several instructions, it is
110necessary to discard the instructions from the read-ahead cache. A JMP
111instruction immediately after the LMSW changes the flow and empties the
112processor if intructions which have been pre-fetched and/or decoded.  At
113this point, the processor is in protected mode and begins to perform
114protected mode application initialization.
115
116If the application requires that the IDTR be some value besides zero, then
117it should set it to the required value at this point.  All tasks share the
118same i386 IDTR value.  Because interrupts are enabled automatically by
119RTEMS as part of the initialize_executive directive, the IDTR MUST be set
120properly before this directive is invoked to insure correct interrupt
121vectoring.  If processor caching is to be utilized, then it should be
122enabled during the reset application initialization code.  The reset code
123which is executed before the call to initialize_executive has the following
124requirements:
125
126For more information regarding the i386s data structures and their
127contents, refer to Intel's 386 Programmer's Reference Manual.
128
Note: See TracBrowser for help on using the repository browser.