2008-12-13 15:48:20

by Pei Lin

[permalink] [raw]
Subject: when interrupt came, the kernel save pt_regs->eip always the same?

HI,
These day i wanted get cpu context ,when interrupt came.BUT i
found when interrupt came kernel saved cpu context in struct pt_regs
and delivered to do_IRQ ,and i print the pt_regs->eip,they alway same
on the same interrupt?
The interrupt can come anytime,i think the eip will be very
different every time.BUT i debug kernel ,print eip in the function
do_IRQ,found it didn't run as i thought.Can anybody tell me why?


sincerely yours


2008-12-13 16:56:16

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: when interrupt came, the kernel save pt_regs->eip always the same?

On Sat, 13 Dec 2008, pl ice wrote:

> HI,
> These day i wanted get cpu context ,when interrupt came.BUT i
> found when interrupt came kernel saved cpu context in struct pt_regs
> and delivered to do_IRQ ,and i print the pt_regs->eip,they alway same
> on the same interrupt?
> The interrupt can come anytime,i think the eip will be very
> different every time.BUT i debug kernel ,print eip in the function
> do_IRQ,found it didn't run as i thought.Can anybody tell me why?

If the cpu is idle, you have a higher probability that the idle function
is in regs->eip

Zwane

2008-12-14 02:59:54

by Pei Lin

[permalink] [raw]
Subject: Re: when interrupt came, the kernel save pt_regs->eip always the same?

And the prototype about irq_handler changed, the 3th parameter "struct
pt_regs" removed,How do i get the struct pt_regs in my interrupt
handler because kernel doesn't deliver to me?

2008/12/14 Zwane Mwaikambo <[email protected]>:
> On Sat, 13 Dec 2008, pl ice wrote:
>
>> HI,
>> These day i wanted get cpu context ,when interrupt came.BUT i
>> found when interrupt came kernel saved cpu context in struct pt_regs
>> and delivered to do_IRQ ,and i print the pt_regs->eip,they alway same
>> on the same interrupt?
>> The interrupt can come anytime,i think the eip will be very
>> different every time.BUT i debug kernel ,print eip in the function
>> do_IRQ,found it didn't run as i thought.Can anybody tell me why?
>
> If the cpu is idle, you have a higher probability that the idle function
> is in regs->eip
>
> Zwane
>

2008-12-21 20:11:39

by Jiri Slaby

[permalink] [raw]
Subject: Re: when interrupt came, the kernel save pt_regs->eip always the same?

Sorry for the repost, following the thread now.
BTW. do not top-post.

On 12/14/2008 03:59 AM, pl ice wrote:
> And the prototype about irq_handler changed, the 3th parameter "struct
> pt_regs" removed,How do i get the struct pt_regs in my interrupt
> handler because kernel doesn't deliver to me?

get_irq_regs() should do that.