28.2不正确的反汇编代码的特点

可以很容易发现它们的共同特点是:

很少出现大尺寸的指令,最常见的有x86指令的push,mov,call。 但是我们可以看到这些指令来自各个不同的指令组,有FPU指令,IN/OUT指令,少数的系统指令,一切都是因为反汇编器从一个错误的位置上开始反汇编机器码给搞砸了。 偏移量和立即数都是一些随机值,而且数值较大。 跳转到不正确的偏移地址常常会跳转到另一个指令的中间。 代码清单28.1:x86架构不正确的反汇编代码示例

  1. mov bl, 0Ch
  2. mov ecx, 0D38558Dh
  3. mov eax, ds:2C869A86h
  4. db 67h
  5. mov dl, 0CCh
  6. insb
  7. movsb
  8. push eax
  9. xor [edx-53h], ah
  10. fcom qword ptr [edi-45A0EF72h]
  11. pop esp
  12. pop ss
  13. in eax, dx
  14. dec ebx
  15. push esp
  16. lds esp, [esi-41h]
  17. retf
  18. rcl dword ptr [eax], cl
  19. mov cl, 9Ch
  20. mov ch, 0DFh
  21. push cs
  22. insb
  23. mov esi, 0D9C65E4Dh
  24. imul ebp, [ecx], 66h
  25. pushf
  26. sal dword ptr [ebp-64h], cl
  27. sub eax, 0AC433D64h
  28. out 8Ch, eax
  29. pop ss
  30. sbb [eax], ebx
  31. aas
  32. xchg cl, [ebx+ebx*4+14B31Eh]
  33. jecxz short near ptr loc_58+1
  34. xor al, 0C6h
  35. inc edx
  36. db 36h
  37. pusha
  38. stosb
  39. test [ebx], ebx
  40. sub al, 0D3h ; 'L'
  41. pop eax
  42. stosb
  43. loc_58: ; CODE XREF: seg000:0000004A
  44. test [esi], eax
  45. inc ebp
  46. das
  47. db 64h
  48. pop ecx
  49. das
  50. hlt
  51. pop edx
  52. out 0B0h, al
  53. lodsb
  54. push ebx
  55. cdq
  56. out dx, al
  57. sub al, 0Ah
  58. sti
  59. outsd
  60. add dword ptr [edx], 96FCBE4Bh
  61. and eax, 0E537EE4Fh
  62. inc esp
  63. stosd
  64. cdq
  65. push ecx
  66. in al, 0CBh
  67. mov ds:0D114C45Ch, al
  68. mov esi, 659D1985h
  69. enter 6FE8h, 0D9h
  70. enter 6FE6h, 0D9h
  71. xchg eax, esi
  72. sub eax, 0A599866Eh
  73. retn
  74. pop eax
  75. dec eax
  76. adc al, 21h ; '!'
  77. lahf
  78. inc edi
  79. sub eax, 9062EE5Bh
  80. bound eax, [ebx]
  81. loc_A2: ; CODE XREF: seg000:00000120
  82. wait
  83. iret
  84. jnb short loc_D7
  85. cmpsd
  86. iret
  87. jnb short loc_D7
  88. sub ebx, [ecx]
  89. in al, 0Ch
  90. add esp, esp
  91. mov bl, 8Fh
  92. xchg eax, ecx
  93. int 67h
  94. pop ds
  95. pop ebx
  96. db 36h
  97. xor esi, [ebp-4Ah]
  98. mov ebx, 0EB4F980Ch
  99. repne add bl, dh
  100. imul ebx, [ebp+5616E7A5h], 67A4D1EEh
  101. xchg eax, ebp
  102. scasb
  103. push esp
  104. wait
  105. mov dl, 11h
  106. mov ah, 29h ; ')'
  107. fist dword ptr [edx]
  108. loc_D7: ; CODE XREF: seg000:000000A4
  109. ; seg000:000000A8 ...
  110. dec dword ptr [ebp-5D0E0BA4h]
  111. call near ptr 622FEE3Eh
  112. sbb ax, 5A2Fh
  113. jmp dword ptr cs:[ebx]
  114. xor ch, [edx-5]
  115. inc esp
  116. push edi
  117. xor esp, [ebx-6779D3B8h]
  118. pop eax
  119. int 3 ; Trap to Debugger
  120. rcl byte ptr [ebx-3Eh], cl
  121. xor [edi], bl
  122. sbb al, [edx+ecx*4]
  123. xor ah, [ecx-1DA4E05Dh]
  124. push edi
  125. xor ah, cl
  126. popa
  127. cmp dword ptr [edx-62h], 46h ; 'F'
  128. dec eax
  129. in al, 69h
  130. dec ebx
  131. iret
  132. or al, 6
  133. jns short near ptr loc_D7+3
  134. shl byte ptr [esi], 42h
  135. repne adc [ebx+2Ch], eax
  136. icebp
  137. cmpsd
  138. leave
  139. push esi
  140. jmp short loc_A2
  141. and eax, 0F2E41FE9h
  142. push esi
  143. loop loc_14F
  144. add ah, fs:[edx]
  145. loc_12D: ; CODE XREF: seg000:00000169
  146. mov dh, 0F7h
  147. add [ebx+7B61D47Eh], esp
  148. mov edi, 79F19525h
  149. rcl byte ptr [eax+22015F55h], cl
  150. cli
  151. sub al, 0D2h ; 'T'
  152. dec eax
  153. mov ds:0A81406F5h, eax
  154. sbb eax, 0A7AA179Ah
  155. in eax, dx
  156. loc_14F: ; CODE XREF: seg000:00000128
  157. and [ebx-4CDFAC74h], ah
  158. pop ecx
  159. push esi
  160. mov bl, 2Dh ; '-'
  161. in eax, 2Ch
  162. stosd
  163. inc edi
  164. push esp
  165. locret_15E: ; CODE XREF: seg000:loc_1A0
  166. retn 0C432h
  167. and al, 86h
  168. cwde
  169. and al, 8Fh
  170. cmp ebp, [ebp+7]
  171. jz short loc_12D
  172. sub bh, ch
  173. or dword ptr [edi-7Bh], 8A16C0F7h
  174. db 65h
  175. insd
  176. mov al, ds:0A3A5173Dh
  177. dec ecx
  178. push ds
  179. xor al, cl
  180. jg short loc_195
  181. push 6Eh ; 'n'
  182. out 0DDh, al
  183. inc edi
  184. sub eax, 6899BBF1h
  185. leave
  186. rcr dword ptr [ecx-69h], cl
  187. sbb ch, [edi+5EDDCB54h]
  188. loc_195: ; CODE XREF: seg000:0000017F
  189. push es
  190. repne sub ah, [eax-105FF22Dh]
  191. cmc
  192. and ch, al
  193. loc_1A0: ; CODE XREF: seg000:00000217
  194. jnp short near ptr locret_15E+1
  195. or ch, [eax-66h]
  196. add [edi+edx-35h], esi
  197. out dx, al
  198. db 2Eh
  199. call far ptr 1AAh:6832F5DDh
  200. jz short near ptr loc_1DA+1
  201. sbb esp, [edi+2CB02CEFh]
  202. xchg eax, edi
  203. xor [ebx-766342ABh], edx
  204. loc_1C1: ; CODE XREF: seg000:00000212
  205. cmp eax, 1BE9080h
  206. add [ecx], edi
  207. aad 0
  208. imul esp, [edx-70h], 0A8990126h
  209. or dword ptr [edx+10C33693h], 4Bh
  210. popf
  211. loc_1DA: ; CODE XREF: seg000:000001B2
  212. mov ecx, cs
  213. aaa
  214. mov al, 39h ; '9'
  215. adc byte ptr [eax-77F7F1C5h], 0C7h
  216. add [ecx], bl
  217. retn 0DD42h
  218. db 3Eh
  219. mov fs:[edi], edi
  220. and [ebx-24h], esp
  221. db 64h
  222. xchg eax, ebp
  223. push cs
  224. adc eax, [edi+36h]
  225. mov bh, 0C7h
  226. sub eax, 0A710CBE7h
  227. xchg eax, ecx
  228. or eax, 51836E42h
  229. xchg eax, ebx
  230. inc ecx
  231. jb short near ptr loc_21E+3
  232. db 64h
  233. xchg eax, esp
  234. and dh, [eax-31h]
  235. mov ch, 13h
  236. add ebx, edx
  237. jnb short loc_1C1
  238. db 65h
  239. adc al, 0C5h
  240. js short loc_1A0
  241. sbb eax, 887F5BEEh
  242. loc_21E: ; CODE XREF: seg000:00000207
  243. mov eax, 888E1FD6h
  244. mov bl, 90h
  245. cmp [eax], ecx
  246. rep int 61h ; reserved for user interrupt
  247. and edx, [esi-7EB5C9EAh]
  248. fisttp qword ptr [eax+esi*4+38F9BA6h]
  249. jmp short loc_27C
  250. fadd st, st(2)
  251. db 3Eh
  252. mov edx, 54C03172h
  253. retn
  254. db 64h
  255. pop ds
  256. xchg eax, esi
  257. rcr ebx, cl
  258. cmp [di+2Eh], ebx
  259. repne xor [di-19h], dh
  260. insd
  261. adc dl, [eax-0C4579F7h]
  262. push ss
  263. xor [ecx+edx*4+65h], ecx
  264. mov cl, [ecx+ebx-32E8AC51h]
  265. or [ebx], ebp
  266. cmpsb
  267. lodsb
  268. iret

