0x4在"movl $ 0x2d,0x4(%esp)"中做什么? [英] What does 0x4 do in "movl $0x2d, 0x4(%esp)"?

查看:716
本文介绍了0x4在"movl $ 0x2d,0x4(%esp)"中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究由GCC生成的汇编代码.但是我不明白:

I am looking into assembly code generated by GCC. But I don't understand:

movl $0x2d, 0x4(%esp)

在第二个操作数中,0x4代表什么?偏移地址?以及EAX寄存器的用途是什么?

In the second operand, what does 0x4 stands for? offset address? And what the use of register EAX?

推荐答案

movl $0x2d, 0x4(%esp)表示采用栈指针(%esp)的当前值,加4(0x4),然后存储long(32-位)值0x2d移到该位置.

movl $0x2d, 0x4(%esp) means to take the current value of the stack pointer (%esp), add 4 (0x4) then store the long (32-bit) value 0x2d into that location.

eax寄存器是通用32位寄存器之一. x86体系结构指定以下32位寄存器:

The eax register is one of the general purpose 32-bit registers. x86 architecture specifies the following 32-bit registers:

eax  Accumulator Register
ebx  Base Register
ecx  Counter Register
edx  Data Register
esi  Source Index
edi  Destination Index
ebp  Base Pointer
esp  Stack Pointer

以及其中一些的名称和用途可以追溯到Intel 8080的时代.

and the names and purposes of some of then harken back to the days of the Intel 8080.

此页面很好地概述了Intel类型的寄存器.上面列表中的前四个也可以作为16位或两个8位值进行访问.例如:

This page gives a good overview on the Intel-type registers. The first four of those in the above list can also be accessed as a 16-bit or two 8-bit values as well. For example:

3322222222221111111111
10987654321098765432109876543210
<-             eax            ->
                <-     ax     ->
                <- ah -><- al ->

指针和索引寄存器不允许使用8位部分,但是您可以使用16位bp.

The pointer and index registers do not allow use of 8-bit parts but you can have, for example, the 16-bit bp.

这篇关于0x4在"movl $ 0x2d,0x4(%esp)"中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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