What does 0x4 do in “movl $0x2d, 0x4(%esp)”?

后端 未结 5 2174
一个人的身影
一个人的身影 2021-02-20 16:46

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

movl $0x2d, 0x4(%esp)

In the second operand, what does 0x4

5条回答
  •  盖世英雄少女心
    2021-02-20 16:57

    0x4 in the second operand is an offset from the value of the register in the parens. EAX is a general purpose register used for assembly coding (computations, storing temporary values, etc.) formally it's called "Accumulator register" but that's more historic than relevant.

    You can read this page about the x86 architecture. Most relevant to your question are the sections on Addressing modes and General purpose registers

提交回复
热议问题