This is an automated email from Gerrit.

Matthias Welwarsky ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/3985

-- gerrit

commit 48b092ad5c851d7fcc8e0b1dce8cc56c39b8c95a
Author: Matthias Welwarsky <[email protected]>
Date:   Tue Nov 15 22:10:03 2016 +0100

    aarch64: optimize core state detection
    
    Replace loop by right-shift.
    Inspired by patch from Alamy Liu
    
    Change-Id: I1285f4f54c0695a93fa42e9863ed8ffa4de00f70
    Signed-off-by: Matthias Welwarsky <[email protected]>

diff --git a/src/target/armv8_dpm.c b/src/target/armv8_dpm.c
index 56e2eb8..ac53460 100644
--- a/src/target/armv8_dpm.c
+++ b/src/target/armv8_dpm.c
@@ -51,17 +51,11 @@ enum arm_state armv8_dpm_get_core_state(struct arm_dpm *dpm)
 {
        int el = (dpm->dscr >> 8) & 0x3;
        int rw = (dpm->dscr >> 10) & 0xF;
-       int pos;
 
        dpm->last_el = el;
 
-       /* find the first '0' in DSCR.RW */
-       for (pos = 3; pos >= 0; pos--) {
-               if ((rw & (1 << pos)) == 0)
-                       break;
-       }
-
-       if (el > pos)
+       /* In Debug state, each bit gives the current Execution state of each 
EL */
+       if ((rw >> el) & 0b1)
                return ARM_STATE_AARCH64;
 
        return ARM_STATE_ARM;

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to