aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/common/gen_decoder.c
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2017-03-28 12:03:37 -0700
committerJordan Justen <[email protected]>2017-04-06 13:26:08 -0700
commitd5bd0e411ede67f5c56f95ae4d905d8d94c9be2f (patch)
tree10be56421c5957e546e47dbdcde8406a463a039f /src/intel/common/gen_decoder.c
parent7c33372f82707d42293b1772d53ab50a2f56d6a3 (diff)
intel/gen_decoder: return -1 for unknown command formats
Decoding with aubinator encountered a command of 0xffffffff. With the previous code, it caused aubinator to jump 255 + 2 dwords to start decoding again. Instead we can attempt to detect the known instruction formats. If the format is not recognized, then we can advance just 1 dword. v2: * Update aubinator_error_decode * Actually convert the length variable returned into a *signed* integer in aubinator.c, intel_batchbuffer.c and aubinator_error_decode.c. Signed-off-by: Jordan Justen <[email protected]> Acked-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common/gen_decoder.c')
-rw-r--r--src/intel/common/gen_decoder.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 1244f4c4480..03c9c7f8d46 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -692,28 +692,36 @@ gen_group_get_length(struct gen_group *group, const uint32_t *p)
case 3: /* Render */ {
uint32_t subtype = field(h, 27, 28);
+ uint32_t opcode = field(h, 24, 26);
switch (subtype) {
case 0:
- return field(h, 0, 7) + 2;
+ if (opcode < 2)
+ return field(h, 0, 7) + 2;
+ else
+ return -1;
case 1:
- return 1;
+ if (opcode < 2)
+ return 1;
+ else
+ return -1;
case 2: {
- uint32_t opcode = field(h, 24, 26);
- assert(opcode < 3 /* 3 and above currently reserved */);
if (opcode == 0)
return field(h, 0, 7) + 2;
else if (opcode < 3)
return field(h, 0, 15) + 2;
else
- return 1; /* FIXME: if more opcodes are added */
+ return -1;
}
case 3:
- return field(h, 0, 7) + 2;
+ if (opcode < 4)
+ return field(h, 0, 7) + 2;
+ else
+ return -1;
}
}
}
- unreachable("bad opcode");
+ return -1;
}
void