On 10/29/2026 12:43 PM, Marco Liebel wrote:
Add a trace event that reports the executed HLX opcode and name.

Signed-off-by: Marco Liebel <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
  meson.build                 | 1 +
  target/hexagon/helper.h     | 3 +++
  target/hexagon/op_helper.c  | 7 +++++++
  target/hexagon/trace-events | 6 ++++++
  target/hexagon/trace.h      | 2 ++
  5 files changed, 19 insertions(+)
  create mode 100644 target/hexagon/trace-events
  create mode 100644 target/hexagon/trace.h


Reviewed-by: Brian Cain <[email protected]>


diff --git a/meson.build b/meson.build
index 7ec3fb9023..71f135f053 100644
--- a/meson.build
+++ b/meson.build
@@ -3695,6 +3695,7 @@ if have_system or have_user
      'target/arm',
      'target/arm/hvf',
      'target/arm/tcg',
+    'target/hexagon',
      'target/hppa',
      'target/i386',
      'target/i386/kvm',
diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h
index 8a2a6563d2..245cd50b89 100644
--- a/target/hexagon/helper.h
+++ b/target/hexagon/helper.h
@@ -31,6 +31,9 @@ DEF_HELPER_FLAGS_4(vacsh_pred, TCG_CALL_NO_RWG_SE, s32, env, 
s64, s64, s64)
  DEF_HELPER_FLAGS_2(cabacdecbin_val, TCG_CALL_NO_RWG_SE, s64, s64, s64)
  DEF_HELPER_FLAGS_2(cabacdecbin_pred, TCG_CALL_NO_RWG_SE, s32, s64, s64)
+/* HLX helpers */
+DEF_HELPER_FLAGS_2(hlx_trace_op, TCG_CALL_NO_RWG, void, env, i32)
+
  /* Floating point */
  DEF_HELPER_3(conv_sf2df, f64, env, f32, i32)
  DEF_HELPER_3(conv_df2sf, f32, env, f64, i32)
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
index 477c8d6b66..27106fe1ad 100644
--- a/target/hexagon/op_helper.c
+++ b/target/hexagon/op_helper.c
@@ -37,8 +37,10 @@
  #include "mmvec/mmvec.h"
  #include "mmvec/macros.h"
  #include "op_helper.h"
+#include "opcodes.h"
  #include "cpu_helper.h"
  #include "tcg/tcg-gvec-desc.h"
+#include "trace.h"
  #include "translate.h"
  #ifdef CONFIG_USER_ONLY
  #include "qemu/timer.h"
@@ -68,6 +70,11 @@ uint64_t HELPER(utimer)(void)
  }
  #endif
+void HELPER(hlx_trace_op)(CPUHexagonState *env, uint32_t opcode)
+{
+    trace_hexagon_hlx_op(opcode, opcode_names[opcode]);
+}
+
  #define SF_BIAS        127
  #define SF_MANTBITS    23
diff --git a/target/hexagon/trace-events b/target/hexagon/trace-events
new file mode 100644
index 0000000000..4235dc6ac2
--- /dev/null
+++ b/target/hexagon/trace-events
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# See docs/devel/tracing.rst for syntax documentation.
+
+# HLX instruction tracing
+hexagon_hlx_op(int opcode, const char *name) "opcode: 0x%x (%s)"
diff --git a/target/hexagon/trace.h b/target/hexagon/trace.h
new file mode 100644
index 0000000000..e886ce0b63
--- /dev/null
+++ b/target/hexagon/trace.h
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include "trace/trace-target_hexagon.h"

Reply via email to