* stack frame for interrupts/exceptions in PPC
@ 2004-04-28 1:11 Tameen Khan
2004-04-28 2:07 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Tameen Khan @ 2004-04-28 1:11 UTC (permalink / raw)
To: 'linuxppc-dev list'
I am tryting to implement kernel backtracing for PPC.
I need to understand how the process kernel stack/interrupt stack is managed
for PPC in the event of interrupts and exceptions.
ANY pointer to docs/code etc explaining above topic will be appreciated.
What is STACK_FRAME_OVERHEAD_PPC used for??? Its defined to be 16 for PPC
and 112 for PPC64.
I'm have the following issues right now.
1) How to identify stack frames which need special handling. For PPC64 if
the function name is .ret_from_syscall_1 or .ret_from_except, it is deemed
to be an interrupt_frame and handled seperately. There is also special
handling for frame __switch_to.
2) How to get the newpc, newlr and newsp values for these special frames.
Code used for PPC64 is given below.
nip_offset = byte offset of nip in struct pt_regs
r1_offset = byte offset of r1 in struct pt_regs
lr_offset = byte offset of lr in struct pt_regs
if (interrupt_frame) {
newpc = KL_VREAD_PTR(sp +
KL_STACK_FRAME_OVERHEAD_PPC +
nip_offset);
newsp = KL_VREAD_PTR(sp +
KL_STACK_FRAME_OVERHEAD_PPC +
r1_offset);
newlr = KL_VREAD_PTR(sp +
KL_STACK_FRAME_OVERHEAD_PPC +
lr_offset);
frm_size = get_frame_size(sp, newsp, saddr);
}
Thanks
Tameen
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: stack frame for interrupts/exceptions in PPC
2004-04-28 1:11 stack frame for interrupts/exceptions in PPC Tameen Khan
@ 2004-04-28 2:07 ` Benjamin Herrenschmidt
2004-04-28 17:41 ` Tameen Khan
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2004-04-28 2:07 UTC (permalink / raw)
To: Tameen Khan; +Cc: 'linuxppc-dev list'
On Wed, 2004-04-28 at 11:11, Tameen Khan wrote:
> I am tryting to implement kernel backtracing for PPC.
What do you mean ? There is already working backtrace code in the
kernel, both in the Oops code and in xmon.
> I need to understand how the process kernel stack/interrupt stack is managed
> for PPC in the event of interrupts and exceptions.
> ANY pointer to docs/code etc explaining above topic will be appreciated.
Look at xmon code :) You can find the docs for the ppc32 strackframe in
the SysV ABI or the LSB (Linux Standard Base). You can also look at
gcc's rs6000.{c,h}, there are some nice ascii art in there.
> What is STACK_FRAME_OVERHEAD_PPC used for??? Its defined to be 16 for PPC
> and 112 for PPC64.
It's the location of the pt_regs on the stack frame. When taking an
interrupt, we lower SP by the INT_FRAME_SIZE (that also accounts for
the redzone) and we store the registers at SP + STACK_FRAME_OVERHEAD,
this "overhead" is the size of a minimum caller stackframe, large enough
for the callee to store whatever it may store in the parent stackframe
without affecting the pt_regs values.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: stack frame for interrupts/exceptions in PPC
2004-04-28 2:07 ` Benjamin Herrenschmidt
@ 2004-04-28 17:41 ` Tameen Khan
2004-04-29 16:31 ` linas
0 siblings, 1 reply; 4+ messages in thread
From: Tameen Khan @ 2004-04-28 17:41 UTC (permalink / raw)
To: 'Benjamin Herrenschmidt'; +Cc: 'linuxppc-dev list'
> > > I am tryting to implement kernel backtracing for PPC.
>
> What do you mean ? There is already working backtrace code in
> the kernel, both in the Oops code and in xmon.
Did not know that. Am new to linux and ppc.
I'm porting lkcdutils for PPC. It picks up a kernal core dump and among
other things has to generate backtraces from it.
Thanks for the info
Tameen
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: stack frame for interrupts/exceptions in PPC
2004-04-28 17:41 ` Tameen Khan
@ 2004-04-29 16:31 ` linas
0 siblings, 0 replies; 4+ messages in thread
From: linas @ 2004-04-29 16:31 UTC (permalink / raw)
To: Tameen Khan
Cc: 'Benjamin Herrenschmidt', 'linuxppc-dev list',
hbabu
On Wed, Apr 28, 2004 at 10:41:32AM -0700, Tameen Khan wrote:
>
> > > > I am tryting to implement kernel backtracing for PPC.
> >
> > What do you mean ? There is already working backtrace code in
> > the kernel, both in the Oops code and in xmon.
and KDB too...
> Did not know that. Am new to linux and ppc.
> I'm porting lkcdutils for PPC. It picks up a kernal core dump and among
> other things has to generate backtraces from it.
You may want to talk to Haren Myneni <hbabu@us.ibm.com>
who I beleive is also working LKCD on PPC64
--linas
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-04-29 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-28 1:11 stack frame for interrupts/exceptions in PPC Tameen Khan
2004-04-28 2:07 ` Benjamin Herrenschmidt
2004-04-28 17:41 ` Tameen Khan
2004-04-29 16:31 ` linas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).