how can I get esp value?

Joel Sherrill joel.sherrill at OARcorp.com
Fri Dec 6 18:27:40 UTC 2002


Well accessing the stack in a subroutine even if inlined
has the potential to be misleading but it will be close.
How about this for the routine?

static inline unsigned int      i386_get_esp( void )
{
                
  register unsigned int esp;

  asm volatile ( "movw %%esp,%0" : "=r" (esp) : "0" (esp) );
}



-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list