DS, ES, SS, DI, SI, BP, SP, IP, FS 寄存器

DS is called data segment register. It points to the segment of the data used by the running program. You can point this to anywhere you want as long as it contains the desired data.

DS叫做段寄存器, 指向当前运行着的程序的数据段. 你可以把它指向任何你想要的地方, 只要那个地方有你想要的数据.

 

ES is called extra segment register. It is usually used with DI and doing pointers things. The couple DS:SI and ES:DI are commonly used to do string operations.

ES叫做额外的段寄存器. 它通常跟DI一起用来做指针使用. DS:SI和ES:DI配对时通常用来执行一些字符串操作.

 

SS is called stack segment register. It points to stack segment.

SS叫做栈段寄存器, 它指向栈段. 

The register SI and DI are called index registers. These registers are usually used to process arrays or strings.

SI和DI两个寄存器叫做索引寄存器, 这两个寄存器通常用来处理数组或字符串.

 

SI is called source index and DI is destination index. As the name follows, SI is always pointed to the source array and DI is always pointed to the destination. This is usually used to move a block of data, such as records (or structures) and arrays. These register is commonly coupled with DS and ES. 
SI叫做源索引寄存器, DI叫做目的索引寄存器. 正如它们的命名, SI通常指向源数组, DI通常指向目的数组. 他们通常被用来成块地移动数据, 比如移动数组或结构体. SI和DI通常和DS和ES一起使用.

 

The register BP, SP, and IP are called pointer registers.

BP, SP, 和IP叫做指针寄存器.

 

BP is base pointer, SP is stack pointer, and IP is instruction pointer. Usually BP is used for preserving space to use local variables.

BP是基指针, SP是栈指针, IP是指令指针. 通常BP用来保存使用局部变量的地址.

 

SP is used to point the current stack. Although SP can be modified easily, you must be cautious. It's because doing the wrong thing with this register could cause your program in ruin.

SP用来指向当前的栈. 尽管SP可以被很容易地修改, 你还是一定要非常小心. 因为如果这个寄存器搞错了, 你的程序就毁了.

 

IP denotes the current pointer of the running program. It is always coupled with CS and it is NOT modifiable.

IP用来指示当前运行程序的当前指针. 通常和CS一起使用, IP是不允许修改的.

 

So, the couple of CS:IP is a pointer pointing to the current instruction of running program. You can NOT access CS nor IP directly.

所以, CS:IP配对用来指示当前运行的指令地址. 你不能直接访问CS, 也不能直接访问IP.

 

FS和GS寄存器是从386开始才有的. FS主要用来指向Thread Information Block(TIB).

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在x86架构的汇编语言中,要加载段寄存器SSDSESFS和GS)的描述符选择器,可以使用指令`MOV`或`LDS`。 1. 使用`MOV`指令加载描述符选择器: ```assembly MOV AX, selector ; 将描述符选择器加载到 AX 寄存器 MOV DS, AX ; 将 AX 中的值加载到 DS 寄存器 ``` 在这里,`selector`是描述符选择器的值,可以是一个立即数或一个存储在内存中的值。首先,将描述符选择器加载到通用寄存器(例如AX)中,然后将该寄存器的值移动到相应的段寄存器(例如DS)中。 2. 使用`LDS`指令加载描述符选择器: ```assembly LDS BX, descriptor ; 将描述符加载到 BX 寄存器 ``` 这里的`descriptor`是一个有效的内存地址,它指向一个包含两个字(16位)的数据项。第一个字是段选择子(描述符选择器),第二个字是段的偏移地址。`LDS`指令将两个字分别加载到BX和DS寄存器中,其中段选择子加载到DS寄存器。 需要注意的是,加载描述符选择器之前,必须先设置好段寄存器所在的段。例如,如果要加载DS寄存器的描述符选择器,必须先设置好CS寄存器的段,因为CS寄存器的段会用于访问指令。同样的道理,如果要加载SS寄存器的描述符选择器,必须先设置好SS寄存器的段,因为SS寄存器用于堆栈操作。 在实际的汇编程序中,具体的操作会根据程序的需求和上下文而有所不同。以上提供的示例代码只是展示了如何使用`MOV`和`LDS`指令加载段寄存器的描述符选择器。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值