summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/disassemble.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-14 14:11:54 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-14 15:09:17 -0700
commit1ab629074622966c646a3f409859ef30a813dfe6 (patch)
tree53d25771b1946c3d2e84a3fa41b2369561e067e3 /src/panfrost/midgard/disassemble.c
parent9c4c7211a36a4c376fbcc35d683e8733db7491c5 (diff)
pan/midgard: Improve disassembler robustness
Some memory corruption / etc issues let to an accidental "fuzzing" of the disassembler ;) This uncovered some issues leading to a disassembler hang, so let's fix that. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/disassemble.c')
-rw-r--r--src/panfrost/midgard/disassemble.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c
index 1092fcf7374..3e18c19593b 100644
--- a/src/panfrost/midgard/disassemble.c
+++ b/src/panfrost/midgard/disassemble.c
@@ -283,6 +283,7 @@ bits_for_mode(midgard_reg_mode mode)
case midgard_reg_mode_64:
return 64;
default:
+ unreachable("Invalid reg mode");
return 0;
}
}
@@ -410,6 +411,14 @@ print_mask_vec16(uint8_t mask, midgard_dest_override override)
static void
print_mask(uint8_t mask, unsigned bits, midgard_dest_override override)
{
+ if (bits < 16) {
+ /* Shouldn't happen but with junk / out-of-spec shaders it
+ * would cause an infinite loop */
+
+ printf("/* XXX: bits = %d */", bits);
+ return;
+ }
+
if (bits == 8) {
print_mask_vec16(mask, override);
return;