Query regarding extracting instruction which caused a data-abort exception
Stefan Kalkowski
stefan.kalkowski at ...1...
Fri Jun 23 11:42:56 CEST 2017
Hi,
On 06/23/2017 11:10 AM, rijurekha at ...71... wrote:
> Why do you say you do not save DFAR in the assembler path? Isn't DFAR
> saved in lines 15. and 27. below, while other registers are saved in line
> 3. in base-hw/src/core/spec/arm_v7/trustzone/mode_transition.s? This is
> where control will come for csu abort with
> _mon_dab_entry: _nonsecure_to_secure DAB_TYPE, 8, right?
>
> 1. .macro _nonsecure_to_secure exception_type, pc_adjust
> 2. ldr sp, _tz_client_context /* load context pointer*/
> 3. stmia sp, {r0-lr}^ /* save user regs r0-r12,sp,lr*/
> 4. add r0, sp, #15*4
> 5. .if \pc_adjust != 0 /* adjust pc if necessary*/
> 6. sub lr, lr, #\pc_adjust
> 7. .endif
> 8. stmia r0!, {lr} /* save pc*/
> 9. mrs r1, spsr /* spsr to r0*/
> 10. mov r2, #\exception_type /* exception reason to r1*/
> 11. b _nonsecure_kernel_entry
> 12. .endm /* _non_to_secure */
>
> 13. _nonsecure_kernel_entry:
> 14. stmia r0!, {r1-r2} /* save spsr, and exception reason */
> 15. mrc p15, 0, r3, c6, c0, 0 /* move DFAR to r3 */
> 16. mrc p15, 0, r4, c2, c0, 0 /* move TTBR0 to r4 */
> 17. mrc p15, 0, r5, c2, c0, 1 /* move TTBR1 to r5 */
> 18. mrc p15, 0, r6, c2, c0, 2 /* move TTBRC to r6 */
> 19. mov r1, #0
> 20. mcr p15, 0, r1, c1, c1, 0 /* disable non-secure bit */
> 21. _save_bank 27 /* save undefined banks */
> 22. _save_bank 19 /* save supervisor banks */
> 23. _save_bank 23 /* save abort banks */
> 24. _save_bank 18 /* save irq banks */
> 25. _save_bank 17 /* save fiq banks */
> 26. stmia r0!, {r8-r12} /* save fiq r8-r12 */
> 27. stmia r0!, {r3-r6} /* save MMU registers */
> 28. cps #SVC_MODE
> 29. adr r0, _tz_master_context
> 30. _restore_kernel_sp r0, r1, r2 /* apply kernel sp */
> 31. add r1, r0, #LR_OFFSET
> 32. ldm r1, {lr, pc}
Ok sorry, I was not aware anymore that we save *normal world* DFAR in
the assembly path. Anyway, what you are interested in when receiving a
data-abort in monitor mode is the *secure world* DFAR register as it
contains the security violation address. Therefore, you cannot uncomment
the overwriting of the VM state's DFAR register in the high-level C++
code, because it saves a different register. Or you add another register
value to the end of the VM state and differentiate in between secure and
normal world DFAR register.
>
> Also, is there a tutorial how to use jtag to debug genode assembly? WE
> have never used jtag, but have an olimex arm-usb-ocd-h.
No. There is nothing special about JTAG debugging Genode in contrast to
debugging any other software target, but I'm afraid debugging with
Olimex some specific ARM hardware is out of scope of this mailing list.
I have to admit that I primarily used Lauterbach, which is more
expensive but quite convenient (advertisement ends here).
Regards
Stefan
>
> Thanks!
> Riju
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> genode-main mailing list
> genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
>
--
Stefan Kalkowski
Genode Labs
https://github.com/skalk ยท http://genode.org/
More information about the users
mailing list