News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Difference between jwasm and uasm

Started by tastewar, August 28, 2019, 05:12:27 AM

Previous topic - Next topic

aw27

Obviously, there are no restriction in the way one function can call another function in Assembly language, it should even be possible (but strangely is not) for Assemblers to have some way to make a custom calling convention using rules from a template available to users, unfortunately they don't (Something like IDA has).
I am not sure how ASMC deals in 64-bit with the traditional 32-bit calling conventions, but I don't think JWASM does it the same way.
In addition, I don't think JWASM supports the SystemV calling convention in any way, let alone aliasing traditional 32-bit calling conventions to SystemV or implementing it behind the scenes. If it does, Japheth never noticed that:  :badgrin:
https://sourceforge.net/p/jwasm/feature-requests/27/

jj2007

Quote from: AW on August 31, 2019, 10:00:28 AMit should even be possible (but strangely is not) for Assemblers to have some way to make a custom calling convention using rules from a template available to users

This is what prologue/epilogue macros do.

aw27

@jj2007,
I don't think so, although Microsoft used macros for prologue/epilogue in 32-bit MASM ages ago and, of course, Hutch managed to produce a working solution for the Windows 64-bit ABI. However, macros are cumbersome by their own nature. For example, I can't figure out a way to produce the vectorcall convention using macros.
But there is an opportunity for assemblers, like those hosted in this website, to fill in the blanks left behind by Masm and gain popularity doing so. This was actually what gave recognition to Jwasm years ago and lots of people still believe it is worthwhile to build using Jwasm despite it being dead and buried deep since long.

nidud

#33
deleted

aw27

I was thinking about custom calling conventions providing like in IDA Pro.

http://darmawan-salihun.blogspot.com/2012/04/using-custom-function-calling.html
https://www.hex-rays.com/products/ida/support/idadoc/1361.shtml

hutch--

In Win64 you can do anything you like as long as you understand what registers to preserve and what alignment is necessary if you make any system calls at all. Get it wrong and it just won't start and you get no analysis about why. With the number of available registers in Win64 I wonder why you would bother to use other than FASTCALL at all. The main reason why I use LOCAL variables is for higher level code, mainly API code and here you need the stack frame.

The risk with non standard calling methods is messing up the stack where the FASTCALL technique comfortably handle BYTE to QWORD in the same stack locations. JWASM did win32 reasonably well but it was not properly Win64 ABI compliant and is best left to the dustbin of history.

tastewar

Thanks for the help! We are getting closer to some solutions.

The current challenge is that we are looking for a means of defining a proc that would use traditional stack based parameters. I understand, this is not "the" approved calling convention in x64, but we have scads of code that compiles today with jwasm on x64, which you are free to tell me is broken, but which works with our code when defining our internal functions as stdcall