[Top] [All Lists]

Reg Hardware context and Signal Handlers

Subject: Reg Hardware context and Signal Handlers
From: Prasad Venkata Boddupalli <bprasad@CS.Arizona.EDU>
Date: Sat, 15 Oct 2005 02:19:58 -0700 (MST)
Original-recipient: rfc822;
I am reading the program counter value from the hardware context passed as
the third argument to the signal handler. It doesn't seem to the same
value being set in setup_sigcontext() function in

I am using kernel version 2.6.6-rc3 and,

I printed out the PC twice, once in the kernel (signal.c)

#include <asm/ucontext.h>
setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, ...) {

    regs->regs[ 5] = (unsigned long) &frame->rs_info;
    regs->regs[ 6] = (unsigned long) &frame->rs_uc;

    printk("SIG deliver pc=0x%llx\n",
          ((((struct ucontext *)regs->regs[6])->uc_mcontext).sc_pc));

    regs->regs[29] = (unsigned long) frame;

    force_sig(SIGSEGV, current)

Then I get the value 0x414830 repeatedly.

I print the same in my signal handler as

#include <asm/ucontext.h>
void dispatch_timer(int signal, siginfo_t * si, void *context) {

    printf ("pc value: 0x%llx\n",
        ((struct ucontext *)context)->uc_mcontext).sc_pc);


and I see a different value '0x7ff8000000000000'.

The values (addresses) of the third argument 'context' in my signal
handler is the same (as it must be) as 'regs->regs[6]' assigned just above
the print statement in setup_rt_frame().

I saw a few comments in the file sys/ucontext.h that read

/* Don't rely on this, the interface is currently messed up and may need
to be broken to be fixed.  */

So, I am not sure if those comments still hold good. I am anyway including
the header asm/ucontext.h and 'struct ucontext' seems to be different in
the two header files.

Does this problem sound familiar or am I screwing up something ?


<Prev in Thread] Current Thread [Next in Thread>
  • Reg Hardware context and Signal Handlers, Prasad Venkata Boddupalli <=