using segments

来源:互联网 发布:shell echo 数组 编辑:程序博客网 时间:2024/06/04 08:48

3.2 using segment

The segmentation mechanism supported by the IA-32 architecture can be used to
implement a wide variety of system designs. These designs range from flat models
that make only minimal use of segmentation to protect programs to multisegmented
models that employ segmentation to create a robust operating environmentin which multiple programs and tasks can be executed reliably.The following sections give several examples of how segmentation can be employedin a system to improve memory management performance and reliability.

ia_32所支持的分段机制可以被用于执行较多的系统设计。这些设计从平坦模式(用到最小段)到对于多任务模式(使用段去创建一个完整多任务操作环境)来说的保护模式。下面通过一些事例阐述一下系统怎么使用分段来管理内存的

3.2.1 Basic Flat Model
The simplest memory model for a system is the basic “flat model,” in which the operating
system and application programs have access to a continuous, unsegmented
address space. To the greatest extent possible, this basic flat model hides the
segmentation mechanism of the architecture from both the system designer and the
application programmer.
To implement a basic flat memory model with the IA-32 architecture, at least two
segment descriptors must be created, one for referencing a code segment and one
for referencing a data segment (see Figure 3-2). Both of these segments, however,
are mapped to the entire linear address space: that is, both segment descriptors
have the same base address value of 0 and the same segment limit of 4 GBytes. By
setting the segment limit to 4 GBytes, the segmentation mechanism is kept from
generating exceptions for out of limit memory references, even if no physical
memory resides at a particular address. ROM (EPROM) is generally located at the top
of the physical address space, because the processor begins execution atFFFF_FFF0H. RAM (DRAM) is placed at the bottom of the address space because the
initial base address for the DS data segment after reset initialization is 0.
3.2.1

最简单的内存模式是一个基本的平坦的模型,主要是在那些操作系统进入一个连续的 的不分段的地址空间,这种基本的平坦模式在最大限度上对程序和系统设计者隐藏段机制。

为了执行一个基本的平坦内存模式在Ia-32下,至少要创建连个段描述符,一个相对于数据段 一个相对于代码段。这些段整个映射到线性地址上。这就是说这些描述符有同样的基地址值0和同样的段界限4g。通过设置4g的段界限,如果没有真正的物理地址在你指定的地址上 分段机制就会调用超出段界限的异常。Rom一般被放在物理地址的顶部,因为处理器一般都是在FFFF-FFF0H开始执行RAM一般都放置在地址空间的底部 因为在重启之后初始的数据段ds的基地址是0.

 

 

原创粉丝点击