LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1142|回复: 1

关于Segmentation的问题

[复制链接]
发表于 2008-1-16 11:10:38 | 显示全部楼层 |阅读模式
在看<understanding the linux kernel>。第二章从logical address到linear address的转换没太看懂,上面讲logical address包含一个16位的segment selector和一个32位的offset,加起来48位。是不是说,程序中出现地址时都要用48位来表示,但我注意到,即使是汇编代码,用的还是32位的地址。我想问的是,这个48位的地址什么时候才能用到呢?
发表于 2008-1-16 18:06:13 | 显示全部楼层
1=>Examines the TI field of the Segment Selector to determine which Descriptor Table stores the Segment Descriptor. This field indicates that the Descriptor is either in the GDT (in which case the segmentation unit gets the base linear address of the GDT from the gdtr register) or in the active LDT (in which case the segmentation unit gets the base linear address of that LDT from the ldtr register).
2=>Computes the address of the Segment Descriptor from the index field of the Segment Selector. The index field is multiplied by 8 (the size of a Segment Descriptor), and the result is added to the content of the gdtr or ldtr register.
3=>Adds the offset of the logical address to the Base field of the Segment Descriptor, thus obtaining the linear address.

以上的segment selector 和offset分别跟你说的对应!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表