The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: cdn4753 on January 27, 2014, 11:43:19 AM

Title: Convert 32 to 64 executable program jwasm+radasm
Post by: cdn4753 on January 27, 2014, 11:43:19 AM
(1)Calendar Control
Error A2102: Symbol not defined : MCM_GETCURSEL
(2) Toolbar  ;include    CommCtrl.inc
Error A2102: Symbol not defined : TBN_QUERYINSERT
Symbol not defined : TBN_GETBUTTONINFO
Symbol not defined : TBNOTIFY.iItem
Symbol not defined : TBNOTIFY.tbButton

(3)
lea rdi,Buffer2048 ;hWinEdit box for display
push rdi     
invoke  SendMessage,hWinEdit,EM_REPLACESEL,TRUE,rdi
pop rdi
Run crash
Found that, as long as the line to perform push XXX command, run crash
push  rax   
   invoke SetFilePointer,hFile,0,NULL,FILE_END ;Move files Tail               
pop  rax 
Experiments show that this is also a problem
Title: Re: Convert 32 to 64 executable program jwasm+radasm
Post by: sinsi on January 27, 2014, 04:07:23 PM
Not sure about radasm, but in general the stack needs to be aligned to 16 before invoking an API.
Your push will misalign the stack, Windows doesn't like it. As part of the ABI, Windows will save rdi so no need to push/pop it.

64-bit asm is a lot different to 32-bit, look at Overview of x64 Calling Conventions (http://msdn.microsoft.com/en-us/library/ms235286.aspx) for more info.
Title: Re: Convert 32 to 64 executable program jwasm+radasm
Post by: Gunther on January 28, 2014, 04:58:52 AM
Hi cdn4753,

that link (http://software.intel.com/en-us/articles/introduction-to-x64-assembly/) might be of interest, too. And: welcome to the forum.

Gunther
Title: Re: Convert 32 to 64 executable program jwasm+radasm
Post by: cdn4753 on January 31, 2014, 12:53:41 AM
A 32-bit executable programs, converted to 64, an increase of 1000%the code bytes
To include XXX.inc Symbol not defined the problem, you can refer to XXX.inc 32 can self-define or copy rows
push will misalign the stack
japheth in SOURCEFORGE in case said:
In 64-bit, you must be careful with push / pop if you used OPTION WIN64:. 2 in your source See warning in the documentation for more details.
Although incomplete understanding, but I know that can not be so used
Title: Re: Convert 32 to 64 executable program jwasm+radasm
Post by: ragdog on February 01, 2014, 08:33:03 AM
Hi

In radasm3\jWasm\Projects\Win64Test is a 64 example with Jwasm