WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Question related to Single-step execution and Emulation

To: abhinavs_iitkgp@xxxxxxxxxxx
Subject: Re: [Xen-devel] Question related to Single-step execution and Emulation
From: "Grzegorz Miłoś" <gm281@xxxxxxxxx>
Date: Tue, 24 Jun 2008 10:21:19 +0100
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 24 Jun 2008 02:21:41 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=jIiIDPOJs+kRvTYjdL8Ah9qnVv5ezBtcc26S6pujhi4=; b=nKHEuhiazOo3fVJuMby/jE0GTNk0bidbrBNxsb0TJVKEqrZrbVO0T9QZ8y9/fA1WPn msWRtzg+OQ5cIexs2Ju4b1iwQcbnVOxzmKIstgKIzrJNCceVr7tN0XPh1djNMYATypE6 d/OGuJcIbn9CXwoAHeMABJ11mK9jpJ/ez6OGQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=wquxgfN86OoB1IIEuR+sigRI8SGqP2R3qk/ghNoHL5KNmchTwGd+kMK+kI7Rd+Ixqo p3VGVPMl7EVdPi5Uw6PR7I+maxwaTA5lCW3vcucrSLLTzMbSWRieXc5JJbn9pnXUHOja WMnDvt50wJgmMePIrwe/1UjClFjXrjvFHNXmQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <959752.87355.qm@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <959752.87355.qm@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Are you working with an HVM or PV domain?
Gr(z)egor(z)

>
> Hi all,
>
>
> I am trying to perform single-stepping and instruction emulation both in 
> Xen-3.2.1. I am using the following approach:
>
> First, I mark a guest page "not present" inside the shadow page table so that 
> I could intercept any operation that involves this page. When the guest tries 
> to access that page, it faults and control goes to Xen (sh_page_fault 
> function). There, I emulate that operation and return the control to guest to 
> execute next instruction. I could get my first part working.
>
> In the second part after emulating the instruction inside Xen, I want to 
> perform single-step execution from next instruction onwards so that I could 
> monitor further execution of guest from that point.
>
> To achieve that I did following: After emulating an instruction inside Xen 
> and before sending the control back to guest OS, I set the EFLAGS's trap bit 
> set by doing following operation:
>
> regs->eflag |= X86_EFLAGS_TF
>
> And return the control from sh_page_fault function by saying "return 
> EFAULT_FIXED".
>
> My understanding is that with this flag set when guest completes the 
> execution of the next instruction, it traps to Xen with exit reason 
> TRAP_debug and do_debug handler should be invoked inside x86/traps.c. From 
> there, again I set X86_EFLAGS_TF flag to get guest trapped for next 
> instruction and so on. When i want it to be end I will set X86_EFLAGS_RF flag.
>
> However, when I perform above-mentioned procedure I get to see a message 
> "Trace/breakpoint trap" in my guest OS only once and my do_debug or 
> (debugger_trap_entry method with vector = Trap_debug) does not get invoked at 
> all inside Xen. Since trap is not coming into Xen, I am not able to get the 
> control after execution of instructions.
>
> It seems like with my above-described method, I am injecting TRAP_debug 
> exception for the instruction that I emulate inside the Xen. And, eflag is 
> not set in the context of next instruction that will be executed inside the 
> guest, which should trap with debug exception.

>
>
> It would be great if someone could explain me what i am doing wrong here and 
> if yes what would be the right approach to perform single-step execution in 
> Xen.
>
>
> Thanks in advance.
>
> Regards,
> Abhinav
>
>
>
>      Explore your hobbies and interests. Go to 
> http://in.promos.yahoo.com/groups/
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>