zoukankan      html  css  js  c++  java
  • 《深入理解Linux内核》阅读笔记 --- Chapter 2 Memory Addressing

    1、logical address = segment identifier (16bits) + offset (32bits)

    segment selector其实就是GDT或者LDT的索引,其中的TI字段用来确定是选择GDT还是IDT

    2、segment identifier is called segment selector, and in order to retrieve it quickly,  the process provides segmentation registers whose only purpose is to hold segment selectors,like cs, ss, ds, es, fs and gs.

    3、The cs register has another import function: it includes a 2-bit field that specifies the Current Privilege Level (CPL) of the CPU.

    4、Each segment is represented by an 8-byte Segment Descriptor that describes the segment characteristics.

    Global Descriptor Table(GDT) or Local Descriptor Table(LDT) is used to store them.

    5、There are several types of segments and thus several types of Segment Descriptors:

    Code Segment Descriptor, Data Segment Descriptor, Task State Segment Descriptor(TSSD), Local Descriptor Table Descriptor(LDTD)

    6、TSSD is a segment used to save contents of the processor registers, it can appear only in the GDT

    7、The first entry of the GDT is always 0. This ensures that logical addresses with a null segment selector will be considered invalid, thus causing a processor exception.

    8、Whenever the CPL is changed, some segmentation registers must be correspondingly updated.For instance, when the CPL is equal to 3(User Mode), the ds register must contain the segment selector of the user data segment, but when the CPL is equal to 0, the ds register must contain the segment selector of the kernel data segment

    9、In uniprocessor systems there is only one GDT, while in multiprocessor systems there is one GDT for every CPU in the system.All GDTs are stored in the cpu_gdt_table array, while the addresses and sizes of the GDTs are stored in the cpu_gdt_descr

    10、A Task State Segment (TSS), different for each processor in the system.The linear address space corresponding to a TSS is a small subset of the linear address space corresponding to the kernel data segment.

    Process in user mode are not allowed to access TSS segments.

    11、When a processor starts executing a process having a custom LDT, the LDT entry in the CPU-specified copy of the GDT is changed accordingly.

  • 相关阅读:
    IOS编程之通讯录
    和iPhone有关的视图控制器:UIViewController、UITabBarController、UINavigationController及其混合用法
    跟大家分享下今天所学到的PHP,虽然很基础,但是感觉也很重要
    直接拿来用!最火的iOS开源项目
    ios各种手势,很有意思
    IOS中Json解析的四种方法
    [iOS]深入浅出 iOS 之多线程 NSThread
    IOS应用程序升级
    ios学习笔记之block在ios开发中的应用
    【热门收藏】iOS开发人员必看的精品资料(100个)——下载目录
  • 原文地址:https://www.cnblogs.com/YaoDD/p/6306253.html
Copyright © 2011-2022 走看看