什么是MOV EAX,DWORD PTR DS:[ESI]的意思和它有什么作用? [英] What does MOV EAX, DWORD PTR DS:[ESI] mean and what does it do?

查看:1653
本文介绍了什么是MOV EAX,DWORD PTR DS:[ESI]的意思和它有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,让我有这条线在我的组装

Alright so I have this line in my assembly

MOV EAX, DWORD PTR DS:[ESI]

其中,ESI为 00402050 (ASCII123456789012)

where ESI is 00402050 (ascii, "123456789012")

此指令后: EAX = 34333231

什么是真正在这里发生了什么?这个值是如何计算的,为什么?结果
我在哪里可以得到这样的事情有些很好的参考?

What really happened here? How is this value calculated, and why?
Where could I get some good reference on this kind of thing?

推荐答案

寄存器在方括号,如 [ESI] 取消引用指针。指令你引用举动 DWORD ESI指定(32位/ 4字节的值)的内存位置到寄存器 EAX 。在你的情况,存储位置 00402050 ,读作 DWORD ,载 34333231

Registers in square brackets such as [ESI] are dereferenced pointers. The instruction you quote moves the DWORD (a 32-bit/4-byte value) in memory location specified by ESI into register EAX. In your case, memory location 00402050, read as a DWORD, contains 34333231.

写在伪C:

DWORD EAX;   /* Declaring the registers as we find them in silico */
DWORD ESI;

ESI = 0x00402050;  /* Set up your initial conditions for ESI */
EAX = *((DWORD *)ESI);   /* mov EAX, DWORD PTR [ESI] */
/*  ^ ^  ^^^^^^^    */
/*  | |     |       */
/*  | |     +-----------  From "DWORD PTR" we get "DWORD *" in C.          */
/*  | |             */ 
/*  | +-----------------  The C dereferencing operator * replaces [].      */
/*  |               */ 
/*  +-------------------  The C assignment operator = replaces mov opcode. */ 

在你的情况,这是不正确的 0x00402050 等于字符串1234567890 - 宁它指向其中包含字符串的内存。

In your case, it is not true that 0x00402050 "equals" the string "1234567890" -- rather it points to the memory which contains that string.

您获得的价值, 0x34333231 从ASCII值包含了数字1234,其中是字符串的第一个四字节(即第一个 DWORD )。它们出现在相反的顺序,因为英特尔架构为小尾数法中的 DWORD 在内存中的字节重新presentation。

The value which you obtain, 0x34333231 is comprised from the ASCII values for the digits "1234", which are the first four bytes (i.e., the first DWORD) of the string. They appear in reversed order because the Intel architecture is "little endian" in the byte representation of a DWORD in memory.

在这个时候您的例子中, MOV 指令加载ASCII字符,如果他们的4个字节的无符号长值,当他们实际上是单字节字符的字符串。

In your example at this time, the mov instruction is loading ASCII characters as if they were the four bytes of an unsigned long value, when they are actually a string of single-byte characters.

这篇关于什么是MOV EAX,DWORD PTR DS:[ESI]的意思和它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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