[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.5 14/24] target/i386: fix incorrect EIP in PC-relative trans
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.5 14/24] target/i386: fix incorrect EIP in PC-relative translation blocks |
Date: |
Tue, 23 Jan 2024 13:28:28 +0300 |
From: guoguangyao <guoguangyao18@mails.ucas.ac.cn>
The PCREL patches introduced a bug when updating EIP in the !CF_PCREL case.
Using s->pc in func gen_update_eip_next() solves the problem.
Cc: qemu-stable@nongnu.org
Fixes: b5e0d5d22fbf ("target/i386: Fix 32-bit wrapping of pc/eip computation")
Fixes: 5b2fd6cf3735 (b5e0d5d22fbf in 8.1.4)
Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240115020804.30272-1-guoguangyao18@mails.ucas.ac.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 2926eab8969908bc068629e973062a0fb6ff3759)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 1d3c9a8be4..2a9f277adb 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -566,9 +566,9 @@ static void gen_update_eip_next(DisasContext *s)
if (tb_cflags(s->base.tb) & CF_PCREL) {
tcg_gen_addi_tl(cpu_eip, cpu_eip, s->pc - s->pc_save);
} else if (CODE64(s)) {
- tcg_gen_movi_tl(cpu_eip, s->base.pc_next);
+ tcg_gen_movi_tl(cpu_eip, s->pc);
} else {
- tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->base.pc_next - s->cs_base));
+ tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->pc - s->cs_base));
}
s->pc_save = s->pc;
}
--
2.39.2
- [Stable-8.1.5 v2 00/24] Patch Round-up for stable 8.1.5, freeze on 2024-01-27, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 12/24] load_elf: fix iterator's type for elf file processing, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 13/24] target/i386: Do not re-compute new pc with CF_PCREL, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 14/24] target/i386: fix incorrect EIP in PC-relative translation blocks,
Michael Tokarev <=
- [Stable-8.1.5 15/24] target/i386: pcrel: store low bits of physical address in data[0], Michael Tokarev, 2024/01/23
- [Stable-8.1.5 16/24] backends/cryptodev: Do not ignore throttle/backends Errors, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 17/24] hw/pflash: refactor pflash_data_write(), Michael Tokarev, 2024/01/23
- [Stable-8.1.5 18/24] hw/pflash: use ldn_{be,le}_p and stn_{be,le}_p, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 19/24] hw/pflash: implement update buffer for block writes, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 20/24] migration/rdma: define htonll/ntohll only if not predefined, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 21/24] hw/scsi/esp-pci: use correct address register for PCI DMA transfers, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 23/24] hw/scsi/esp-pci: synchronise setting of DMA_STAT_DONE with ESP completion interrupt, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 22/24] hw/scsi/esp-pci: generate PCI interrupt from separate ESP and PCI sources, Michael Tokarev, 2024/01/23
- [Stable-8.1.5 24/24] hw/scsi/esp-pci: set DMA_STAT_BCMBLT when BLAST command issued, Michael Tokarev, 2024/01/23