From: Mark Cave-Ayland Date: Thu, 29 Jun 2023 08:25:22 +0000 (+0100) Subject: accel/tcg: Assert one page in tb_invalidate_phys_page_range__locked X-Git-Tag: v8.0.3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2402a83a7c9e714f03d954f3074eab504b49b9d;p=thirdparty%2Fqemu.git accel/tcg: Assert one page in tb_invalidate_phys_page_range__locked Ensure that that both the start and last addresses are within the same guest page. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230629082522.606219-3-mark.cave-ayland@ilande.co.uk> [rth: Use tcg_debug_assert, simplify the expression] Signed-off-by: Richard Henderson (cherry picked from commit e665cf72fe6357945fdbecf747dac58c0c7c7c66) Signed-off-by: Michael Tokarev --- diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 2f15a31b3e7..cca42f88c94 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1093,6 +1093,9 @@ tb_invalidate_phys_page_range__locked(struct page_collection *pages, TranslationBlock *current_tb = retaddr ? tcg_tb_lookup(retaddr) : NULL; #endif /* TARGET_HAS_PRECISE_SMC */ + /* Range may not cross a page. */ + tcg_debug_assert(((start ^ last) & TARGET_PAGE_MASK) == 0); + /* * We remove all the TBs in the range [start, last]. * XXX: see if in some cases it could be faster to invalidate all the code