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. Project Perfect让Swift在server端跑起来-Perfect in Visual Studio Code (四)

    编者语 : 本系列文章已经被Perfect官方引用了,这样的感觉非常好.感恩!Thx all ! Visual Studio Code是一个轻量级的编辑器,但也功能丰富,通过插件你能够完毕如Cordo ...

  2. CCNP路由实验之八 路由重公布

     CCNP路由实验之八 路由重公布 在前面几个实验,已经学习了静态路由和动态路由.如今,我们要掌握怎样使它们在一个网络中融合,即路由重公布. 使用出站口作为静态路由 0 使用下一跳地址作为静态路由 ...

  3. php生成二维码2

    <?php include "phpqrcode.php"; $value = "http://huizhongda.taobao.com/"; $err ...

  4. js的调用函数前先执行某语句问题

    js的调用函数前先执行某语句问题 标签: web前端面试 2015-09-29 17:48 1455人阅读 评论(0) 收藏 举报  分类: js(5)  版权声明:本文为博主原创文章,未经博主允许不 ...

  5. Cocos2d-x3.1下 Android,APK自己主动升级

    项目要做Android的自己主动升级,对于我们之前做iOS的转Cocos开发做Android方面的功能..... 不正确说了.这里记录下我的实现过程. 原文地址:http://blog.csdn.ne ...

  6. Codevs 1744 格子染色==BZOJ 1296 粉刷匠

    1744 格子染色  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解  查看运行结果     题目描述 Description 有 n 条木板需要被粉 ...

  7. android studio 使用

    java5-7适用android,java8对安卓支持不好. mac osx 需要安装jdk8, google Nexus模拟器, Intellij是JetBrains发布的. Intellij有2个 ...

  8. 【HDU 1588】 Gauss Fibonacci

    [题目链接] 点击打开链接 [算法] 要求 f(g(0)) + f(g(1)) + f(g(2)) + ... + f(g(n-1)) 因为g(i) = k * i + b 所以原式 = f(b) + ...

  9. 830C

    分块+二分 这道题思路很巧妙 我们大概可以推出一个式子sigma(d-[(ai-1)%d+1])<=k,要求求出d的最大值 然后我们化简一下,sigma(d-[(ai-1)-[(ai-1)/d] ...

  10. ssh使用秘钥文件连接提示WARNING: UNPROTECTED PRIVATE KEY FILE!(转载)

    转自:http://www.01happy.com/ssh-unprotected-private-key-file/ 在centos 6.4下使用ssh连接远程主机时,用的是另外一个密钥,需要用-i ...