From: Sergey Fedorov <serge.fdrv@gmail.com>
To: qemu-devel@nongnu.org
Cc: Sergey Fedorov <serge.fdrv@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
Date: Mon, 14 Sep 2015 13:53:48 +0300 [thread overview]
Message-ID: <1442228028-11622-1-git-send-email-serge.fdrv@gmail.com> (raw)
Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
description of routing debug exceptions.
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
---
target-arm/cpu.h | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 31825d3..84d38b1 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1692,7 +1692,22 @@ static inline int cpu_mmu_index(CPUARMState *env)
*/
static inline int arm_debug_target_el(CPUARMState *env)
{
- return 1;
+ bool secure = arm_is_secure(env);
+ bool route_to_el2 = false;
+
+ if (arm_feature(env, ARM_FEATURE_EL2) && !secure) {
+ route_to_el2 = env->cp15.hcr_el2 & HCR_TGE ||
+ env->cp15.mdcr_el2 & (1 << 8);
+ }
+
+ if (route_to_el2) {
+ return 2;
+ } else if (arm_feature(env, ARM_FEATURE_EL3) &&
+ !arm_el_is_aa64(env, 3) && secure) {
+ return 3;
+ } else {
+ return 1;
+ }
}
static inline bool aa64_generate_debug_exceptions(CPUARMState *env)
--
1.9.1
next reply other threads:[~2015-09-14 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 10:53 Sergey Fedorov [this message]
2015-09-18 14:08 ` [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el() Peter Maydell
2015-09-18 14:11 ` Peter Maydell
2015-09-18 15:57 ` Sergey Fedorov
2015-09-18 16:15 ` Sergey Fedorov
2015-09-18 16:35 ` Peter Maydell
2015-09-19 13:28 ` Edgar E. Iglesias
2015-10-16 12:08 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442228028-11622-1-git-send-email-serge.fdrv@gmail.com \
--to=serge.fdrv@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).