flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [fixed] fastcall macro issue

Author
Thread Post new topic Reply to topic
murder



Joined: 03 Nov 2011
Posts: 14
murder 27 Jul 2023, 12:06
fastcal macro for this code
Code:
fastcall 0,dword[rax+r8]    

will be generate this and throw a error
Code:
mov cl,dword[rax+r8]    


but for this code all works right
Code:
fastcall 0,qword[rax+r8]    
Post 27 Jul 2023, 12:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20309
Location: In your JS exploiting you and your system
revolution 27 Jul 2023, 12:14
Code:
use64
include 'win64a.inc'
fastcall 0,dword[rax+r8]    
Code:
flat assembler  version 1.73.31  (16384 kilobytes memory)
test.asm [3]:
fastcall 0,dword[rax+r8]
<path>/proc64.inc [130] fastcall [122]:
          mov cl,param
<path>/proc64.inc [130] match [74]:
          mov cl,param
processed: mov cl,dword[rax+r8]
error: operand sizes do not match.    
Post 27 Jul 2023, 12:14
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Jul 2023, 12:31
The same source does assemble correctly with fasm2 (which uses the "fastcall" macro from the basic fasm compatibility package for fasmg). It is a bug in the old macro.
Post 27 Jul 2023, 12:31
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Jul 2023, 12:37
Changing the line 76 of PROC64.INC:
Code:
         if opcode = 67h | opcode = 41h    
to include one more case:
Code:
         if opcode = 67h | opcode = 41h | opcode = 42h    
seems to correct the issue. I'm updating the fasmw package.
Post 27 Jul 2023, 12:37
View user's profile Send private message Visit poster's website Reply with quote
murder



Joined: 03 Nov 2011
Posts: 14
murder 27 Jul 2023, 12:45
WOW! You fixed it so fast! thanks a lot.
Post 27 Jul 2023, 12:45
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 27 Jul 2023, 12:56
I updated the package with an extended fix:
Code:
         if opcode = 67h | ( opcode > 40h & opcode < 48h )    
Otherwise similar bugs would happen for other combinations of registers like [r8+r9].
Post 27 Jul 2023, 12:56
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.