[dundee] dundee Digest, Vol 193, Issue 2

tr.simpson at blueyonder.co.uk tr.simpson at blueyonder.co.uk
Mon Mar 23 13:24:22 UTC 2009


>
> Today's Topics:
>
>    1. Re: Grabbing the stack pointer... (Nicholas Walker)
>
>
Nick Try the following

#include<stdio.h>
unsigned long sp(void)
{
    asm("movl %esp, %eax");
}

int main(void)
{
    printf("0x%lx\n", sp());
}

compiled on gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) 64bit

Tim Simpson






More information about the dundee mailing list