On 3/17/2025 1:43 PM, [email protected] wrote:
-----Original Message----- From: Brian Cain <[email protected]> Sent: Friday, February 28, 2025 11:28 PM To: [email protected] Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Brian Cain <[email protected]> Subject: [PATCH 08/39] target/hexagon: Implement get_exe_mode() From: Brian Cain <[email protected]> Signed-off-by: Brian Cain <[email protected]>diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c index e64568b9fc..e0dd120cd4 100644 --- a/target/hexagon/cpu_helper.c +++ b/target/hexagon/cpu_helper.c @@ -237,6 +237,30 @@ void hexagon_ssr_set_cause(CPUHexagonState *env, uint32_t cause) int get_exe_mode(CPUHexagonState *env) { + g_assert(bql_locked()); + + target_ulong modectl = arch_get_system_reg(env, HEX_SREG_MODECTL); + uint32_t thread_enabled_mask = GET_FIELD(MODECTL_E, modectl); + bool E_bit = thread_enabled_mask & (0x1 << env->threadId); + uint32_t thread_wait_mask = GET_FIELD(MODECTL_W, modectl); + bool W_bit = thread_wait_mask & (0x1 << env->threadId); + target_ulong isdbst = arch_get_system_reg(env, HEX_SREG_ISDBST); + uint32_t debugmode = GET_FIELD(ISDBST_DEBUGMODE, isdbst); + bool D_bit = debugmode & (0x1 << env->threadId); + + /* Figure 4-2 */Figure 4-2 in which document?
I don't think that document with this figure is published. I'll just remove the reference instead.
Otherwise Reviewed-by: Taylor Simpson <[email protected]>
