This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposed change to ppc32 ucontext_t


On Thu, Sep 11, 2003 at 11:36:42AM -0700, Geoff Keating wrote:
> Paul Mackerras <paulus@samba.org> writes:
> 
> > Since we made the change to the ucontext_t on ppc32 to expand it to
> > include space for all of the registers, I have received some bug
> > reports about the change having broken source compatibility.  In
> > particular some programs were using ucp->uc_mcontext.regs to get at
> > the register values in a SIGSEGV handler.
> 
> Many programs built with GCC can do this.  The code looks like:
> 
>     else if (*(unsigned int *) (pc_+0) == 0x38006666                    \
>              || *(unsigned int *) (pc_+0) == 0x380000AC)                \
>       {                                                                 \
>         struct rt_sigframe {                                            \
>           char gap[SIGNAL_FRAMESIZE];                                   \
>           unsigned long _unused[2];                                     \
>           struct siginfo *pinfo;                                        \
>           void *puc;                                                    \
>           struct siginfo info;                                          \
>           struct kernel_old_ucontext uc;                                \
>         } *rt_ = (CONTEXT)->cfa;                                        \
>         sc_ = &rt_->uc.uc_mcontext;                                     \
>       }                                                                 \
> ...
>     new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM];                    \
> [more uses of sc_->regs]
> 
> This code will be used in applications that throw exceptions from
> signal handlers, most notably anything using the gcj runtime.  You can
> find it in the GCC source tree in gcc/config/rs6000/linux.h.

Fortunately, I think this remains compatible with both the old and new
ways - I had a bad turn when I first looked at it, but it's accessing
everything through ->regs in the same way.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]