Page 1 of 1

Setting up a page as a stack

Posted: Mon Jul 30, 2012 6:59 am
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

Re: Setting up a page as a stack

Posted: Mon Jul 30, 2012 7:10 am
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).