flat assembler
Message board for the users of flat assembler.

Index > Windows > Parameters in FPU-functions in Win64

Author
Thread Post new topic Reply to topic
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
Somebody knows, on how parameters in function which work through FPU under Win64 are transferred and come back?
Post 13 Jul 2006, 15:51
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen
There is no standard way to use x87 FPU under win64. For FP numbers, you should use low part of XMM registers or pointers to such parameters in memory.

EDIT: here is a reference with the official explanation:

http://msdn2.microsoft.com/en-us/library/ms235286.aspx#sectionSection0

Quote:
The x87 register stack is unused. It may be used, but must be considered volatile across function calls. All floating point operations are done using the 16 XMM registers.


Last edited by MazeGen on 25 Jul 2006, 10:41; edited 2 times in total
Post 24 Jul 2006, 08:16
View user's profile Send private message Visit poster's website Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 454
Location: Czech republic, Slovak republic
Feryno
not well documented, but get by playing:
don't forget to use emms or femms before you put something into fp reg
you may use xmm and fp regs together, but not mm and fp

this is not standard way, but works well for me in case procedure doesn't contain any API and doesn't access any mm reg (API may use mm reg and this destroys fp immediately):

femms ; (or slow emms for compactibility with intel CPU)
fld something
call procedure
...

When your proc uses fp and API, you have to use the way described by MazeGen
- put fp in the stack space, by memory pointer, in xmm reg (APIs use and destroy xmm0-5, so use xmm6-15 which are protected). The same way is for return from proc.
Post 25 Jul 2006, 05:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
Thanks to all, it has very much helped me.
Post 31 Jul 2006, 08:24
View user's profile Send private message Visit poster's website MSN Messenger 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.