This is an automated email from Gerrit. Alamy Liu ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/3308
-- gerrit commit d723d0b7afff8a8ab0e4a4341a1fc34487782b30 Author: Alamy Liu <[email protected]> Date: Thu Oct 8 09:53:54 2015 -0700 armv8: Add EDSCR helper functions armv8_edscr_to_core_state() armv8_is_pe_status_valid() Change-Id: I2fcdaf14dfc022f956e2b3d9f5f4030b07fccef4 Signed-off-by: Alamy Liu <[email protected]> diff --git a/src/target/armv8.h b/src/target/armv8.h index 24fdf19..76046a0 100644 --- a/src/target/armv8.h +++ b/src/target/armv8.h @@ -474,6 +474,56 @@ target_to_armv8(struct target *target) return container_of(target->arch_info, struct armv8_common, arm); } +static inline enum arm_state armv8_edscr_to_core_state(uint32_t edscr) +{ + uint8_t edscr_rw = EDSCR_RW(edscr); + uint8_t edscr_el = EDSCR_EL(edscr); + + /* In Debug state, each bit gives the current Execution state of each EL */ + if ((edscr_rw >> edscr_el) & 0b1) + return ARM_STATE_AARCH64; + else + return ARM_STATE_ARM; /* AARCH32 */ +} + +/* + * DDI0487A_f_armv8_arm.pdf + * H9.2.41 EDSCR, External Debug Status and Control Register + * + * Valid PE status values are: + * bit[5:4] bit[3:0] + * 00 0001 0010 0111 + * 01 0011, 1011, 1111 + * 10 0011, 0111, 1011, 1111 + * 11 0011, 0111, 1011 + */ +static inline bool armv8_is_pe_status_valid(uint32_t edscr) +{ + uint16_t status = (edscr & 0b111111); + uint16_t status_bit54 = (status & 0b110000) >> 4; /* bits[5:4] */ + uint16_t status_bit30 = (status & 0b001111); /* bits[3:0] */ + uint16_t status_bit10 = (status & 0b000011); /* bits[1:0] */ + + if (status_bit54 == 0b00) { + /* 3 special cases */ + if ((status_bit30 == 0b0010) || (status == 0b0001) || (status == 0b0111)) + return true; + else + return false; + } else if (status_bit10 == 0b11) { + /* Mostly valid, except 0b010011 & 0b111111 */ + if ((status == 0b010111) || (status == 0b111111)) + return false; + else + return true; + } else { + /* All other values are reserved: invalid */ + return false; + } + + return false; +} + /* register offsets from armv8.debug_base */ -- ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
