Re: accessing Alpha CPU registers from panic()

Andrea Arcangeli (andrea@suse.de)
Sun, 19 Dec 1999 18:13:32 +0100 (CET)


On Wed, 15 Dec 1999, Brian Hall wrote:

>I am working on porting the SGI crash tools to Alpha. Since the CPU registers
>aren't available from within the panic() call, I need to grab them directly.
>How do I do this? The equivalent i386 code is:
>
> /* save the dump specific esp/eip */
> /* For Alpha, save PC (Program Counter) and RA */
> __asm__ __volatile__("
> pushl %%eax\n
> movl %%esp, %%eax\n
> movl %%eax, %0\n
> popl %%eax\n"
> : "=g" (dump_header.dh_esp)
> );
> __asm__ __volatile__("pushl %eax\n");
> __dump_save_panic_regs();
> __asm__ __volatile__("popl %eax\n");

The above code has nothing to do with eip.

To get sp on alpha you can read $30:

#define get_stack_address() \
({ \
register unsigned long sp; \
asm("bis $30,$30,%0" : "=r" (sp)); \
sp; \
})

and then:

unsigned long sp = get_stack_address();

To get EIP just use C:

main()
{
__label__ here1, here2;

here1:
printf("%p %p\n", &&here1, &&here2);
here2:
}

To write EIP use `goto here1` or `goto here2` 8)

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/