jmp 位移地址的計算方法

來源:互聯網
上載者:User

E9的jmp距離計算:距離=目的地址-(當前地址+5)(加5是因為JMP命令共佔5個字,實際是目的地址減去JMP命令的尾地址,即當前地址+5
如目標地址為 f1e0b63e
當前地址為   8093c6d8
距離=f1e0b63e -8093c6d8-5=714cef61
jmp為
當前地址 當前編碼                        彙編指令
8093c6d8 e961ef4c71(按字倒著寫)  jmp f1e0b63e

用C++編碼

  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4. int _tmain(int argc, _TCHAR* argv[])
  5. {
  6.  unsigned long a=0xf1e0b63e;
  7.  unsigned long b=0x8093c6d8;
  8.  unsigned c=a-b-5;
  9.  int d[4];
  10.  for(int i=0;i<4;i++)
  11.  {
  12.   d[i]=0;
  13.   d[i]+=c%16;
  14.   c=c/16;
  15.   d[i]+=c%16*16;
  16.   c=c/16;
  17.   cout<<hex<<d[i]<<'/n';
  18.  }
  19.  return 0;
  20. }
  21. //E9 d[0] d[1] d[2] d[3]就是e961ef4c71

如果目的地址小於當前地址,則距離=目的地址-5

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.