WINDOWS下的gdt和ldt http://www.vkfz.com/WINDOWS-gdt-ldt-t709032.htm

是这样的,我想问下Windows 在Intel Protection Mode下工作的问题。
在指令手册第三卷system programming 可以看到,通常GDT只有一个,而LDT可以有很多的。
本来我很天真地想:
那么我又多少个进程在running 就应该有多少个LDT才对。
于是我打开softice, 输入GDT
结构只有一个被标为LDT,参考了using softice,只看到如下一段:
Under Winnt , LDT are per process data structures and are only used for virtual dos machines.
The 16 bit WOW box is executed within a NTVDM process and has an LDT.
Like Windows 3.1 the LDT for a WOW contains the selectors for every 16 bit proteced mode code and data segment for each 16 bit application or DLL that is loaded. It also contains the selectors for each task database, module database, local heaps, global allocation, and all USER and GDI objects that require the creation of a selector. Under a WOW, because the number of selectors needed can be quite large, a full LDT is created with a majority of the entries initially reserved. These reserved selectors are allocated as needed. Under a non-WOW VDM, the size of the LDT is significant smaller.

老实说我不知道它在说什么,最后的结果就是我只能看到一个LDT.
这实在太奇怪了,请问难道windows不用LDT?

第二个奇怪的是
GDTbase=80036000 Limit=03FF
0008 Code32 Base=00000000 Lim=FFFFFFFF DPL=0 P R
0010 Data32 Base=00000000 Lim=FFFFFFFF DPL=0 P R
001B Code32 Base=00000000 Lim=FFFFFFFF DPL=3 P R
0023 Data32 Base=00000000 Lim=FFFFFFFF DPL=3 P R
0028 TSS32 Base=8000B000 Lim=000020AB DPL=0 P B
0030 Data32 Base=FFDFF000 Lim=00001FFF DPL=0 P R
003B Data32 Base=7FFDE000 Lim=00000FFF DPL=3 P R
0043 Data16 Base=00000400 Lim=0000FFFF DPL=3 P R
0048 LDT Base=E156C000 Lim=0000FFEF DPL=0 P

显然code32 data32也就是从0008-001b
这段是固定的,所谓的flat mode,可是真的不明白,
明明规定4g地址只有低2g空间是用户可以访问的。
高2G操作系统用,也就是ring0才能访问。
那么这里有两个Code32,一个是ring3(0008),一个是ring0(001B)
那么同一句汇编指令,访问32位偏移0xYYYYYYYY地址,
操作系统怎么知道是访问上面那个还是下面那个,
有两个段,这两个段根本都覆盖了4g空间,却具有不同的权限,dpl 不同,
同一个地址到底要怎么解释呢?

晕眩。

Alecksun 发表于 2007-4-14 15:44:53

Windows 的分段是个摆设,你当它不存在好了,真正的保护是在分页上处理的,低2G页表的特权级是用户的,高2G页表的特权级是系统的。至于分段,你说对了,就是给分页提供一个平坦的4G空间。同时段选择子表明了当前的特权级。

至于LDT,windows还真不用,为什么一定要用呢?一般的PC操作系统都不用,Linux也不用
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值