All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] arm: fix TB alignment check
@ 2014-10-21 12:14 Pavel Dovgalyuk
  2014-10-23 13:18 ` Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Pavel Dovgalyuk @ 2014-10-21 12:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: batuzovk, maria.klimushenkova, pavel.dovgaluk, pbonzini,
	zealot351, alex.bennee

Sometimes page faults happen during the translation of the target instructions.
To avoid the faults in the middle of the TB we have to stop translation at
the end of the page. Current implementation of ARM translation assumes that
instructions are aligned to their own size (4 or 2 bytes). But in thumb2 mode
4-byte instruction can be aligned to 2 bytes. In some cases such an alignment
leads to page fault.
This patch adds check that allows translation of such instructions only in
the beginning of the TB.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 target-arm/translate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 2c0b1de..bc3a16b 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -11124,7 +11124,8 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu,
              !cs->singlestep_enabled &&
              !singlestep &&
              !dc->ss_active &&
-             dc->pc < next_page_start &&
+             /* +3 is for unaligned Thumb2 instructions */
+             dc->pc + 3 < next_page_start &&
              num_insns < max_insns);
 
     if (tb->cflags & CF_LAST_IO) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-19 10:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 12:14 [Qemu-devel] [PATCH] arm: fix TB alignment check Pavel Dovgalyuk
2014-10-23 13:18 ` Peter Maydell
2014-10-23 13:42 ` Laurent Desnogues
2014-10-23 16:15 ` Richard Henderson
2014-10-23 16:25   ` Peter Maydell
2014-10-23 16:33     ` Richard Henderson
2014-10-24  5:24   ` Pavel Dovgaluk
2014-10-24 16:08   ` Leon Alrae
2015-09-19 10:00 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.