From 15a356c49ac747a7202ed703949a178a054f2a55 Mon Sep 17 00:00:00 2001 From: Pavel Dovgalyuk Date: Wed, 10 Jan 2018 16:48:46 +0300 Subject: [PATCH] cpu: flush TB cache when loading VMState Flushing TB cache is required because TBs key in the cache may match different code which existed in the previous state. Signed-off-by: Pavel Dovgalyuk Signed-off-by: Maria Klimushenkova Message-Id: <20180110134846.12940.99993.stgit@pasha-VirtualBox> [Add comment suggested by Peter Maydell. - Paolo] Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- exec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exec.c b/exec.c index 9f4f4501a8..d28fc0cd3d 100644 --- a/exec.c +++ b/exec.c @@ -623,6 +623,13 @@ static int cpu_common_post_load(void *opaque, int version_id) cpu->interrupt_request &= ~0x01; tlb_flush(cpu); + /* loadvm has just updated the content of RAM, bypassing the + * usual mechanisms that ensure we flush TBs for writes to + * memory we've translated code from. So we must flush all TBs, + * which will now be stale. + */ + tb_flush(cpu); + return 0; }