The ciad helper was a stub, so executing a ciad instruction aborted QEMU.

The full ciad behavior also clears the pending interrupt in the
l2vic, but the l2vic device is not modelled yet, so log it for now.

Signed-off-by: Brian Cain <[email protected]>
---
 target/hexagon/op_helper.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
index 125952aee59..7f6e561eced 100644
--- a/target/hexagon/op_helper.c
+++ b/target/hexagon/op_helper.c
@@ -1557,7 +1557,24 @@ void HELPER(raise_stack_overflow)(CPUHexagonState *env, 
uint32_t slot,
 
 void HELPER(ciad)(CPUHexagonState *env, uint32_t mask)
 {
-    g_assert_not_reached();
+    uint32_t ipendad;
+    uint32_t iad;
+    HexagonCPU *cpu;
+
+    BQL_LOCK_GUARD();
+    cpu = env_archcpu(env);
+    ipendad = hexagon_globalreg_read(cpu->globalregs, HEX_SREG_IPENDAD,
+                                     env->threadId);
+    iad = fGET_FIELD(ipendad, IPENDAD_IAD);
+    fSET_FIELD(ipendad, IPENDAD_IAD, iad & ~mask);
+    hexagon_globalreg_write(cpu->globalregs, HEX_SREG_IPENDAD,
+                            ipendad, env->threadId);
+
+    qemu_log_mask(LOG_UNIMP,
+                  "%s: l2vic clear-interrupt effect not implemented "
+                  "(mask=0x%" PRIx32 ")\n", __func__, mask);
+
+    hex_interrupt_update(env);
 }
 
 void HELPER(siad)(CPUHexagonState *env, uint32_t mask)
-- 
2.34.1

Reply via email to