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