-// this function is used to walk up a stack trace... it returns
-// the pointer to the next return address above the pointer to the
-// return address pointed to by Frame...
-static rulong*
-RNextStackFrame ( rulong* Frame )
-{
- if ( !Frame || !*Frame || *Frame == 0xDEADBEAF )
- return NULL;
- return (rulong*)( Frame[-1] ) + 1;
-}
-
-// this function returns a pointer to the address the
-// caller will return to. Use RNextStackFrame() above to walk
-// further up the stack.
-static rulong*
-RStackFrame()
-{
- rulong* Frame;
-#if defined __GNUC__
- __asm__("mov %%ebp, %%ebx" : "=b" (Frame) : );
-#elif defined(_MSC_VER)
- __asm mov [Frame], ebp
-#endif
- return RNextStackFrame ( Frame + 1 );
-}
-