Re: [Linux-ia64] Re: location of statcked registers after exception (superceeds previous email)

From: David Mosberger <>
Date: 2001-05-05 01:02:36
>>>>> On Thu, 3 May 2001 23:51:26 -0700 (PDT), Weihaw CHUANG <> said:

  Weihaw> Anyways the solution appears to be (again correct me if
  Weihaw> anything is brain damaged):

Note that when using ptrace() to read PT_AR_BSP, you get a pointer to
the _end_ of the backing store, i.e., you get the value of ar.bsp as
if a "cover" instruction had been executed by the target task.  Since
the task is blocked at the time you call ptrace(), the stacked
registers are indeed on the stack (they get written to the
backingstore by the "flushrs" instruction in the context switch

Thus, to read stacked register, you'd do something along the lines of:

    unsigned long *rbs_end, *bsp;

    rbs_end = ptrace(PTRACED_PEEKUSER, pid, PT_AR_BSP, 0);
    bsp = ia64_rse_skip_regs(rbs_end, -cfm.sof);
    regvalue = ptrace(PTRACE_PEEKDATA, pid,
	              ia64_rse_skip_regs(bsp, regid - 32), 0);

(The code in utrace.c is outdated in this respect.)

Received on Fri May 04 08:05:46 2001

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:03 EST