flat assembler
Message board for the users of flat assembler.

Index > Windows > Regarding win64 development...

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 01 Feb 2008, 20:01
I know that when doing 32-bit development I push the parameters to the stack and use call to call the API.
But when doing 64-bit development it seems some parameters are passed to registers. How do I know which registers to use? Is there a reference?
Also are there some Win64 development guide?

Another question: I'm planning on installing Win XP 64 here to use the full power of my machine. Is this version as stable as Win XP (32 bits)?
Post 01 Feb 2008, 20:01
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Feb 2008, 20:29
Tomasz probably has move practical advice, but my own caveat would be "don't expect it to be as compatible as 32-bit Windows" (yet, if ever). Then again, Vista 32-bit ain't too compatible either. Oh well. At least 64-bit is faster (10% or so, supposedly).
Post 01 Feb 2008, 20:29
View user's profile Send private message Visit poster's website Reply with quote
Xorpd!



Joined: 21 Dec 2006
Posts: 161
Xorpd! 01 Feb 2008, 22:44
http://www.jorgon.freeserve.co.uk/GoasmHelp/64bits.htm
http://www.agner.org/optimize/calling_conventions.pdf
If you install the Windows SDK from roughly
http://www.microsoft.com/downloads/details.aspx?FamilyId=484269E2-3B89-47E3-8EB7-1F2BE6D7123A&displaylang=en
you get a file called SWConventions.doc that has the x64 calling convention. If you're used to programming RISC machines the calling convention will seem quite natural, otherwise it may take some getting used to. It's much easier than 32-bit Windows because there is only one calling convention, and no name-mangling ala STDCALL (well, C++ still mangles, but that's different).

The only thing that has locked up my xp-x64 machine was when I was rewriting the Mandelbrot benchmark. If there was a bug in my code and it got hung in a loop the machine would be unusable until it was power-cycled. I think that was due to running multiple threads at realtime priority level and getting them all hung at once rather than any quality of x64. Probably putting 16 realtime priority threads in an infinite loop with the Win32 stuff set up (badly) as the Mandelbrot benchmark does in *32 code would hang the machine as well, but I haven't verified that.

Make sure that you have drivers for all your hardware before installing x64. You simply can't use 32-bit drivers in that environent. The big shocker after that is that DOS programs don't work in xp-x64, even though they worked in RISC versions of Windows NT under emulation!

If you do get 64-bit Windows installed, please try my x64 version of the Mandelbrot benchmark and post results to the appropriate thread. I still haven't collected results for many machines I am interested in.
Post 01 Feb 2008, 22:44
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 01 Feb 2008, 23:27
Actually having only one thread running in real-time is enough to hung the computer. By real-time I mean having a thread in real-time priority and the process of that thread with a base priority high enough to make the thread really run at real-time.

PS: Well, maybe on multi-core systems you need more that one real-time thread to hung the system.
Post 01 Feb 2008, 23:27
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 01 Feb 2008, 23:39
Using real time threads for any lengthy operation is just silly anyway. The computer still has to do the same amount of work no matter how you arrange the priorities. So any long running task should get a lower priority to allow the shorter tasks to complete earlier and not hang your system.

Although. I understand the code in question was merely for testing, but ... before jumping to RT one should test first at low priority to make sure it operates as expected. Then later when you are happy it works as desired you might see a small percentage improvement in run times once it is switched to RT.
Post 01 Feb 2008, 23:39
View user's profile Send private message Visit poster's website Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf 02 Feb 2008, 08:15
I run on win64/ most things I want to run work. The only thing that bothered me is ollydbg didn't work properly until i found some script patches.
Post 02 Feb 2008, 08:15
View user's profile Send private message MSN Messenger Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 02 Feb 2008, 23:18
OzzY wrote:
I know that when doing 32-bit development I push the parameters to the stack and use call to call the API.
But when doing 64-bit development it seems some parameters are passed to registers. How do I know which registers to use? Is there a reference?
Also are there some Win64 development guide?

Another question: I'm planning on installing Win XP 64 here to use the full power of my machine. Is this version as stable as Win XP (32 bits)?


Hi OzzY,

The following blog goes over calling conventions: http://blogs.msdn.com/oldnewthing/archive/2004/01/14/58579.aspx

MSDN/Technet has some light details on amd64/x64 development, just google for it.

Windows XP x64 is based on Windows 2003 SP1 code base and not Windows XP x86, so in essence is just as stable as Windows 2003 Server. It is slightly quicker for most tasks as well., but you may not notice them except in instances when you are benchmarking.

PS. Calling conventions have been discussed here as well, http://board.flatassembler.net/topic.php?t=7050
Post 02 Feb 2008, 23:18
View user's profile Send private message Visit poster's website Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 509
Location: Czech republic, Slovak republic
Feryno 06 Feb 2008, 11:54
The worst difficulty is to keep RSP (stack) aligned at dqword (search the forum for more)
params are passed in this order:
rcx, rdx, r8, r9, [rsp+8*4], [rsp+8*5], ... [rsp+8*X]
take a look into win64 samples included in FASM package
Post 06 Feb 2008, 11:54
View user's profile Send private message Visit poster's website ICQ Number 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.