64-bit madDisasm bug

delphi package - full disassembler
Post Reply
Posts: 58
Joined: Wed Oct 29, 2008 3:43 am

64-bit madDisasm bug

Post by zunzster »

I was examining a 64-bit madExcept bugreport where the disassembly shows an Access Violatiom in a routine where the 3rd parameter being passed in a Delphi enumerated value which is contained in a byte - TCollection.RemoveItem on the line where it calls Notify(Item, cnExtracting) if you care and realised the disassembly is incorrect which confused me for a while.

Here is the bug report snippet with the disassembly error highlighted:

1b81828e mov rsi, rdx
1b818291 5175 mov rcx, rbx
1b818294 mov rdx, rsi
1b818297 mov al, 1
1b81829a mov rdi, [rbx]
1b81829d > call qword ptr [rdi+$28]
1b8182a0 5176 mov rcx, [rbx+$10]
1b8182a4 call -$3469 ($1b814e40) ; System.Classes.TList.Last
1b8182a9 cmp rsi, rax
1b8182ac jnz loc_1b8182ca
1b8182ae 5177 mov rcx, [rbx+$10]

If you examine that line inside the Delphi CPU view, it's actually mov r8b, 1 which makes sense as the 3rd parameter is passed in r8 in the Win64 ABI.

I'm guessing the byte sized override for mov disassembly is masking out the high bit of the register indicator and mapping r8b down to al instead.

Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Re: 64-bit madDisasm bug

Post by madshi »

Thanks for letting me know, this is definitely a bug. Will have this fixed for the next build.
Post Reply