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 memmodel.t,v 1.6 2002/01/17 21:47:46 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter Memory Model
|
10 |
|
|
|
11 |
|
|
@section Introduction
|
12 |
|
|
|
13 |
|
|
A processor may support any combination of memory
|
14 |
|
|
models ranging from pure physical addressing to complex demand
|
15 |
|
|
paged virtual memory systems. RTEMS supports a flat memory
|
16 |
|
|
model which ranges contiguously over the processor's allowable
|
17 |
|
|
address space. RTEMS does not support segmentation or virtual
|
18 |
|
|
memory of any kind. The appropriate memory model for RTEMS
|
19 |
|
|
provided by the targeted processor and related characteristics
|
20 |
|
|
of that model are described in this chapter.
|
21 |
|
|
|
22 |
|
|
@section Flat Memory Model
|
23 |
|
|
|
24 |
|
|
RTEMS supports the i386 protected mode, flat memory
|
25 |
|
|
model with paging disabled. In this mode, the i386
|
26 |
|
|
automatically converts every address from a logical to a
|
27 |
|
|
physical address each time it is used. The i386 uses
|
28 |
|
|
information provided in the segment registers and the Global
|
29 |
|
|
Descriptor Table to convert these addresses. RTEMS assumes the
|
30 |
|
|
existence of the following segments:
|
31 |
|
|
|
32 |
|
|
@itemize @bullet
|
33 |
|
|
@item a single code segment at protection level (0) which
|
34 |
|
|
contains all application and executive code.
|
35 |
|
|
|
36 |
|
|
@item a single data segment at protection level zero (0) which
|
37 |
|
|
contains all application and executive data.
|
38 |
|
|
@end itemize
|
39 |
|
|
|
40 |
|
|
The i386 segment registers and associated selectors
|
41 |
|
|
must be initialized when the initialize_executive directive is
|
42 |
|
|
invoked. RTEMS treats the segment registers as system registers
|
43 |
|
|
and does not modify or context switch them.
|
44 |
|
|
|
45 |
|
|
This i386 memory model supports a flat 32-bit address
|
46 |
|
|
space with addresses ranging from 0x00000000 to 0xFFFFFFFF (4
|
47 |
|
|
gigabytes). Each address is represented by a 32-bit value and
|
48 |
|
|
is byte addressable. The address may be used to reference a
|
49 |
|
|
single byte, half-word (2-bytes), or word (4 bytes).
|
50 |
|
|
|
51 |
|
|
RTEMS does not require that logical addresses map
|
52 |
|
|
directly to physical addresses, although it is desirable in many
|
53 |
|
|
applications to do so. If logical and physical addresses are
|
54 |
|
|
not the same, then an additional selector will be required so
|
55 |
|
|
RTEMS can access the Interrupt Descriptor Table to install
|
56 |
|
|
interrupt service routines. The selector number of this segment
|
57 |
|
|
is provided to RTEMS in the CPU Dependent Information Table.
|
58 |
|
|
|
59 |
|
|
By not requiring that logical addresses map directly
|
60 |
|
|
to physical addresses, the memory space of an RTEMS application
|
61 |
|
|
can be separated from that of a ROM monitor. For example, on
|
62 |
|
|
the Force Computers CPU386, the ROM monitor loads application
|
63 |
|
|
programs into a logical address space where logical address
|
64 |
|
|
0x00000000 corresponds to physical address 0x0002000. On this
|
65 |
|
|
board, RTEMS and the application use virtual addresses which do
|
66 |
|
|
not map to physical addresses.
|
67 |
|
|
|
68 |
|
|
RTEMS assumes that the DS and ES registers contain
|
69 |
|
|
the selector for the single data segment when a directive is
|
70 |
|
|
invoked. This assumption is especially important when
|
71 |
|
|
developing interrupt service routines.
|
72 |
|
|
|