summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/gsp_phys_booter.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 114751d..42fb8f2 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -19229,14 +19229,31 @@ static u32 gsp_phys_rmcall_build_gr_launch(u32 *pb,
(!nxt ||
sa_ent[kk] < nxt))
nxt = sa_ent[kk];
- if (nxt && ptr + blen > nxt)
- blen = nxt - ptr;
+ /*
+ * CONT-100 units fix: `ptr` is an
+ * MME INSTRUCTION address (the
+ * driver advances codeOffset by
+ * codeSize/3, mmeDownload.cpp),
+ * and each instruction is 3 IR
+ * words stored at 3*ptr..3*ptr+2.
+ * Indexing the contiguous word
+ * image at ptr+k (the pre-CONT-100
+ * form) misplaced every macro and
+ * left 2/3 of the program
+ * unreachable (r1343/r1344 poison,
+ * only ~312 of 933 instructions
+ * covered). Clamp the tail at the
+ * next SA entry in INSTRUCTIONS.
+ */
+ if (nxt &&
+ ptr + (blen + 2u) / 3u > nxt)
+ blen = 3u * (nxt - ptr);
for (k = 0; k < blen &&
- ptr + k < 4096u; k++)
- gsp_phys_gr_mme_ir_pack[ptr + k] =
+ ptr * 3u + k < 4096u; k++)
+ gsp_phys_gr_mme_ir_pack[ptr * 3u + k] =
pl[r + 2u + k];
- if (ptr + blen > maxa)
- maxa = ptr + blen;
+ if (ptr * 3u + blen > maxa)
+ maxa = ptr * 3u + blen;
nruns++;
}
r += span;