diff options
author | Jason Ekstrand <[email protected]> | 2017-12-12 17:05:38 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-14 13:27:03 -0800 |
commit | dca8f466ee3c1d2d3a8f120895639c9a2cca9272 (patch) | |
tree | 6974fdbf3a651f554ba0f8fb585823a112126bda /src/intel | |
parent | f2646406939557ee1f75d6ee044447e40f92b565 (diff) |
intel/decoder: Stop rounding down to the nearest dword
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/common/gen_decoder.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index de4c506ac7b..59c76eab7ef 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -847,27 +847,29 @@ iter_advance_field(struct gen_field_iterator *iter) } static uint64_t -iter_decode_field_raw(struct gen_field *field, - const uint32_t *p, - const uint32_t *end) +iter_decode_field_raw(struct gen_field_iterator *iter) { uint64_t qw = 0; - if ((field->end - field->start) > 32) { - if ((p + 1) < end) + int field_start = iter->bit; + int field_end = iter->bit + (iter->field->end - iter->field->start); + + const uint32_t *p = iter->p + (iter->bit / 32); + if ((field_end - field_start) > 32) { + if ((p + 1) < iter->p_end) qw = ((uint64_t) p[1]) << 32; qw |= p[0]; } else qw = p[0]; - qw = field_value(qw, field->start, field->end); + qw = field_value(qw, field_start, field_end); /* Address & offset types have to be aligned to dwords, their start bit is * a reminder of the alignment requirement. */ - if (field->type.kind == GEN_TYPE_ADDRESS || - field->type.kind == GEN_TYPE_OFFSET) - qw <<= field->start % 32; + if (iter->field->type.kind == GEN_TYPE_ADDRESS || + iter->field->type.kind == GEN_TYPE_OFFSET) + qw <<= field_start % 32; return qw; } @@ -887,8 +889,7 @@ iter_decode_field(struct gen_field_iterator *iter) memset(&v, 0, sizeof(v)); - v.qw = iter_decode_field_raw(iter->field, - &iter->p[iter->bit / 32], iter->p_end); + v.qw = iter_decode_field_raw(iter); const char *enum_name = NULL; |