Setting up a page as a stack

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
d2alphame
Member
Member
Posts: 35
Joined: Fri May 04, 2012 8:04 am

Setting up a page as a stack

Post by d2alphame »

How do I set up a page and use the page as a stack. I'm writing in 64 bits assembly and I'm using paging. I know pages can be set up to be used for Code (execute) or Data. But how do create a page such that pushes and pops will write to/Read from the page.

Thanks
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Setting up a page as a stack

Post by Nable »

Stack memory is mapped using ordinary data pages, just load the right pointer into RSP register. Do you really now x86 basics?
Ok, just remember that stack grows from top to down (i.e. push decrements RSP and pop increments by the size of operand).
Post Reply