[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v5 10/31] i386: do not cross the pages boundarie
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v5 10/31] i386: do not cross the pages boundaries in replay mode |
Date: |
Wed, 26 Nov 2014 13:39:42 +0300 |
User-agent: |
StGit/0.16 |
This patch denies crossing the boundary of the pages in the replay mode,
because it can cause an exception. Do it only when boundary is
crossed by the first instruction in the block.
If current instruction already crossed the bound - it's ok,
because an exception hasn't stopped this code.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
target-i386/cpu.h | 3 +++
target-i386/translate.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 2968749..204aaf1 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -28,6 +28,9 @@
#define TARGET_LONG_BITS 32
#endif
+/* Maximum instruction code size */
+#define TARGET_MAX_INSN_SIZE 16
+
/* target supports implicit self modifying code */
#define TARGET_HAS_SMC
/* support for self modifying code even if the modified instruction is
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 4d5dfb3..a264908 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -8035,6 +8035,20 @@ static inline void gen_intermediate_code_internal(X86CPU
*cpu,
gen_eob(dc);
break;
}
+ /* Do not cross the boundary of the pages in icount mode,
+ it can cause an exception. Do it only when boundary is
+ crossed by the first instruction in the block.
+ If current instruction already crossed the bound - it's ok,
+ because an exception hasn't stopped this code.
+ */
+ if (use_icount
+ && ((pc_ptr & TARGET_PAGE_MASK)
+ != ((pc_ptr + TARGET_MAX_INSN_SIZE - 1) & TARGET_PAGE_MASK)
+ || (pc_ptr & ~TARGET_PAGE_MASK) == 0)) {
+ gen_jmp_im(pc_ptr - dc->cs_base);
+ gen_eob(dc);
+ break;
+ }
/* if too long translation, stop generation too */
if (tcg_ctx.gen_opc_ptr >= gen_opc_end ||
(pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) ||
- [Qemu-devel] [RFC PATCH v5 00/31] Deterministic replay and reverse execution, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 01/31] cpu-exec: fix cpu_exec_nocache, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 02/31] acpi: accurate overflow check, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 03/31] replay: global variables and function stubs, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 04/31] sysemu: system functions for replay, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 05/31] replay: internal functions for replay log, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 06/31] cpu-exec: reset exception_index correctly, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 07/31] icount: implement icount requesting, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 08/31] icount: improve enable/disable ticks, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 09/31] replay: introduce icount event, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 10/31] i386: do not cross the pages boundaries in replay mode,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH v5 11/31] From 7abf2f72777958d395cfd01d97fe707cc06152b5 Mon Sep 17 00:00:00 2001, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 12/31] From 185a3a47d08857a66332ae862b372a153ce92bb9 Mon Sep 17 00:00:00 2001, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 13/31] From a0cb9e80ba0de409b5ad556109a1c71ce4d8ce19 Mon Sep 17 00:00:00 2001, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 14/31] From 04bbd21134dd2c6b7309a7f5f2b780aae2757003 Mon Sep 17 00:00:00 2001, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 15/31] cpu-exec: allow temporary disabling icount, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 16/31] cpu-exec: invalidate nocache translation if they are interrupted, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 17/31] replay: interrupts and exceptions, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 18/31] replay: asynchronous events infrastructure, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 19/31] cpu: replay instructions sequence, Pavel Dovgalyuk, 2014/11/26
- [Qemu-devel] [RFC PATCH v5 20/31] replay: recording and replaying clock ticks, Pavel Dovgalyuk, 2014/11/26