【译】x86程序员手册16-5.3联合使用段与分页转换
5.3 Combining Segment and Page Translation
联合使用段与分页转换
Figure 5-12 combines Figure 5-2 and Figure 5-9 to summarize both phases of the transformation from a logical address to a physical address when paging is enabled. By appropriate choice of options and parameters to both phases, memory-management software can implement several different styles of memory management.
图5-12联合图5-2与图5-9一起总结了当分页被启用后从逻辑地址转换到物理地址时所有转换部分。通过在两个转换部分选择适当的选项和参数,内存管理软件可以实现几种不同风格的内存管理。
5.3.1 "Flat" Architecture 扁平结构
When the 80386 is used to execute software designed for architectures that don't have segments, it may be expedient to effectively "turn off" the segmentation features of the 80386. The 80386 does not have a mode that disables segmentation, but the same effect can be achieved by initially loading the segment registers with selectors for descriptors that encompass the entire 32-bit linear address space. Once loaded, the segment registers don't need to be changed. The 32-bit offsets used by 80386 instructions are adequate to address the entire linear-address space.
当80386用来执行为不具有段架构的软件时,有效的方法就是关闭80386的分段特性。80386没有哪种模式可以关闭段,但是通过在初始化时为段寄存器装入一个选择子,这个选择子所指向的描述符占用整个32位线性地址空间,可以达到一样的效果。一旦载入后,段寄存器不再需要修改。80386指令使用的32位偏移地址足够来寻址整个线性地址空间。
5.3.2 Segments Spanning Several Pages 段跨越多个页
The architecture of the 80386 permits segments to be larger or smaller than the size of a page (4 Kilobytes). For example, suppose a segment is used to address and protect a large data structure that spans 132 Kilobytes. In a software system that supports paged virtual memory, it is not necessary for the entire structure to be in physical memory at once. The structure is divided into 33 pages, any number of which may not be present. The applications programmer does not need to be aware that the virtual memory subsystem is paging the structure in this manner.
80386架构允许段限长大于或小于一页大小(4K)。例如,一个段用来寻址和保护一个达到132K大小的数据结构。在一个支持分页的虚拟内存系统中,将全部结构马上放在物理内存中不是必须的。这个结构可以被分为33页,其中的一部分可以不存在于物理内存中。应用程序不需要知道虚拟内存子系统把它用这种方式分页。
5.3.3 Pages Spanning Several Segments 多页跨越几个段
On the other hand, segments may be smaller than the size of a page. For example, consider a small data structure such as a semaphore. Because of the protection and sharing provided by segments (refer to Chapter 6 ) , it may be useful to create a separate segment for each semaphore. But, because a system may need many semaphores, it is not efficient to allocate a page for each. Therefore, it may be useful to cluster many related segments within a page.
另一方面,多个段可能小于一页的大小。例如,考虑一个小的数据结构,比如信号量。因为段提供保护和共享(参见第6章),为每个信号量创建一个独立的段是有益的。但是,因为一个系统可能需要很多信号量,为每一个分配一个页是低效的。因此,在一页内聚合很多相关的段是有益的。
5.3.4 Non-Aligned Page and Segment Boundaries 非对齐页和段边界
The architecture of the 80386 does not enforce any correspondence between the boundaries of pages and segments. It is perfectly permissible for a page to contain the end of one segment and the beginning of another. Likewise, a segment may contain the end of one page and the beginning of another.
80386架构不强制任何页与段的边界对齐。它允许一个页包含一个段的尾部和另一个段的开始。另外,一个可以包含一个页的尾部和另一个的页的开始。
5.3.5 Aligned Page and Segment Boundaries 对齐的页和段边界
Memory-management software may be simpler, however, if it enforces some correspondence between page and segment boundaries. For example, if segments are allocated only in units of one page, the logic for segment and page allocation can be combined. There is no need for logic to account for partially used pages.
尽管如此,如果强制页与段边界对齐会让内存管理软件变得简单。例如,如果段都只能被分配在一个页单元中,对段和页的定位逻辑可以组合起来。因此计算被使用的部分页在逻辑上是不需要。
5.3.6 Page-Table per Segment 每段一个页表
An approach to space management that provides even further simplification of space-management software is to maintain a one-to-one correspondence between segment descriptors and page-directory entries, as Figure 5-13 illustrates. Each descriptor has a base address in which the low-order 22 bits are zero; in other words, the base address is mapped by the first entry of a page table. A segment may have any limit from 1 to 4 megabytes. Depending on the limit, the segment is contained in from 1 to 1K page frames.A task is thus limited to 1K segments (a sufficient number for many applications), each containing up to 4 Mbytes. The descriptor, the corresponding page-directory entry, and the corresponding page table can be allocated and deallocated simultaneously.
进一步简化空间管理软件的一个方法是软件保持段选择子与页目录项之间的一一对应,正如图5-13所示。每个描述符有都有一个低22位为0的基址;换句话说,基址被映射到页表的第一项中。段的限长从1到4M。依赖于限长,段被包含在1到1K个的页帧中。因此任务被限定只能有最多1K个段(对于许多应用来说是充足的),每个段最多包含4M。选择子,对应页目录项,对应页表可以同时被配置或解除配置。
【译】x86程序员手册16-5.3联合使用段与分页转换的更多相关文章
- 【译】x86程序员手册23-6.5组合页与段保护
6.5 Combining Page and Segment Protection 组合页与段保护 When paging is enabled, the 80386 first evaluates ...
- 【译】x86程序员手册01
Intel 80386 Reference Programmer's Manual 80386程序员参考手册 Chapter 1 -- Introduction to the 80386 第1章 - ...
- 【译】x86程序员手册03 - 2.1内存组织和分段
2.1 Memory Organization and Segmentation 内存组织和分段 The physical memory of an 80386 system is organized ...
- 【译】x86程序员手册14-5.1段转换
5.1 Segment Translation 段转换 Figure 5-2 shows in more detail how the processor converts a logical add ...
- 【译】x86程序员手册11- 4.1系统寄存器
4.1 Systems Registers 系统寄存器 The registers designed for use by systems programmers fall into these cl ...
- 【译】x86程序员手册09-第3章程序指令集
注:觉得本章内容与理解操作系统不直接相关,所以本章并未看完,也就没有翻译完,放在这里中是为了保证手册的完整.有兴趣的人可以去原址查看. https://pdos.csail.mit.edu/6.828 ...
- 【译】x86程序员手册00 - 翻译起因
从上一次学习MIT的操作系统课程又过去了一年.上次学习并没有坚持下去.想来虽有种种原因,其还在自身无法坚持罢了.故此次再鼓起勇气重新学习,发现课程都已由2014改版为2016了.但大部分内容并没有改变 ...
- 【译】x86程序员手册40-10.5初始化的例子
10.5 Initialization Example初始化的例子 译注:本来想把这个例子全部注释完,但由于对intel汇编实不熟悉,有太多的伪指令,本人也是免强看懂,所以就不再做翻译了. $TITL ...
- 【译】x86程序员手册38-10.2实在址模式下的软件初始化
10.2 Software Initialization for Real-Address Mode 实地址模式的软件初始化 In real-address mode a few structur ...
随机推荐
- muduo库源码剖析(一) reactor模式
一. Reactor模式简介 Reactor释义“反应堆”,是一种事件驱动机制.和普通函数调用的不同之处在于:应用程序不是主动的调用某个API完成处理,而是恰恰相反,Reactor逆置了事件处理流程, ...
- Manthan, Codefest 16 C
建trie树,刚好字符串是反向的,直接在原图上向前搜索就OK了……………… 可怜的我竟然用了RK来hash,在test67那里T了…… 贴个RK的 #include <iostream> ...
- *** + Polipo 配置全局代理(Linux 版本)
转,原文:http://blog.csdn.net/jon_me/article/details/53525059 我本来是想查这个问题: How to start server and local ...
- go语言使用官方的 log package 来记录日志
原文:https://www.goinggo.net/2013/11/using-log-package-in-go.html ------------------------------------ ...
- Java 注解入门实例 && 注解传參
參考 概念:java提供了一种原程序中的元素关联不论什么信息和不论什么元数据的途径和方法 JDK内置系统注解: @Override 用于修饰此方法覆盖了父类的方法; @Deprecated 用于修饰已 ...
- 编程规范(一 之kmalloc,fflush,fclose,char_init)
1. kmalloc函数接口: 在我们使用的时候常常使用该接口,可是我们非常少注意过这个接口的一些比較重要的 内核接口.比如: /*申请一个HASH表的大小*/ #define HASH_MALLOC ...
- android高速开发框架xUtils
xUtils简单介绍 xUtils 包括了非常多有用的android工具. xUtils 支持大文件上传,更全面的http请求协议支持(10种谓词).拥有更加灵活的ORM,很多其它的事件注解支持且不受 ...
- Android应用程序相关的文件文件夹具体解释
一.方法介绍: 每一个Android应用程序都能够通过Context来获取与应用程序相关的文件夹,这些文件夹的功能各异,每一个文件夹都有自己的特点.有时候可能会搞混淆,本文结合andr ...
- 【bzoj1207】[HNOI2004]打鼹鼠
看了数据范围,想想这不暴力可以过?? DP #include<algorithm> #include<iostream> #include<cstdlib> ...
- P1552 派遣 左偏树
左偏树就是一个应该用堆维护的区间,然后需要进行合并操作而发明的算法,其实这个算法没什么难的,和树剖有点像,维护几个数值,然后递归回来的时候就可以修改. 题干: 题目背景 在一个忍者的帮派里,一些忍者们 ...