什么是段寄存器在x86保护模式的目的是什么? [英] What is the purpose of segment registers in x86 protected mode?

查看:224
本文介绍了什么是段寄存器在x86保护模式的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要修改一些DLL,但我不知道,是什么呢excatly段寄存器( DS SS ,...)在保护模式。我在大约16真正的位模式,其中段由16乘法寄存器加上正常偏移寄存器给出了物理内存的有效地址学校里学到的。在保护模式下,有一些平面内存模式,虚拟内存,每个进程有4GB内存,所以如果寄存器具有32位的,那么我只能通过抵消寄存器地址的虚拟内存的每个字节。因此,这puproses在保护模式下段寄存器,例如:

I need to modify some dll, but i don't know, what excatly does segment registers (DS, SS, ...) in protected mode. I learned in school about real 16-bit mode, where segment registers multiply by 16 plus offset in normal register gives effective address in physical memory. In protected mode, there is some flat memory model and virtual memory, where each process "has" 4GB memory, so if registers have 32-bit, then i can address each byte of virtual memory only by "offset" register. So which puproses have segment registers in protected mode, for example

mov eax, dword ptr ds:[20037DA0] 


推荐答案

Basicaly目的是相同的,只是他们的工作是稍微不同的方式实模式。 DS在你的例子在你的GDT选择一个内存描述符(谷歌这个词,如果你真的想明白这一点,环球描述符表),其中包括像基址,结束地址,粒度等信息您的偏移,然后加入到基址, 结束。如果你使用的是Windows(我敢打赌,在Linux上的一样)你不generaly担心这些段寄存器,如你所说的平面模型,这意味着应该有所有的记忆只有一个描述符,所以如果你不改变这些寄存器它应该工作,如果他们连的werent存在。

Basicaly the purpose is the same as in real mode except the way they work is slightly different. DS in your example selects one memory descriptor in your GDT(google this term if you really wanna understand this, "Global descriptor table") which contains information like base address, end address, granularity etc. Your offset is then added to the base address, the end. If you are on windows (i bet on linux its the same) you dont generaly have to worry about these segment registers, as you said its flat model, that means there should be only one descriptor for all the memory, so if you dont change these registers it should work as if they werent even existing.

这篇关于什么是段寄存器在x86保护模式的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