7.7 Task Address Space 任务地址空间

The LDT selector and PDBR fields of the TSS give software systems designers flexibility in utilization of segment and page mapping features of the 80386. By appropriate choice of the segment and page mappings for each task, tasks may share address spaces, may have address spaces that are largely distinct from one another, or may have any degree of sharing between these two extremes.

LDT选择子和TSS中的PDBR字段为软件系统设计者提供了更灵活的方式来利用80386关于段和页映射特性。通过为每个任务适当选择段和页映射,多任务可以共享地址空间,也可以有与其他任务很不一样的地址空间,或者二者之间的一种平衡方式。

The ability for tasks to have distinct address spaces is an important aspect of 80386 protection. A module in one task cannot interfere with a module in another task if the modules do not have access to the same address spaces. The flexible memory management features of the 80386 allow systems designers to assign areas of shared address space to those modules of different tasks that are designed to cooperate with each other.

任务有一个确切的地址空间是80386的保护中很重要的一个方面。一个任务中的模块不能干涉另一个任务的模块,只要这个模块没有权限访问相同的地址空间。80386灵活的内存管理特性允许系统设计者分配共享地址空间区域给那些位于不同任务中,却被设计成互相协作的模块。

7.7.1 Task Linear-to-Physical Space Mapping 任务的线性地址到物理地址的空间映射

The choices for arranging the linear-to-physical mappings of tasks fall into two general classes:

如何安排任务的线性地址到物理地址的映射,一般有两类:

  1. One linear-to-physical mapping shared among all tasks.

一个线性地址到物理地址的映射被所有任务共享。

When paging is not enabled, this is the only possibility. Without page tables, all linear addresses map to the same physical addresses.

当分页没有被启用,这是仅有的可能性。不使用页表,所有线性地址映射到相同的物理地址。

When paging is enabled, this style of linear-to-physical mapping results from using one page directory for all tasks. The linear space utilized may exceed the physical space available if the operating system also implements page-level virtual memory.

当分页功能被启用后,这种风格的线性地址到物理地址的映射结果就是对所有任务都使用一个页目录。如果操作系统也实现了页级的虚拟内存,则可利用的线性地址空间可以超出可用的物理地址空间。

  1. Several partially overlapping linear-to-physical mappings.

多个部分的叠加线性地址到物理地址的映射。

This style is implemented by using a different page directory for each task. Because the PDBR (page directory base register) is loaded from the TSS with each task switch, each task may have a different page directory.

这种风格是通过对每一个任务使用不同的页目录来实现的。因为PDBR(页目录基址寄存器)是从每个切换任务的TSS中装载的,每个任务都可有不同的页目录。

In theory, the linear address spaces of different tasks may map to completely distinct physical addresses. If the entries of different page directories point to different page tables and the page tables point to different pages of physical memory, then the tasks do not share any physical addresses.

理论上,不是任务的线性地址空间可以被映射到完全明确的物理地址上。因为不同页目录的项指向不同页表,页表指向不同的物理内存页,任务不用共享任何物理地址。

In practice, some portion of the linear address spaces of all tasks must map to the same physical addresses. The task state segments must lie in a common space so that the mapping of TSS addresses does not change while the processor is reading and updating the TSSs during a task switch. The linear space mapped by the GDT should also be mapped to a common physical space; otherwise, the purpose of the GDT is defeated. Figure 7-6 shows how the linear spaces of two tasks can overlap in the physical space by sharing page tables.

而实践中,所有任务中的部分线性地址空间必须被映射到相同的物理地址。任务状态段(TSS)必须位于通用空间,这样,当处理器在切换任务期间读取或更新TSS时,TSS的地址映射不被修改。GDT映射的线性地址空间也应当被映射到通用物理地址空间;否则,GDT的目的就失去了。图7-6所示,如何通过共享页表使两个任务的线性地址空间在物理地址空间上重叠。

7.7.2 Task Logical Address Space 任务的逻辑地址空间

By itself, a common linear-to-physical space mapping does not enable sharing of data among tasks. To share data, tasks must also have a common logical-to-linear space mapping; i.e., they must also have access to descriptors that point into a shared linear address space. There are three ways to create common logical-to-physical address-space mappings:

通用线性地址到物理地址空间映射自身无法在任务中间共享数据。为了共享数据,任务必须拥有通用的逻辑地址到线性地址空间的映射;也就是说,他们必须可以访问指向共享的线性地址空间的描述符。创建一个通用的逻辑地址到线性地址的空间映射有以下三种方法:

  1. Via the GDT. All tasks have access to the descriptors in the GDT. If those descriptors point into a linear-address space that is mapped to a common physical-address space for all tasks, then the tasks can share data and instructions.

通过GDT。所有任务都有权访问GDT中的描述符。对于所有任务而言,如果这些描述符指向的线性地址空间已被映射到一个通用的物理地址空间,那么任务就可以共享数据和指令。

  1. By sharing LDTs. Two or more tasks can use the same LDT if the LDT selectors in their TSSs select the same LDT segment. Those LDT-resident descriptors that point into a linear space that is mapped to a common physical space permit the tasks to share physical memory. This method of sharing is more selective than sharing by the GDT; the sharing can be limited to specific tasks. Other tasks in the system may have different LDTs that do not give them access to the shared areas.

通过共享LDT。如果在TSS中的LDT选择子都选择了一个相同的LDT段,那么二个或多个任务就可以使用相同的LDT。如果那些LDT中的描述符指向的线性地址空间已经被映射到一个通用的物理地址空间,就允许多个任务共享这些物理内存。这种共享方式比通过GDT共享的方式有更多的选择余地;共享可以限制在指定的任务中间。系统中的其他任务可以有不同的LDT,这样就可以不允许他们访问共享区域。

  1. By descriptor aliases in LDTs. It is possible for certain descriptors of different LDTs to point to the same linear address space. If that linear address space is mapped to the same physical space by the page mapping of the tasks involved, these descriptors permit the tasks to share the common space. Such descriptors are commonly called "aliases". This method of sharing is even more selective than the prior two; other descriptors in the LDTs may point to distinct linear addresses or to linear addresses that are not shared.

