flat assembler
Message board for the users of flat assembler.

Index > Windows > fastcall

Author
Thread Post new topic Reply to topic
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
parameters are passed in rcx, rdx, r8 and r9. Rest goes on stack after 32byte shadow space. This i understand.
But why do i have to align stack to 16 bytes?

Is it ok to do and rsp, 0xFFFFFFFFFFFFFFF0 at the beggining of program?
Post 29 Mar 2011, 20:10
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
OS requires alignment and shadow space. If you can guarantee that state prior to API calls then you are in compliance. Leaf node that don't use the API can do whatever.
Post 30 Mar 2011, 02:24
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
Ok, so basically i have to do anything to make rsp aligned to 16 bytes before any api call?

I think its better to do so at the beginning, and then keep track of rsp so its always aligned.
Post 30 Mar 2011, 06:01
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
API will use the shadow space to store registers, so more that RSP aligned is needed! Look for my examples on this board - I have used some techniques you will like.

http://board.flatassembler.net/topic.php?t=10231
http://board.flatassembler.net/topic.php?p=94910#94910
http://board.flatassembler.net/topic.php?p=109871#109871

Good related discussion:
http://board.flatassembler.net/topic.php?t=11133

_________________
¯\(°_o)/¯ unlicense.org
Post 31 Mar 2011, 05:19
View user's profile Send private message Visit poster's website 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 GitHub, YouTube, Twitter.

Website powered by rwasa.