qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
@ 2015-09-14 10:53 Sergey Fedorov
  2015-09-18 14:08 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Fedorov @ 2015-09-14 10:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sergey Fedorov, Peter Maydell

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-16 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 10:53 [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el() Sergey Fedorov
2015-09-18 14:08 ` 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

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).