通过LDT中的描述符别名。让LDT中不同的描述符指向相同的线性地址空间是可能的。如果通过任务参与的页映射将线性地址空间被映射到相同的物理地址空间,这些描述符允许任务共享这些通用空间。这样的描述符被叫做“别名”。这种共享方式比前两个更加有选择余地;LDT中的其他描述符可以指向明确的线性地址或那些不共享的线性地址。

【译】x86程序员手册28-7.7任务地址空间的更多相关文章

  1. 【译】x86程序员手册01

    Intel 80386 Reference Programmer's Manual 80386程序员参考手册 Chapter 1 -- Introduction to the 80386 第1章 - ...

  2. 【译】x86程序员手册03 - 2.1内存组织和分段

    2.1 Memory Organization and Segmentation 内存组织和分段 The physical memory of an 80386 system is organized ...

  3. 【译】x86程序员手册00 - 翻译起因

    从上一次学习MIT的操作系统课程又过去了一年.上次学习并没有坚持下去.想来虽有种种原因,其还在自身无法坚持罢了.故此次再鼓起勇气重新学习,发现课程都已由2014改版为2016了.但大部分内容并没有改变 ...

  4. 【译】x86程序员手册38-10.2实在址模式下的软件初始化

    10.2 Software Initialization for Real-Address Mode   实地址模式的软件初始化 In real-address mode a few structur ...

  5. 【译】x86程序员手册09-第3章程序指令集

    注:觉得本章内容与理解操作系统不直接相关,所以本章并未看完,也就没有翻译完,放在这里中是为了保证手册的完整.有兴趣的人可以去原址查看. https://pdos.csail.mit.edu/6.828 ...

  6. 【译】x86程序员手册05 - 2.3寄存器

    2.3 Registers 寄存器 The 80386 contains a total of sixteen registers that are of interest to the applic ...

  7. 【译】x86程序员手册02 - 基本的程序模式

    Chapter 2 -- Basic Programming Model: 基本的程序模式 Introduces the models of memory organization. Defines ...

  8. 【译】x86程序员手册40-10.5初始化的例子

    10.5 Initialization Example初始化的例子 译注:本来想把这个例子全部注释完,但由于对intel汇编实不熟悉,有太多的伪指令,本人也是免强看懂,所以就不再做翻译了. $TITL ...

  9. 【译】x86程序员手册39-10.3切换到保护模式

    10.3 Switching to Protected Mode  切换到保护模式 Setting the PE bit of the MSW in CR0 causes the 80386 to b ...

  10. 【译】x86程序员手册37-第10章 初始化

    Chapter 10 Initialization 第10章 初始化 After a signal on the RESET pin, certain registers of the 80386 a ...

随机推荐

  1. 启用Mac系统读写NFTS磁盘

    从Mac OSX 10.6系统开始苹果系统已经内置对NTFS写入功能,但苹果没有公开说明,而且在默认状态下是没有开启的.SL-NTFS是一款Mac上的小工具,它可以直接为你的Mac增加NTFS的写入权 ...

  2. [Debug] Inspect and Style an Element in DevTools that Normally Disappears when Inactive

    It’s handy to inspect an element in your browser’s DevTools when you need to experiment or tweak it’ ...

  3. 【iOS开发-74】解决方式:Xcode6下利用preference保存数据,终于的plist文件在哪里?

    (1)现象:普通情况下.储存数据以一个沙盒为单位,preference数据存在在沙盒路径下Library/Preferences里面,可是Xcode6里找来找去根本什么都没有. watermark/2 ...

  4. opencv对图像进行边缘及角点检測

    opencv对图像进行边缘及角点检測 先看结果: 代码: // ConsoleApplication1_812.cpp : Defines the entry point for the consol ...

  5. ubuntu12.04安装NVIDIA显卡驱动和CUDA

    1.安装显卡驱动 vim /etc/modprobe.d/blacklist.conf #编辑该文件 blacklist nouveau #行末添加,禁用原来的显卡驱动 apt-get install ...

  6. Android学习笔记-保存数据的实现方法2-SharedPreferences

    Android下,数据的保存,前面介绍过了,把数据保存到内存以及SD卡上,这次我们就介绍一下,更为常用的采用SharedPreferences的方式来保存数据, 1,得到SharedPreferenc ...

  7. hadoop分布式安装部署具体视频教程(网盘附配好环境的CentOS虚拟机文件/hadoop配置文件)

    參考资源下载:http://pan.baidu.com/s/1ntwUij3视频安装教程:hadoop安装.flvVirtualBox虚拟机:hadoop.part1-part5.rarhadoop文 ...

  8. iOS开发——高级篇——iOS如何彻底避免数组越界

    我们先来看看有可能会出现的数组越界Crash的地方: ? 1 2 3 4 5 6 7 - (void)tableView:(UITableView *)tableView didSelectRowAt ...

  9. Linux/Android——Input系统之InputMapper 处理 (八)【转】

    本文转载自:http://blog.csdn.net/jscese/article/details/43561773 前文Linux/Android——Input系统之InputReader (七)介 ...

  10. luogu 1726 上白泽惠音

    题目大意: 给一个有向图 求一个最大的强连通分量,输出这个强连通分量里的所有元素 若两个联通分量内点数相同 则输出字典序小的那个 思路: 直接tarjan 对每个连通分量,求一下最小点,然后判断字典序 ...