RE: single-step issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

> -----Original Message-----
> From: Hollis Blanchard [mailto:hollisb@xxxxxxxxxx] 
> Sent: Wednesday, May 06, 2009 3:21 AM
> To: Liu Yu-B13201
> Subject: single-step issue
> 
> The e500 user manual (section 5.11.1, e500 Exception Priorities) says
> that Debug interrupts have higher priority than Program interrupts.
> However, that only matters if both exceptions exist at the same time,
> which I don't think is true in this case.
> 
> Ordinarily, the debug interrupt should occur *after* the 
> effects of the
> instruction have occurred. So I would expect that, when 
> single-stepping
> through a privileged guest instruction, you would get the program
> interrupt simply because the instruction can't be executed (therefore
> the debug interrupt couldn't possibly occur). That matches 
> the behavior
> you've seen, correct?
> 
> Solution: after emulate_instruction() in the Program handler succeeds,
> check vcpu->your_debug_flags to see if control should return 
> to qemu/gdb
> instead of back to the guest.
> 

Sorry for the late reply, I got some urgent work to deal with.

Yes. I should use CSRR0 to get next pc in single-step mode.
And it works well in normal case.

The problem I met is that when guest meet a privilege instructions,
The CSRR0 give out a strange address which should not be used to enter
into guest.

And I find it out now.
When guest meet a privilege instructions,
first the program interrupt occurs, but immediately after it, a debug
interrupt occurs,
and the CSRR0 is filled with the value of "kvmppc_booke_handlers +
ivor[IVOR6]" (kvmppc program interrupt handler),
which is indeed the next instruction of guest privilege instruction....

I guess the reason is that program interrupt doesn't clear MSR[DE] bit,
right?
If so, then we cannot check vcpu->debug_flags to see if control should
return to qemu/gdb.
Should we emulate privilege instructions in debug interrupt handler?

One thing I still don't get clear is that: does MSR[DE] is set while
running guest?
I see nowhere set it, but all kinds of debug interrupt seem could work.





--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux