Womit x86-64 Code disassemblieren?

Gast #2773855
Lesenswert?

keine Ahnung ob das etwas sinnvolles ist:

seg000:0000000000000000                 push    rbp
seg000:0000000000000001                 mov     rbp, rsp
seg000:0000000000000004                 mov     dword ptr [rbp-8], 
77DF4777h
seg000:000000000000000B                 mov     dword ptr [rbp-4], 
225FBB61h
seg000:0000000000000012                 mov     qword ptr [rbp-10h], 
1993h
seg000:000000000000001A                 mov     rax, [rbp-10h]
seg000:000000000000001E                 add     [rbp-8], rax
seg000:0000000000000022                 jmp     short loc_3F
seg000:0000000000000024 ; 
------------------------------------------------------------------------ 
---
seg000:0000000000000024
seg000:0000000000000024 loc_24:                                 ; CODE 
XREF: seg000:0000000000000044j
seg000:0000000000000024                 sub     qword ptr [rbp-8], 
6B2896A8h
seg000:000000000000002C                 mov     rax, 2232C968B04DAB36h
seg000:0000000000000036                 xor     [rbp-8], rax
seg000:000000000000003A                 sub     qword ptr [rbp-10h], 1
seg000:000000000000003F
seg000:000000000000003F loc_3F:                                 ; CODE 
XREF: seg000:0000000000000022j
seg000:000000000000003F                 cmp     qword ptr [rbp-10h], 0
seg000:0000000000000044                 jnz     short loc_24
seg000:0000000000000046                 mov     rax, [rbp-8]
seg000:000000000000004A                 leave
seg000:000000000000004B                 retn
seg000:000000000000004B seg000          ends
seg000:000000000000004B
seg000:000000000000004B
seg000:000000000000004B                 end
#2773960
Lesenswert?

see 
http://stackoverflow.com/questions/1737095/how-do-i-disassemble-raw-x86-code
1
 objdump -D -b binary -mi386 function.bin
2

3
function.bin:     file format binary
4

5

6
Disassembly of section .data:
7

8
00000000 <.data>:
9
   0:  55                     push   %ebp
10
   1:  48                     dec    %eax
11
   2:  89 e5                  mov    %esp,%ebp
12
   4:  c7 45 f8 77 47 df 77   movl   $0x77df4777,-0x8(%ebp)
13
   b:  c7 45 fc 61 bb 5f 22   movl   $0x225fbb61,-0x4(%ebp)
14
  12:  48                     dec    %eax
15
  13:  c7 45 f0 93 19 00 00   movl   $0x1993,-0x10(%ebp)
16
  1a:  48                     dec    %eax
17
  1b:  8b 45 f0               mov    -0x10(%ebp),%eax
18
  1e:  48                     dec    %eax
19
  1f:  01 45 f8               add    %eax,-0x8(%ebp)
20
  22:  eb 1b                  jmp    0x3f
21
  24:  48                     dec    %eax
22
  25:  81 6d f8 a8 96 28 6b   subl   $0x6b2896a8,-0x8(%ebp)
23
  2c:  48                     dec    %eax
24
  2d:  b8 36 ab 4d b0         mov    $0xb04dab36,%eax
25
  32:  68 c9 32 22 48         push   $0x482232c9
26
  37:  31 45 f8               xor    %eax,-0x8(%ebp)
27
  3a:  48                     dec    %eax
28
  3b:  83 6d f0 01            subl   $0x1,-0x10(%ebp)
29
  3f:  48                     dec    %eax
30
  40:  83 7d f0 00            cmpl   $0x0,-0x10(%ebp)
31
  44:  75 de                  jne    0x24
32
  46:  48                     dec    %eax
33
  47:  8b 45 f8               mov    -0x8(%ebp),%eax
34
  4a:  c9                     leave  
35
  4b:  c3                     ret
Gast #2773982
Lesenswert?

Es soll sich wie gesagt um x86-64 Instruktionen handeln.

Wenn ich Folgendes versuche:

objdump -D -b binary -mi386 --disassembler-options=x86-64 function.bin

dann erhalte ich:

function.bin:     file format binary


Disassembly of section .data:

00000000 <.data>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   c7 45 f8 77 47 df 77    movl   $0x77df4777,-0x8(%rbp)
   b:   c7 45 fc 61 bb 5f 22    movl   $0x225fbb61,-0x4(%rbp)
  12:   48 c7 45 f0 93 19 00    movq   $0x1993,-0x10(%rbp)
  19:   00
  1a:   48 8b 45 f0             mov    -0x10(%rbp),%rax
  1e:   48 01 45 f8             add    %rax,-0x8(%rbp)
  22:   eb 1b                   jmp    0x3f
  24:   48 81 6d f8 a8 96 28    subq   $0x6b2896a8,-0x8(%rbp)
  2b:   6b
  2c:
This application has requested the Runtime to terminate it in an unusual 
way.
Please contact the application's support team for more information.
#2774006
Lesenswert?

objdump -D -b binary -mi386:x86-64 function.bin funktioniert hier mit
1
sb@sb:~/downloads$ objdump -D -b binary -mi386:x86-64 function.bin 
2

3
function.bin:     file format binary
4

5

6
Disassembly of section .data:
7

8
0000000000000000 <.data>:
9
   0:  55                     push   %rbp
10
   1:  48 89 e5               mov    %rsp,%rbp
11
   4:  c7 45 f8 77 47 df 77   movl   $0x77df4777,-0x8(%rbp)
12
   b:  c7 45 fc 61 bb 5f 22   movl   $0x225fbb61,-0x4(%rbp)
13
  12:  48 c7 45 f0 93 19 00   movq   $0x1993,-0x10(%rbp)
14
  19:  00 
15
  1a:  48 8b 45 f0            mov    -0x10(%rbp),%rax
16
  1e:  48 01 45 f8            add    %rax,-0x8(%rbp)
17
  22:  eb 1b                  jmp    0x3f
18
  24:  48 81 6d f8 a8 96 28   subq   $0x6b2896a8,-0x8(%rbp)
19
  2b:  6b 
20
  2c:  48 b8 36 ab 4d b0 68   movabs $0x2232c968b04dab36,%rax
21
  33:  c9 32 22 
22
  36:  48 31 45 f8            xor    %rax,-0x8(%rbp)
23
  3a:  48 83 6d f0 01         subq   $0x1,-0x10(%rbp)
24
  3f:  48 83 7d f0 00         cmpq   $0x0,-0x10(%rbp)
25
  44:  75 de                  jne    0x24
26
  46:  48 8b 45 f8            mov    -0x8(%rbp),%rax
27
  4a:  c9                     leaveq 
28
  4b:  c3                     retq   
29
sb@sb:~/downloads$ objdump --version
30
GNU objdump (GNU Binutils for Ubuntu) 2.22
31
Copyright 2011 Free Software Foundation, Inc.
32
This program is free software; you may redistribute it under the terms of
33
the GNU General Public License version 3 or (at your option) any later version.
34
This program has absolutely no warranty.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren