On Samstag, 27. Juli 2019 22:53:03 CEST Lucas Jenss wrote:
> Hey folks,
> 
> I'm currently trying to get JTAG debugging of a Raspberry Pi 3 to work
> properly, and ran into an issue. When issuing debug commands with GDB,
> such as single step while the processor is in user mode (0x10), I'm
> getting:
> 
>       error: cannot read system control register in this mode
> 
> While the single-step is still executed (the program counter advances),
> GDB acts as if the single step is never completed, so I have to hit ^C
> again to see the new state.
> 
> My question is: why does "aarch64_post_debug_entry" _need_ to read the
> system control register. I do see that further down in the function
> there's internal state being updated, but I have no idea of what the
> implications are of not being able to update this state. As an
> experiment, I changed the "return ERROR_FAIL" to "return ERROR_OK" after
> the "error: cannot read system control register in this mode" message,
> and stepping is now working properly for my limited use case.
> 
> Some insight into why this is written this way, or where I can learn
> more would be greatly appreciated!

The system control register is needed to determine the internal state of the 
MMU, which 
is required for breakpoint handling and virt2phys conversion in certain cases. 
So it needs 
to be read after entering debug state. It cannot be read in user space because 
it's a 
privileged register (don't want userspace to mess with the MMU of course).

If the target is stopped in 64bit userspace mode (EL0T),  the debugger will 
switch the 
target to EL1T read the SCTLR register and switch back to EL0T.

However, in your case the target seems to stop in 32bit user mode and there's 
no code to 
cope with that.

BR,
Matthias

> 
> Cheers and have a great weekend,
> Lucas
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> OpenOCD-devel mailing list
> OpenOCD-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openocd-devel


-- 
Mit freundlichen Grüßen/Best regards,

Matthias Welwarsky
Project Engineer

SYSGO AG
Office Mainz
Am Pfaffenstein 14 / D-55270 Klein-Winternheim / Germany
Phone: +49-6136-9948-0 / Fax: +49-6136-9948-10
VoIP: SIP:m...@sysgo.com
E-mail: matthias.welwar...@sysgo.com / Web: http://www.sysgo.com
_________________________________________________________________________________
 Web: 
https://www.sysgo.com
Blog: https://www.sysgo.com/blog
Events: https://www.sysgo.com/events
Newsletter: https://www.sysgo.com/newsletter 
_________________________________________________________________________________
 
Handelsregister/Commercial Registry: HRB Mainz 90 HRB 48884 Geschäftsführung/
Managing Directors: Etienne Butery (CEO), Kai Sablotny (COO) 
USt-Id-Nr./VAT-Id-No.: DE 
149062328
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to