zoukankan      html  css  js  c++  java
  • 【译】x86程序员手册28-7.7任务地址空间

    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中的其他描述符可以指向明确的线性地址或那些不共享的线性地址。

  • 相关阅读:
    V2EX 上收藏Top200
    在heroku上部署gost代理服务端
    nano编辑器使用教程
    Amazon EC2免费VPS防止超额被扣钱三大方法:流量 硬盘读写 运行时长
    Go语言开发环境配置
    HTML5 and CSS3 开发
    使用 Eclipse PhoneGap 构建 Android 应用程序入门
    脚本之家
    CSS网页布局全精通
    使用面向 iOS 的本机插件扩展 PhoneGap
  • 原文地址:https://www.cnblogs.com/mqmelon/p/6692683.html
Copyright © 2011-2022 走看看