On 18/7/26 01:23, Richard Henderson wrote:
Assert that align and size values fit in their fields.
This results in more fields being filled than some
helpers actually use, but uniformity is for the best.
Signed-off-by: Richard Henderson <[email protected]>
---
target/arm/tcg/translate-a64.c | 123 ++++++++++++++++-----------------
1 file changed, 58 insertions(+), 65 deletions(-)
+static TCGv_i32 gen_mtedesc_xas(DisasContext *s, bool write, int idx,
+ unsigned align, unsigned size)
+{
+ int desc = 0;
+
+ desc = FIELD_DP32(desc, MTEDESC, MIDX, idx);
+ desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
+ desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
+ desc = FIELD_DP32(desc, MTEDESC, WRITE, write);
+ desc = FIELD_DP32(desc, MTEDESC, ALIGN, align);
+ desc = FIELD_DP32(desc, MTEDESC, MTX, s->mtx);
+ desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1);
+
+ assert(FIELD_EX32(desc, MTEDESC, ALIGN) == align);
+ assert(FIELD_EX32(desc, MTEDESC, SIZEM1) == size - 1);
Why assert? This can't happen...
Otherwise, nice cleanup:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
+
+ return tcg_constant_i32(desc);
+}