flat assembler
Message board for the users of flat assembler.

Index > Main > What is mean ? proc Main c audioMaster

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1316
Roman 12 Oct 2022, 06:15
Fasmw 1.73
I found example, compile ok for 64 bits.
Code:
proc Main c audioMaster 
ret
endp
    


But what is c ?
I expected audioMaster is stack 8 bytes.
Post 12 Oct 2022, 06:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19094
Location: In your JS exploiting you and your system
revolution 12 Oct 2022, 06:51
You can see the code in proc32.inc
Code:
;...
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
 { irps reg, reglist \{ reverse pop reg \}
   if parmbytes | localbytes
    leave
   end if
   if flag and 10000b
    retn
   else
    retn parmbytes
   end if }

close@proc equ

macro define@proc name,statement
 { local params,flag,regs,parmbytes,localbytes,current
   if used name
   name:
   match =stdcall args, statement \{ params equ args
                                     flag = 11b \}
   match =stdcall, statement \{ params equ
                                flag = 11b \}
   match =c args, statement \{ params equ args
                               flag = 10001b \}
   match =c, statement \{ params equ
                          flag = 10001b \}
;...    
c uses ccall semantics.

You can also do ...
Code:
proc Main stdcall audioMaster 
ret
endp    
... and have stdcall semantics.

stdcall is the default if you don't have the specifier..
Code:
proc Main audioMaster 
ret
endp    


Last edited by revolution on 12 Oct 2022, 07:04; edited 1 time in total
Post 12 Oct 2022, 06:51
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 705
Location: Russian Federation, Sochi
ProMiNick 12 Oct 2022, 07:01
There is no C-calling convention for x64.
only fastcall calling convention. keyword C is ignored.
fastcall calling conventions only varies according to OS (windows:shadowregs, params via rcx,rdx,r8,r9,stack(stack cleared by callee) or linux:redzone , params via rdi,rsi,rcx,rdx,r8,r9, stack(stack cleared by caller))
Post 12 Oct 2022, 07:01
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19094
Location: In your JS exploiting you and your system
revolution 12 Oct 2022, 08:21
I missed the 64-bit part.

In proc64.inc the same flag parameter is defined in define@proc but the epilogue ignores it. So it makes no difference in 64-bit mode, the binary code output will be exactly the same.
Code:
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
 { irps reg, reglist \{ reverse pop reg \}
   leave
   retn }    
Post 12 Oct 2022, 08:21
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 701
Location: Russia
macomics 12 Oct 2022, 13:12
revolution wrote:
Code:
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
 { irps reg, reglist \{ reverse pop reg \}
   leave
   retn }    
Isn't it better to restore registers after leave. Accordingly, and save until enter. Otherwise, in case of a failure of the rsp value, garbage will be restored in the registers! At a minimum, it is necessary to reset the rsp value before irps.
Post 12 Oct 2022, 13:12
View user's profile Send private message 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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.