MantisBT - Cheat Engine
View Issue Details
0000508Cheat Engine(No Category)public2016-09-28 22:462016-09-29 23:00
Assigned ToDark Byte 
PlatformOSOS VersionWindows 7 x64
Summary0000508: Multiple Auto Assembler errors when encoding CMPXCHG [v6.5.1]
DescriptionThere are several issues related to assembling CMPXCHG instruction operand size (32-bit mode), as well as disassembling its opcode when used with LOCK prefix (32-bit mode):

1. Auto assembler can't assemble `CMPXCHG r8,r8`: error message "Error in line 5 (cmpxchg bl,cl) :This instruction can't be compiled".

2. Auto assembler incorrectly assembles `CMPXCHG r16,r16`: `cmpxchg bx,cx` is assembled to 66.0F.CB `bswap bx`.
2.1. Machine code should be 66.0F.B1.CB.
2.2. Disassembler decodes resulting machine code 66.0F.CB properly as `bswap bx`.

3. Auto assembler incorrectly assembles `CMPXCHG r32,r32`.
3.1. `cmpxchg ebx,ecx` is assembled to 0F.B0.CB `cmpxchg bl,cl`.
3.1.1. Machine code should be 0F.B1.CB.
3.1.2. Disassembler decodes resulting machine code 0F.B0.CB properly as `cmpxchg bl,cl`.

4. Auto assembler can't assemble `CMPXCHG m8,r8`: error message "Error in line 14 (cmpxchg [eax],al) :This instruction can't be compiled".

5. Auto assembler incorrectly assembles `CMPXCHG m16,r16`.
5.1. `cmpxchg [eax],ax` is assembled to 66.0F.00 (incomplete opcode)
5.1.1. Machine code should be 66.0F.B1.00.

6. Auto assembler incorrectly assembles `CMPXCHG m32,r32`.
6.1. `cmpxchg [eax],eax` is assembled to 0F.B0.00 `cmpxchg [eax],al`.
6.1.1. Machine code should be 0F.B1.00.
6.1.2. Disassembler decodes resulting machine code 0F.B0.00 properly as `cmpxchg [eax],al`.
6.2. `cmpxchg [eax],esi` is assembled to 0F.B0.30 `cmpxchg [eax],dh`.
6.2.1. Machine code should be 0F.B1.30.
6.2.2. Disassembler decodes resulting machine code 0F.B0.30 properly as `cmpxchg [eax],dh`.

7. Disassembler disassembles machine code F0.0F.B1.0B as `cmpxchg [ebx],ecx`, which doesn't show the use of LOCK prefix.
Additional Informationglobalalloc(_sxcdmcfbqwareowd,1024)


  //cmpxchg bl,cl

  cmpxchg bx,cx

  cmpxchg ebx,ecx

  //cmpxchg [eax],al
  //cmpxchg [eax],bl
  //cmpxchg [eax],cl
  //cmpxchg [eax],dl

  //cmpxchg [eax],ax

  cmpxchg [eax],eax
  cmpxchg [eax],ebx
  cmpxchg [eax],ecx
  cmpxchg [eax],edx
  cmpxchg [eax],esi
  cmpxchg [eax],edi

  lock cmpxchg [ebx],ecx
TagsNo tags attached.
Attached Files

Dark Byte   
2016-09-29 23:00   
should be fixed now

Issue History
2016-09-28 22:46chase0New Issue
2016-09-29 23:00Dark ByteAssigned To => Dark Byte
2016-09-29 23:00Dark ByteStatusnew => resolved
2016-09-29 23:00Dark ByteResolutionopen => fixed
2016-09-29 23:00Dark ByteNote Added: 0001105