Transformation of based indexed mode into indirect addressing mode (x86 assembly)

后端 未结 2 411
孤街浪徒
孤街浪徒 2021-01-24 21:20

I\'m corrently working on changing examples from complex indirect addresssing mode into simple indirect addressing mode pieces. However, I\'ve come across an example from the B

2条回答
  •  迷失自我
    2021-01-24 21:56

    Example 1:

    This:

    addl    $28, %esp
    movl    (%eax), %esp
    

    doesn't do the same thing as move %eax, 28(%esp). What you're looking for is something like:

    addl    $28, %esp
    movl    %eax, (%esp)
    

    But note that your version modifies the value of esp, while the original instruction does not.


    Example 2:

    Again, this:

    addl    $28, %esp
    cmpl    $4, %esp
    

    doesn't do the same thing as cmpl $4, 28(%esp). The original instruction compares the 32-bit value in memory at address esp+28 with the value 4. Your version compares the value esp+28 with the value 4 (i.e. there's no memory access).

提交回复
热议问题