On Sat, Jun 14, 2008 at 1:10 AM, Julian Elischer <julian_at_elischer.org> wrote: > Julian Elischer wrote: [..] >> Anyone with ideas as to how to make the port act reliably? Check out __builtin_return_address() and __builtin_frame_pointer(). Or look at src/sys/i386/i386/stack_machdep.c (it is present on all platforms). info gcc -> 'C Extensions' -> 'Return Address' -- Built-in Function: void * __builtin_return_address (unsigned int LEVEL) This function returns the return address of the current function, or of one of its callers. .. -- Built-in Function: void * __builtin_frame_address (unsigned int LEVEL) This function is similar to `__builtin_return_address', but it returns the address of the function frame rather than the return address of the function. __builtin_frame_address() on i386 is basically: register_t ebp; __asm __volatile("movl %%ebp,%0" : "=r" (ebp)); or for amd64: register_t rbp; __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); -- Peter Wemm - peter_at_wemm.org; peter_at_FreeBSD.org; peter_at_yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert SewellReceived on Sat Jun 14 2008 - 07:02:09 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC