]> git.sur5r.net Git - openocd/commit - src/target/cortex_a.c
cortex_a: replace cortex_a_check_address function
authorMatthias Welwarsky <matthias@welwarsky.de>
Tue, 24 Nov 2015 14:59:59 +0000 (15:59 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Mon, 30 Nov 2015 10:07:54 +0000 (10:07 +0000)
commit8b140fd724e96392b5903f00eab24ec801c7dcc9
treef9012e4c9195d3cbab2d1ce95530642445cab096
parent3683f8cef09f389ed840f2dbef5bd1749b60a16f
cortex_a: replace cortex_a_check_address function

When accessing memory through the ARM core, privilege levels and mmu
access permissions observed. Thus it depends on the current mode of the
ARM core whether an access is possible or not. the ARM in USR mode can
not access memory mapped to a higher privilege level. This means, if the
ARM core is halted while executing at PL0, the debugger would be
prevented from setting a breakpoint at an address with a higher privilege
level, e.g. in the OS kernel. This is not desirable.

cortex_a_check_address() tried to work around this by predicting if an
access would fail and switched the ARM core to SVC mode. However, the
prediction was based on hardcoded address ranges and only worked for
Linux and a 3G/1G user/kernel space split.

This patch changes the policy to always switch to SVC mode for memory
accesses. It introduces two functions cortex_a_prep_memaccess() and
cortex_a_post_memaccess() which bracket memory reads and writes. These
function encapsulate all actions necessary for preparation and cleanup.

Change-Id: I4ccdb5fd17eadeb2b66ae28caaf0ccd2d014eaa9
Signed-off-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-on: http://openocd.zylin.com/3119
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
src/target/armv7a.c
src/target/armv7a.h
src/target/cortex_a.c