代码清单28.2:x86_64架构不正确的反汇编代码示例

  1. lea esi, [rax+rdx*4+43558D29h]
  2. loc_AF3: ; CODE XREF: seg000:0000000000000B46
  3. rcl byte ptr [rsi+rax*8+29BB423Ah], 1
  4. lea ecx, cs:0FFFFFFFFB2A6780Fh
  5. mov al, 96h
  6. mov ah, 0CEh
  7. push rsp
  8. lods byte ptr [esi]
  9. db 2Fh ; /
  10. pop rsp
  11. db 64h
  12. retf 0E993h
  13. cmp ah, [rax+4Ah]
  14. movzx rsi, dword ptr [rbp-25h]
  15. push 4Ah
  16. movzx rdi, dword ptr [rdi+rdx*8]
  17. db 9Ah
  18. rcr byte ptr [rax+1Dh], cl
  19. lodsd
  20. xor [rbp+6CF20173h], edx
  21. xor [rbp+66F8B593h], edx
  22. push rbx
  23. sbb ch, [rbx-0Fh]
  24. stosd
  25. int 87h
  26. db 46h, 4Ch
  27. out 33h, rax
  28. xchg eax, ebp
  29. test ecx, ebp
  30. movsd
  31. leave
  32. push rsp
  33. db 16h
  34. xchg eax, esi
  35. pop rdi
  36. loc_B3D: ; CODE XREF: seg000:0000000000000B5F
  37. mov ds:93CA685DF98A90F9h, eax
  38. jnz short near ptr loc_AF3+6
  39. out dx, eax
  40. cwde
  41. mov bh, 5Dh ; ']'
  42. movsb
  43. pop rbp
  44. db 60h ; `
  45. movsxd rbp, dword ptr [rbp-17h]
  46. pop rbx
  47. out 7Dh, al
  48. add eax, 0D79BE769h
  49. db 1Fh
  50. retf 0CAB9h
  51. jl short near ptr loc_B3D+4
  52. sal dword ptr [rbx+rbp+4Dh], 0D3h
  53. mov cl, 41h ; 'A'
  54. imul eax, [rbp-5B77E717h], 1DDE6E5h
  55. imul ecx, ebx, 66359BCCh
  56. xlat
  57. db 60h ; `
  58. cmp bl, [rax]
  59. and ebp, [rcx-57h]
  60. stc
  61. sub [rcx+1A533AB4h], al
  62. jmp short loc_C05
  63. db 4Bh ; K
  64. int 3 ; Trap to Debugger
  65. xchg ebx, [rsp+rdx-5Bh]
  66. db 0D6h
  67. mov esp, 0C5BA61F7h
  68. out 0A3h, al ; Interrupt Controller #2, 8259A
  69. add al, 0A6h
  70. pop rbx
  71. cmp bh, fs:[rsi]
  72. and ch, cl
  73. cmp al, 0F3h
  74. db 0Eh
  75. xchg dh, [rbp+rax*4-4CE9621Ah]
  76. stosd
  77. xor [rdi], ebx
  78. stosb
  79. xchg eax, ecx
  80. push rsi
  81. insd
  82. fidiv word ptr [rcx]
  83. xchg eax, ecx
  84. mov dh, 0C0h ; 'L'
  85. xchg eax, esp
  86. push rsi
  87. mov dh, [rdx+rbp+6918F1F3h]
  88. xchg eax, ebp
  89. out 9Dh, al
  90. loc_BC0: ; CODE XREF: seg000:0000000000000C26
  91. or [rcx-0Dh], ch
  92. int 67h ; - LIM EMS
  93. push rdx
  94. sub al, 43h ; 'C'
  95. test ecx, ebp
  96. test [rdi+71F372A4h], cl
  97. db 7
  98. imul ebx, [rsi-0Dh], 2BB30231h
  99. xor ebx, [rbp-718B6E64h]
  100. jns short near ptr loc_C56+1
  101. ficomp dword ptr [rcx-1Ah]
  102. and eax, 69BEECC7h
  103. mov esi, 37DA40F6h
  104. imul r13, [rbp+rdi*8+529F33CDh], 0FFFFFFFFF35CDD30h
  105. or [rbx], edx
  106. imul esi, [rbx-34h], 0CDA42B87h
  107. db 36h ; 6
  108. db 1Fh
  109. loc_C05: ; CODE XREF: seg000:0000000000000B86
  110. add dh, [rcx]
  111. mov edi, 0DD3E659h
  112. ror byte ptr [rdx-33h], cl
  113. xlat
  114. db 48h
  115. sub rsi, [rcx]
  116. db 1Fh
  117. db 6
  118. xor [rdi+13F5F362h], bh
  119. cmpsb
  120. sub esi, [rdx]
  121. pop rbp
  122. sbb al, 62h ; 'b'
  123. mov dl, 33h ; '3'
  124. db 4Dh ; M
  125. db 17h
  126. jns short loc_BC0
  127. push 0FFFFFFFFFFFFFF86h
  128. loc_C2A: ; CODE XREF: seg000:0000000000000C8F
  129. sub [rdi-2Ah], eax
  130. db 0FEh
  131. cmpsb
  132. wait
  133. rcr byte ptr [rax+5Fh], cl
  134. cmp bl, al
  135. pushfq
  136. xchg ch, cl
  137. db 4Eh ; N
  138. db 37h ; 7
  139. mov ds:0E43F3CCD3D9AB295h, eax
  140. cmp ebp, ecx
  141. jl short loc_C87
  142. retn 8574h
  143. out 3, al ; DMA controller, 8237A-5.
  144. ; channel 1 base address and word count
  145. loc_C4C: ; CODE XREF: seg000:0000000000000C7F
  146. cmp al, 0A6h
  147. wait
  148. push 0FFFFFFFFFFFFFFBEh
  149. db 82h
  150. ficom dword ptr [rbx+r10*8]
  151. loc_C56: ; CODE XREF: seg000:0000000000000BDE
  152. jnz short loc_C76
  153. xchg eax, edx
  154. db 26h
  155. wait
  156. iret
  157. push rcx
  158. db 48h ; H
  159. db 9Bh
  160. db 64h ; d
  161. db 3Eh ; >
  162. db 2Fh ; /
  163. mov al, ds:8A7490CA2E9AA728h
  164. stc
  165. db 60h ; `
  166. test [rbx+rcx], ebp
  167. int 3 ; Trap to Debugger
  168. xlat
  169. loc_C72: ; CODE XREF: seg000:0000000000000CC6
  170. mov bh, 98h
  171. db 2Eh ; .
  172. db 0DFh
  173. loc_C76: ; CODE XREF: seg000:loc_C56
  174. jl short loc_C91
  175. sub ecx, 13A7CCF2h
  176. movsb
  177. jns short near ptr loc_C4C+1
  178. cmpsd
  179. sub ah, ah
  180. cdq
  181. db 6Bh ; k
  182. db 5Ah ; Z
  183. loc_C87: ; CODE XREF: seg000:0000000000000C45
  184. or ecx, [rbx+6Eh]
  185. rep in eax, 0Eh ; DMA controller, 8237A-5.
  186. ; Clear mask registers.
  187. ; Any OUT enables all 4 channels.
  188. cmpsb
  189. jnb short loc_C2A
  190. loc_C91: ; CODE XREF: seg000:loc_C76
  191. scasd
  192. add dl, [rcx+5FEF30E6h]
  193. enter 0FFFFFFFFFFFFC733h, 7Ch
  194. insd
  195. mov ecx, gs
  196. in al, dx
  197. out 2Dh, al
  198. mov ds:6599E434E6D96814h, al
  199. cmpsb
  200. push 0FFFFFFFFFFFFFFD6h
  201. popfq
  202. xor ecx, ebp
  203. db 48h
  204. insb
  205. test al, cl
  206. xor [rbp-7Bh], cl
  207. and al, 9Bh
  208. db 9Ah
  209. push rsp
  210. xor al, 8Fh
  211. cmp eax, 924E81B9h
  212. clc
  213. mov bh, 0DEh
  214. jbe short near ptr loc_C72+1
  215. db 1Eh
  216. retn 8FCAh
  217. db 0C4h ; -
  218. loc_CCD: ; CODE XREF: seg000:0000000000000D22
  219. adc eax, 7CABFBF8h
  220. db 38h ; 8
  221. mov ebp, 9C3E66FCh
  222. push rbp
  223. dec byte ptr [rcx]
  224. sahf
  225. fidivr word ptr [rdi+2Ch]
  226. db 1Fh
  227. db 3Eh
  228. xchg eax, esi
  229. loc_CE2: ; CODE XREF: seg000:0000000000000D5E
  230. mov ebx, 0C7AFE30Bh
  231. clc
  232. in eax, dx
  233. sbb bh, bl
  234. xchg eax, ebp
  235. db 3Fh ; ?
  236. cmp edx, 3EC3E4D7h
  237. push 51h
  238. db 3Eh
  239. pushfq
  240. jl short loc_D17
  241. test [rax-4CFF0D49h], ebx
  242. db 2Fh ; /
  243. rdtsc
  244. jns short near ptr loc_D40+4
  245. mov ebp, 0B2BB03D8h
  246. in eax, dx
  247. db 1Eh
  248. fsubr dword ptr [rbx-0Bh]
  249. jns short loc_D70
  250. scasd
  251. mov ch, 0C1h ; '+'
  252. add edi, [rbx-53h]
  253. db 0E7h
  254. loc_D17: ; CODE XREF: seg000:0000000000000CF7
  255. jp short near ptr unk_D79
  256. scasd
  257. cmc
  258. sbb ebx, [rsi]
  259. fsubr dword ptr [rbx+3Dh]
  260. retn
  261. db 3
  262. jnp short near ptr loc_CCD+4
  263. db 36h
  264. adc r14b, r13b
  265. db 1Fh
  266. retf
  267. test [rdi+rdi*2], ebx
  268. cdq
  269. or ebx, edi
  270. test eax, 310B94BCh
  271. ffreep st(7)
  272. cwde
  273. sbb esi, [rdx+53h]
  274. push 5372CBAAh
  275. loc_D40: ; CODE XREF: seg000:0000000000000D02
  276. push 53728BAAh
  277. push 0FFFFFFFFF85CF2FCh
  278. db 0Eh
  279. retn 9B9Bh
  280. movzx r9, dword ptr [rdx]
  281. adc [rcx+43h], ebp
  282. in al, 31h
  283. db 37h ; 7
  284. jl short loc_DC5
  285. icebp
  286. sub esi, [rdi]
  287. clc
  288. pop rdi
  289. jb short near ptr loc_CE2+1
  290. or al, 8Fh
  291. mov ecx, 770EFF81h
  292. sub al, ch
  293. sub al, 73h ; 's'
  294. cmpsd
  295. adc bl, al
  296. out 87h, eax ; DMA page register 74LS612:
  297. ; Channel 0 (address bits 16-23)
  298. loc_D70: ; CODE XREF: seg000:0000000000000D0E
  299. adc edi, ebx
  300. db 49h
  301. outsb
  302. enter 33E5h, 97h
  303. xchg eax, ebx
  304. unk_D79 db 0FEh ; CODE XREF: seg000:loc_D17
  305. db 0BEh
  306. db 0E1h
  307. db 82h
  308. loc_D7D: ; CODE XREF: seg000:0000000000000DB3
  309. cwde
  310. db 7
  311. db 5Ch ; \
  312. db 10h
  313. db 73h ; s
  314. db 0A9h
  315. db 2Bh ; +
  316. db 9Fh
  317. loc_D85: ; CODE XREF: seg000:0000000000000DD1
  318. dec dh
  319. jnz short near ptr loc_DD3+3
  320. mov ds:7C1758CB282EF9BFh, al
  321. sal ch, 91h
  322. rol dword ptr [rbx+7Fh], cl
  323. fbstp tbyte ptr [rcx+2]
  324. repne mov al, ds:4BFAB3C3ECF2BE13h
  325. pushfq
  326. imul edx, [rbx+rsi*8+3B484EE9h], 8EDC09C6h
  327. cmp [rax], al
  328. jg short loc_D7D
  329. xor [rcx-638C1102h], edx
  330. test eax, 14E3AD7h
  331. insd
  332. db 38h ; 8
  333. db 80h
  334. db 0C3h
  335. loc_DC5: ; CODE XREF: seg000:0000000000000D57
  336. ; seg000:0000000000000DD8
  337. cmp ah, [rsi+rdi*2+527C01D3h]
  338. sbb eax, 5FC631F0h
  339. jnb short loc_D85
  340. loc_DD3: ; CODE XREF: seg000:0000000000000D87
  341. call near ptr 0FFFFFFFFC03919C7h
  342. loope near ptr loc_DC5+3
  343. sbb al, 0C8h
  344. std

代码清单28.2:ARM架构(ARM 模式)不正确的反汇编代码示例

  1. BLNE 0xFE16A9D8
  2. BGE 0x1634D0C
  3. SVCCS 0x450685
  4. STRNVT R5, [PC],#-0x964
  5. LDCGE p6, c14, [R0],#0x168
  6. STCCSL p9, c9, [LR],#0x14C
  7. CMNHIP PC, R10,LSL#22
  8. FLDMIADNV LR!, {D4}
  9. MCR p5, 2, R2,c15,c6, 4
  10. BLGE 0x1139558
  11. BLGT 0xFF9146E4
  12. STRNEB R5, [R4],#0xCA2
  13. STMNEIB R5, {R0,R4,R6,R7,R9-SP,PC}
  14. STMIA R8, {R0,R2-R4,R7,R8,R10,SP,LR}^
  15. STRB SP, [R8],PC,ROR#18
  16. LDCCS p9, c13, [R6,#0x1BC]
  17. LDRGE R8, [R9,#0x66E]
  18. STRNEB R5, [R8],#-0x8C3
  19. STCCSL p15, c9, [R7,#-0x84]
  20. RSBLS LR, R2, R11,ASR LR
  21. SVCGT 0x9B0362
  22. SVCGT 0xA73173
  23. STMNEDB R11!, {R0,R1,R4-R6,R8,R10,R11,SP}
  24. STR R0, [R3],#-0xCE4
  25. LDCGT p15, c8, [R1,#0x2CC]
  26. LDRCCB R1, [R11],-R7,ROR#30
  27. BLLT 0xFED9D58C
  28. BL 0x13E60F4
  29. LDMVSIB R3!, {R1,R4-R7}^
  30. USATNE R10, #7, SP,LSL#11
  31. LDRGEB LR, [R1],#0xE56
  32. STRPLT R9, [LR],#0x567
  33. LDRLT R11, [R1],#-0x29B
  34. SVCNV 0x12DB29
  35. MVNNVS R5, SP,LSL#25
  36. LDCL p8, c14, [R12,#-0x288]
  37. STCNEL p2, c6, [R6,#-0xBC]!
  38. SVCNV 0x2E5A2F
  39. BLX 0x1A8C97E
  40. TEQGE R3, #0x1100000
  41. STMLSIA R6, {R3,R6,R10,R11,SP}
  42. BICPLS R12, R2, #0x5800
  43. BNE 0x7CC408
  44. TEQGE R2, R4,LSL#20
  45. SUBS R1, R11, #0x28C
  46. BICVS R3, R12, R7,ASR R0
  47. LDRMI R7, [LR],R3,LSL#21
  48. BLMI 0x1A79234
  49. STMVCDB R6, {R0-R3,R6,R7,R10,R11}
  50. EORMI R12, R6, #0xC5
  51. MCRRCS p1, 0xF, R1,R3,c2

代码清单28.2:ARM架构(Thumb 模式)不正确的反汇编代码示例

  1. LSRS R3, R6, #0x12
  2. LDRH R1, [R7,#0x2C]
  3. SUBS R0, #0x55 ; 'U'
  4. ADR R1, loc_3C
  5. LDR R2, [SP,#0x218]
  6. CMP R4, #0x86
  7. SXTB R7, R4
  8. LDR R4, [R1,#0x4C]
  9. STR R4, [R4,R2]
  10. STR R0, [R6,#0x20]
  11. BGT 0xFFFFFF72
  12. LDRH R7, [R2,#0x34]
  13. LDRSH R0, [R2,R4]
  14. LDRB R2, [R7,R2]
  15. DCB 0x17
  16. DCB 0xED
  17. STRB R3, [R1,R1]
  18. STR R5, [R0,#0x6C]
  19. LDMIA R3, {R0-R5,R7}
  20. ASRS R3, R2, #3
  21. LDR R4, [SP,#0x2C4]
  22. SVC 0xB5
  23. LDR R6, [R1,#0x40]
  24. LDR R5, =0xB2C5CA32
  25. STMIA R6, {R1-R4,R6}
  26. LDR R1, [R3,#0x3C]
  27. STR R1, [R5,#0x60]
  28. BCC 0xFFFFFF70
  29. LDR R4, [SP,#0x1D4]
  30. STR R5, [R5,#0x40]
  31. ORRS R5, R7
  32. loc_3C ; DATA XREF: ROM:00000006
  33. B 0xFFFFFF98
  34. ASRS R4, R1, #0x1E
  35. ADDS R1, R3, R0
  36. STRH R7, [R7,#0x30]
  37. LDR R3, [SP,#0x230]
  38. CBZ R6, loc_90
  39. MOVS R4, R2
  40. LSRS R3, R4, #0x17
  41. STMIA R6!, {R2,R4,R5}
  42. ADDS R6, #0x42 ; 'B'
  43. ADD R2, SP, #0x180
  44. SUBS R5, R0, R6
  45. BCC loc_B0
  46. ADD R2, SP, #0x160
  47. LSLS R5, R0, #0x1A
  48. CMP R7, #0x45
  49. LDR R4, [R4,R5]
  50. DCB 0x2F ; /
  51. DCB 0xF4
  52. B 0xFFFFFD18
  53. ADD R4, SP, #0x2C0
  54. LDR R1, [SP,#0x14C]
  55. CMP R4, #0xEE
  56. DCB 0xA
  57. DCB 0xFB
  58. STRH R7, [R5,#0xA]
  59. LDR R3, loc_78
  60. DCB 0xBE ; -
  61. DCB 0xFC
  62. MOVS R5, #0x96
  63. DCB 0x4F ; O
  64. DCB 0xEE
  65. B 0xFFFFFAE6
  66. ADD R3, SP, #0x110
  67. loc_78 ; DATA XREF: ROM:0000006C
  68. STR R1, [R3,R6]
  69. LDMIA R3!, {R2,R5-R7}
  70. LDRB R2, [R4,R2]
  71. ASRS R4, R0, #0x13
  72. BKPT 0xD1
  73. ADDS R5, R0, R6
  74. STR R5, [R3,#0x58]

代码清单28.2:MIPS架构(小端序)不正确的反汇编代码示例

  1. lw $t9, 0xCB3($t5)
  2. sb $t5, 0x3855($t0)
  3. sltiu $a2, $a0, -0x657A
  4. ldr $t4, -0x4D99($a2)
  5. daddi $s0, $s1, 0x50A4
  6. lw $s7, -0x2353($s4)
  7. bgtzl $a1, 0x17C5C
  8. .byte 0x17
  9. .byte 0xED
  10. .byte 0x4B # K
  11. .byte 0x54 # T
  12. lwc2 $31, 0x66C5($sp)
  13. lwu $s1, 0x10D3($a1)
  14. ldr $t6, -0x204B($zero)
  15. lwc1 $f30, 0x4DBE($s2)
  16. daddiu $t1, $s1, 0x6BD9
  17. lwu $s5, -0x2C64($v1)
  18. cop0 0x13D642D
  19. bne $gp, $t4, 0xFFFF9EF0
  20. lh $ra, 0x1819($s1)
  21. sdl $fp, -0x6474($t8)
  22. jal 0x78C0050
  23. ori $v0, $s2, 0xC634
  24. blez $gp, 0xFFFEA9D4
  25. swl $t8, -0x2CD4($s2)
  26. sltiu $a1, $k0, 0x685
  27. sdc1 $f15, 0x5964($at)
  28. sw $s0, -0x19A6($a1)
  29. sltiu $t6, $a3, -0x66AD
  30. lb $t7, -0x4F6($t3)
  31. sd $fp, 0x4B02($a1)
  32. .byte 0x96
  33. .byte 0x25 # %
  34. .byte 0x4F # O
  35. .byte 0xEE
  36. swl $a0, -0x1AC9($k0)
  37. lwc2 $4, 0x5199($ra)
  38. bne $a2, $a0, 0x17308
  39. .byte 0xD1
  40. .byte 0xBE
  41. .byte 0x85
  42. .byte 0x19
  43. swc2 $8, 0x659D($a2)
  44. swc1 $f8, -0x2691($s6)
  45. sltiu $s6, $t4, -0x2691
  46. sh $t9, -0x7992($t4)
  47. bne $v0, $t0, 0x163A4
  48. sltiu $a3, $t2, -0x60DF
  49. lbu $v0, -0x11A5($v1)
  50. pref 0x1B, 0x362($gp)
  51. pref 7, 0x3173($sp)
  52. blez $t1, 0xB678
  53. swc1 $f3, flt_CE4($zero)
  54. pref 0x11, -0x704D($t4)
  55. ori $k1, $s2, 0x1F67
  56. swr $s6, 0x7533($sp)
  57. swc2 $15, -0x67F4($k0)
  58. ldl $s3, 0xF2($t7)
  59. bne $s7, $a3, 0xFFFE973C
  60. sh $s1, -0x11AA($a2)
  61. bnel $a1, $t6, 0xFFFE566C
  62. sdr $s1, -0x4D65($zero)
  63. sd $s2, -0x24D7($t8)
  64. scd $s4, 0x5C8D($t7)
  65. .byte 0xA2
  66. .byte 0xE8
  67. .byte 0x5C # \
  68. .byte 0xED
  69. bgtz $t3, 0x189A0
  70. sd $t6, 0x5A2F($t9)
  71. sdc2 $10, 0x3223($k1)
  72. sb $s3, 0x5744($t9)
  73. lwr $a2, 0x2C48($a0)
  74. beql $fp, $s2, 0xFFFF3258

同样重要的是要记住,巧妙地运用解压缩和解密技术(包括自修改),可能看起来像是一段不正确的反汇编代码,但是,它是能够正确运行的(注1)。

注1: 一段代码在经过压缩或者加密之后,他的机器码全都变乱了,因此,反汇编结果得到的是一段错误的反汇编代码。但是经过一段解压缩程序或者解密程序处理之后,它就能够还原出原来的机器码,因此反汇编出来的代码和运行结果都是正确的。