target/hexagon: Add guest/sys reg writes to DisasContext
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Brian Cain committed
Jun 22, 2026 at 15:28 UTC
037cdf1102048750e5de2234786a08a262dbd88e
1 file changed
+36
target/hexagon/translate.h
+36
@@ -41,6 +41,14 @@ typedef struct DisasContext {
41
DECLARE_BITMAP(regs_written, TOTAL_PER_THREAD_REGS);
42
DECLARE_BITMAP(predicated_regs, TOTAL_PER_THREAD_REGS);
43
bool implicit_usr_write;
44
+#ifndef CONFIG_USER_ONLY
45
+ int greg_log[GREG_WRITES_MAX];
46
+ int greg_log_idx;
47
+ int sreg_log[SREG_WRITES_MAX];
48
+ int sreg_log_idx;
49
+ TCGv_i32 t_sreg_new_value[NUM_SREGS];
50
+ TCGv_i32 greg_new_value[NUM_GREGS];
51
+#endif
52
int preg_log[PRED_WRITES_MAX];
53
int preg_log_idx;
54
DECLARE_BITMAP(pregs_written, NUM_PREGS);
@@ -81,6 +89,34 @@ typedef struct DisasContext {
89
90
bool is_gather_store_insn(DisasContext *ctx);
91
92
+#ifndef CONFIG_USER_ONLY
93
+static inline void ctx_log_greg_write(DisasContext *ctx, int rnum)
94
+{
95
+ assert(rnum <= HEX_GREG_G3);
96
+ ctx->greg_log[ctx->greg_log_idx] = rnum;
97
+ ctx->greg_log_idx++;
98
+}
99
+
100
+static inline void ctx_log_greg_write_pair(DisasContext *ctx, int rnum)
101
+{
102
+ assert(!(rnum % 2));
103
+ ctx_log_greg_write(ctx, rnum);
104
+ ctx_log_greg_write(ctx, rnum + 1);
105
+}
106
+
107
+static inline void ctx_log_sreg_write(DisasContext *ctx, int rnum)
108
+{
109
+ ctx->sreg_log[ctx->sreg_log_idx] = rnum;
110
+ ctx->sreg_log_idx++;
111
+}
112
+
113
+static inline void ctx_log_sreg_write_pair(DisasContext *ctx, int rnum)
114
+{
115
+ ctx_log_sreg_write(ctx, rnum);
116
+ ctx_log_sreg_write(ctx, rnum + 1);
117
+}
118
+#endif
119
+
120
static inline void ctx_log_pred_write(DisasContext *ctx, int pnum)
121
{
122
if (!test_bit(pnum, ctx->pregs_written)) {