OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [supplements/] [i386/] [bsp.t] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.