[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Implementation of single-stepping for Xen on ARMv7
Hello Julien, thank you for your answer and sorry for the delay.2017-06-14 14:26 GMT+02:00 Julien Grall <julien.grall@xxxxxxx>:
Yes I'm trying to implement guest single stepping.
Ok thats good to hear. As mentioned, my approach is to extend the xen_access test file. Which sets the registers in the Monitor.c in /xen/xen/arch/arm (so from within the Hypervisor). Startet is this routin from DOM0. So the execution starts in /tools/tests/xen-access and gets
forwarded to this function. I "trigger" this event by starting the
compiled xen-access.com file from within the Dom0 But I'm not quite sure whether this is what you wanted to know. Also, would you mind to share your code? Here are the important parts: This is the extended Switch-Case in monitor.c/arch_monitor_domctl_event() +++ Github/xen/xen/arch/arm/monitor.c 2017-06-19 14:40:41.156356471 +0200 @@ -28,6 +28,7 @@ struct xen_domctl_monitor_op *mop) { struct arch_domain *ad = &d->arch; bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); switch ( mop->event ) @@ -45,6 +46,124 @@ break; } + case XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP: + { + //Set Debug to Linked Addres + //See AARM C3.3.7 Linked comparisons for [...] + + //Example on ARM ARM 2051 + + gprintk(XENLOG_ERR, "Setup HypTrap Route done\n"); + gprintk(XENLOG_ERR, "[Before] Reading HDCR: 0x%x\n", READ_SYSREG( HDCR)); + gprintk(XENLOG_ERR, "[Before] Reading DBGBCR2: 0x%x\n", READ_SYSREG( p14,0,c0,c0,5)); + gprintk(XENLOG_ERR, "[Before] Reading DBGBVR: 0x%x\n", READ_SYSREG( p14,0,c0,c0,4)); + gprintk(XENLOG_ERR, "[Before] Reading DBGDSCREXT:0x%x\n", READ_SYSREG(DBGDSCREXT)); + + + //Route Exceptions to Hypervisor + WRITE_SYSREG(READ_SYSREG(HDCR) | HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TDE, HDCR) + + + //DBGBCR2 = (p14,0,c0,c2,5)== Unliked Address Mismatch: 0b0100==0x404007 + //(linked: 0b0101) -> + //PCM: Bit 1,2 -> Value=0b11 -> PL0/PL1 + //HCM: Bit 13 -> Value=0b00 -> No HypMode Trap + //SSC: Bit 14/15 -> Value 0b01 -> NonSecure only + //BAS: ARM + Address + BAS=0b0000 -> Mismatch Hit (2047) + // Res mask BT LBN SSC HCM SBZP BAS RES PMC E + // 000 00000 0101 0011 01 0 0000 0000 00 11 1 = 0x534007 + // 000 00000 0100 0000 01 0 0000 0000 00 11 1 = 0x404007 + // 000 00000 0100 0000 00 0 0000 1111 00 11 1 = 0x4001E7 (DBG SingleStep) + + //initalize BP + WRITE_SYSREG(0x404007, p14,0,c0,c0,5); + + + + //BVR: Breakpoint value register + // TODO: 1³² or 0³² as BVR1 Address? + // Instruction Address Res + // 111111111111111111111111111111 00 + //DBGBVR0 = p14,0,c0,c2,4 + + WRITE_SYSREG(~0x3,p14,0,c0,c0,4); + + //DBGDSCR = Enable Invasive Debug + Monitor Mode + //MDBGen[15] = 1 + //HDBGen[14] = 0 + //MOE[5:2] = 0b0001 + //DBGack[10] = 1 DebugAcknowledge -> forced BP to give signal (Read as UNpredigtable) + //0000 0000 0000 0000 0100 1000 00 0001 00 = 0x8004 (mit DBGACK=0x4404) + // 0010 0000 0100 0100 0000 00 0001 10 + + WRITE_SYSREG(0x8000,DBGDSCREXT); + //Enable BP by setting DBGBCR0.E = 1 + WRITE_SYSREG(READ_SYSREG(p14,0,c0,c0,5) | 1,p14,0,c0,c0,5 ); + isb(); + gprintk(XENLOG_ERR, "[After] Reading DBGAUTHSTATUS:0x%x\n", READ_SYSREG(p14, 0, c7, c14, 6)); + gprintk(XENLOG_ERR, "[After] Reading HDCR: 0x%x\n", READ_SYSREG( HDCR)); + gprintk(XENLOG_ERR, "[After] Reading DBGBCR2: 0x%x\n", READ_SYSREG( p14,0,c0,c0,5)); + //gprintk(XENLOG_ERR, "[After] Reading DBGBCR3: 0x%x\n", READ_SYSREG( p14,0,c0,c3,5)); + gprintk(XENLOG_ERR, "[After] Reading DBGBVR: 0x%x\n", READ_SYSREG( p14,0,c0,c0,4)); + gprintk(XENLOG_ERR, "[After] Reading DBGDSCREXT:0x%x\n", READ_SYSREG(DBGDSCREXT)); + gprintk(XENLOG_ERR, "[After] Reading DBGDIDR: 0x%x\n", READ_SYSREG(DBGDIDR)); + + + + return 0; + } Greetings and thank you again for your help Florian _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |