summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 159751b..a4d9718 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -14548,8 +14548,17 @@ int gsp_phys_backend_guest_gr_submit(const struct gsp_phys_gr_submit *req,
n_shadow),
&sh_va);
if (!ret) {
- u64 ptr_va = sh_va +
- (pg->guest_va &
+ /*
+ * Preserve the original pointer's page
+ * offset: pg->guest_va is page-based,
+ * but the QMD pair (still the guest's
+ * value here) carries the exact entry
+ * offset (e.g. program +0x800). Without
+ * it the engine would fetch the wrong
+ * slot of the copied page.
+ */
+ u64 ptr_va = sh_va |
+ ((u64)qmd[pg->qmd_word] &
(GSP_PHYS_PAGE_SIZE - 1));
n_shadow++;