开发者

gas: too many memory reference

开发者 https://www.devze.com 2022-12-25 01:44 出处:网络
When compiling the following instruction: movl 4(%ebp), 8(%eb开发者_开发百科p) I got: too many memory reference.

When compiling the following instruction:

movl 4(%ebp), 8(%eb开发者_开发百科p)

I got: too many memory reference.

What's wrong with it?


The number before the parenthesis is a byte offset (which causes a memory reference to occur), and you cannot have two of them with movl. You need to move the value temporarily to a register first.

movl 4(%ebp), %ecx
movl %ecx, 8(%ebp)


It is not a legal instruction. For most instructions that reference memory you must move it to/from a register.


movl doesn't to memory-memory moves, you have to go by way of a register (thus with two movl instructions).

0

精彩评论

暂无评论...
验证码 换一张
取 消