diff options
author | Richard Henderson | 2022-10-05 21:56:14 +0200 |
---|---|---|
committer | Richard Henderson | 2022-10-26 03:11:28 +0200 |
commit | 43301e05669e19f41fb8530e77ac0c8953195bbf (patch) | |
tree | 302e12436de883e12095f439f53b0ea3ef0b1f93 /accel | |
parent | accel/tcg: Call tb_invalidate_phys_page for PAGE_RESET (diff) | |
download | qemu-43301e05669e19f41fb8530e77ac0c8953195bbf.tar.gz qemu-43301e05669e19f41fb8530e77ac0c8953195bbf.tar.xz qemu-43301e05669e19f41fb8530e77ac0c8953195bbf.zip |
accel/tcg: Use page_reset_target_data in page_set_flags
Use the existing function for clearing target data.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r-- | accel/tcg/translate-all.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 478301f227..41b6d5fe26 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1370,6 +1370,9 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) flags |= PAGE_WRITE_ORG; } reset = !(flags & PAGE_VALID) || (flags & PAGE_RESET); + if (reset) { + page_reset_target_data(start, end); + } flags &= ~PAGE_RESET; for (addr = start, len = end - start; @@ -1387,14 +1390,8 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) (flags & ~p->flags & PAGE_WRITE))) { tb_invalidate_phys_page(addr); } - if (reset) { - g_free(p->target_data); - p->target_data = NULL; - p->flags = flags; - } else { - /* Using mprotect on a page does not change sticky bits. */ - p->flags = (p->flags & PAGE_STICKY) | flags; - } + /* Using mprotect on a page does not change sticky bits. */ + p->flags = (reset ? 0 : p->flags & PAGE_STICKY) | flags; } } |