From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ea6f1c490b7a1aa1 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-08-12 07:06:43 PST Newsgroups: comp.sys.dec Path: gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!decwrl!pa.dec.com!e2big.mko.dec.com!jac.nuo.dec.com!btgmax.zko.dec.com!cowan From: cowan@btgmax.zko.dec.com (Ken Cowan) Subject: Re: How to find *address* of return address on stack? Message-ID: <1993Aug12.134343.27616@jac.nuo.dec.com> Sender: news@jac.nuo.dec.com (USENET News System) Reply-To: cowan@btgmax.zko.dec.com (Ken Cowan) Organization: Digital Equipment Corporation References: <9308121257.AA25930@moose.usmcs.maine.edu> Date: Thu, 12 Aug 1993 13:43:43 GMT In article <9308121257.AA25930@moose.usmcs.maine.edu>, swanton@moose.usmcs.maine.edu (George P. Swanton) writes: |>Can anyone suggest a reliable method to determine the offset of the |>return address within a stack frame given a stack pointer? |>(This is for the Decstation 3000/400 AXP w/OSF/1 and needn't be portable) |> |>Basically we're trying to get a package working that does it's own threads |>(csim). It doesn't use setjmp/longjmp, rather it copies hunks of the |>stack around and tweaks the return address so a thread 'returns' to a |>particular cleanup function instead of the procedure the created it. |> |>We've found enogh info in the exception package to find stack frames |>and *get* ra's but we need to be able to get the *address* of the ra |>on the stack. |> |>I've RTF'd the online version of the assembly language reference, |>the man pages dealing with most of the exc_ routines and the related |>*.h files. We are in the process of acquiring the 600p tech reference |>so please don't suggest that (though quotes from the same would be |>marvelous). |> |>Any suggestions greatly appreciated. |>gps |>swanton@moose.usmcs.maine.edu |> |> You really need the Alpha OSF/1 calling standard. This level of implementation is very complicated and tends to have very obscure, precise rules. There are at least some procedures that have no stack at all. They keep the return address in a register denoted by the return address register field of the procedure descriptor. -- Ken Cowan, ZK2-3/Q8 cowan@rtl.enet.dec.com Digital Equipment Corporation decwrl!rtl!cowan 110 Spit Brook Rd, Nashua, NH 03062