qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/1] target/rx: Check for page crossings in use_goto_tb()


From: Ahmed Karaman
Subject: [PATCH v2 1/1] target/rx: Check for page crossings in use_goto_tb()
Date: Sun, 31 May 2020 15:45:12 +0200

Add the page crossings check in use_goto_tb(). If this check is not
applied, a number of bugs may occasionally occur during target rx
system mode emulation.
Also, this check is needed in user mode related to emulation of system
call mmap(). rx target does not currently support user mode, but it is
better to prepare use_goto_tb() in that sense in advance.

Rename parameter dc of type DisasContext* to the more common name ctx,
to keep consistency with other targets.

Add detailed comments.

Buglink: https://bugs.launchpad.net/qemu/+bug/1880763
Signed-off-by: Ahmed Karaman <ahmedkhaledkaraman@gmail.com>
---
 target/rx/translate.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/rx/translate.c b/target/rx/translate.c
index 61e86653a4..85a884c7dd 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -143,12 +143,15 @@ void rx_cpu_dump_state(CPUState *cs, FILE *f, int flags)
     }
 }
 
-static bool use_goto_tb(DisasContext *dc, target_ulong dest)
+static bool use_goto_tb(DisasContext *ctx, target_ulong dest)
 {
-    if (unlikely(dc->base.singlestep_enabled)) {
+    /* No direct translation block linking in singlestep */
+    if (unlikely(ctx->base.singlestep_enabled)) {
         return false;
     } else {
-        return true;
+        /* Directly link translation blocks only within the same guest page */
+        return (ctx->base.tb->pc & TARGET_PAGE_MASK) ==
+               (dest & TARGET_PAGE_MASK);
     }
 }
 
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]