[英]Confused how to read assembly instruction
我有一些關於閱讀匯編指令的問題。 我知道基本的指令語法,但是當某些寄存器在其前面帶有某個地址時,或者問題使用任何奇怪的指令時,它會變得混亂。 是否有任何易於理解的組裝說明參考集?
例如,我有一個問題要閱讀這些說明:
0x401050 <what>: push %ebp
0x401051 <what+1>: mov %esp,%ebp
0x401053 <what+3>: sub $0xc,%esp
0x401056 <what+6>: mov 0x8(%ebp),%eax
0x401059 <what+9>: add $0x4,%eax
0x40105c <what+12>: mov %eax,0xfffffffc(%ebp)
0x40105f <what+15>: mov 0x8(%ebp),%eax
0x401062 <what+18>: imul 0xc(%ebp),%eax
0x401066 <what+22>: mov %eax,0xfffffff8(%ebp)
0x401069 <what+25>: mov 0xc(%ebp),%edx
0x40106c <what+28>: mov 0x8(%ebp),%eax
0x40106f <what+31>: sub %edx,%eax
0x401071 <what+33>: mov %eax,0xfffffff4(%ebp)
0x401074 <what+36>: mov 0xfffffff8(%ebp),%eax
0x401077 <what+39>: add 0xfffffffc(%ebp),%eax
0x40107a <what+42>: add 0xfffffff4(%ebp),%eax
0x40107d <what+45>: leave
0x40107e <what+46>: ret
0x401089 <main>: push %ebp
0x40108a <main+1>: mov %esp,%ebp
0x40108c <main+3>: sub $0x18,%esp
0x40108f <main+6>: and $0xfffffff0,%esp
0x401092 <main+9>: mov $0x0,%eax
0x401097 <main+14>: mov %eax,0xfffffff0(%ebp)
0x40109a <main+17>: mov 0xfffffff0(%ebp),%eax
0x40109d <main+20>: call 0x401420 <_alloca>
0x4010a2 <main+25>: call 0x4014b0 <__main>
0x4010a7 <main+30>: mov 0xc(%ebp),%eax
0x4010aa <main+33>: add $0x4,%eax
0x4010ad <main+36>: mov (%eax),%eax
0x4010af <main+38>: mov %eax,(%esp)
0x4010b2 <main+41>: call 0x4014d0 <atoi>
0x4010b7 <main+46>: mov %eax,0xfffffffc(%ebp)
0x4010ba <main+49>: mov 0xc(%ebp),%eax
0x4010bd <main+52>: add $0x8,%eax
0x4010c0 <main+55>: mov (%eax),%eax
0x4010c2 <main+57>: mov %eax,(%esp)
0x4010c5 <main+60>: call 0x4014d0 <atoi>
0x4010ca <main+65>: mov %eax,0xfffffff8(%ebp)
0x4010cd <main+68>: mov 0xfffffff8(%ebp),%eax
0x4010d0 <main+71>: inc %eax
0x4010d1 <main+72>: mov %eax,0x4(%esp)
0x4010d5 <main+76>: mov 0xfffffffc(%ebp),%eax
0x4010d8 <main+79>: add $0x2,%eax
0x4010db <main+82>: mov %eax,(%esp)
0x4010de <main+85>: call 0x401050 <what>
0x4010e3 <main+90>: mov %eax,0xfffffff4(%ebp)
0x4010e6 <main+93>: mov 0xfffffff4(%ebp),%eax
0x4010e9 <main+96>: mov %eax,0x4(%esp)
0x4010ed <main+100>: movl $0x40107f,(%esp)
0x4010f4 <main+107>: call 0x4014c0 <printf>
0x4010f9 <main+112>: mov $0x0,%eax
0x4010fe <main+117>: leave
0x4010ff <main+118>: ret
問題是:
該程序是從命令行調用的,如下所示: ./program 5 7 該過程命名為從 main 調用的內容,具有以下參數:
1) 6, 8
2) 7, 8
3) 5, 7
4) 7, 5
該過程命名了從 main 調用的內容,並返回到 main 的值:
1) 11
2) 24
3) 42
4) 66
誰能指導我本示例中的說明如何工作? 任何建議或幫助將不勝感激。 謝謝。
您應該嘗試將該二進制文件加載到 IDA 中。 IDA 使您可以更好地了解結構,並且更容易理解您要問的是什么(除了閱讀說明)。
編輯: https : //www.hex-rays.com/products/ida/
這是針對二進制文件的,如果它符合您的需求,上面的頁面上也有該軟件的免費版本。 您也可以使用演示版來完成您的工作。 我使用 IDA Pro(演示版)查看和編輯 iOS 應用程序二進制文件。
對於下面的評論,您是 Stack Exchange 中最糟糕的事情 - 因此這是我最后一次嘗試提供幫助。 是的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.