[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/29] i386: Emit correct error code for 64-bit IDT entry
From: |
Paolo Bonzini |
Subject: |
[PULL 02/29] i386: Emit correct error code for 64-bit IDT entry |
Date: |
Tue, 10 Jan 2023 17:02:06 +0100 |
From: Joe Richey <joerichey@google.com>
When in 64-bit mode, IDT entiries are 16 bytes, so `intno * 16` is used
for base/limit/offset calculations. However, even in 64-bit mode, the
exception error code still uses bits [3,16) for the invlaid interrupt
index.
This means the error code should still be `intno * 8 + 2` even in 64-bit
mode.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1382
Signed-off-by: Joe Richey <joerichey@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/seg_helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
index 539189b4d184..03b58e94a2d4 100644
--- a/target/i386/tcg/seg_helper.c
+++ b/target/i386/tcg/seg_helper.c
@@ -882,7 +882,7 @@ static void do_interrupt64(CPUX86State *env, int intno, int
is_int,
dt = &env->idt;
if (intno * 16 + 15 > dt->limit) {
- raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
+ raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
}
ptr = dt->base + intno * 16;
e1 = cpu_ldl_kernel(env, ptr);
@@ -895,18 +895,18 @@ static void do_interrupt64(CPUX86State *env, int intno,
int is_int,
case 15: /* 386 trap gate */
break;
default:
- raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
+ raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
break;
}
dpl = (e2 >> DESC_DPL_SHIFT) & 3;
cpl = env->hflags & HF_CPL_MASK;
/* check privilege if software int */
if (is_int && dpl < cpl) {
- raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
+ raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
}
/* check valid bit */
if (!(e2 & DESC_P_MASK)) {
- raise_exception_err(env, EXCP0B_NOSEG, intno * 16 + 2);
+ raise_exception_err(env, EXCP0B_NOSEG, intno * 8 + 2);
}
selector = e1 >> 16;
offset = ((target_ulong)e3 << 32) | (e2 & 0xffff0000) | (e1 & 0x0000ffff);
--
2.38.1
- [PULL 00/29] Misc patches for 2023-01-10, Paolo Bonzini, 2023/01/10
- [PULL 01/29] configure: fix GLIB_VERSION for cross-compilation, Paolo Bonzini, 2023/01/10
- [PULL 04/29] KVM: keep track of running ioctls, Paolo Bonzini, 2023/01/10
- [PULL 05/29] kvm: Atomic memslot updates, Paolo Bonzini, 2023/01/10
- [PULL 03/29] accel: introduce accelerator blocker API, Paolo Bonzini, 2023/01/10
- [PULL 02/29] i386: Emit correct error code for 64-bit IDT entry,
Paolo Bonzini <=
- [PULL 10/29] hw/xen: use G_GNUC_PRINTF/SCANF for various functions, Paolo Bonzini, 2023/01/10
- [PULL 14/29] enforce use of G_GNUC_PRINTF attributes, Paolo Bonzini, 2023/01/10
- [PULL 07/29] chardev: clean up chardev-parallel.c, Paolo Bonzini, 2023/01/10
- [PULL 15/29] hw/display: avoid creating empty loadable modules, Paolo Bonzini, 2023/01/10
- [PULL 11/29] tools/virtiofsd: add G_GNUC_PRINTF for logging functions, Paolo Bonzini, 2023/01/10
- [PULL 17/29] libvhost-user: Replace typeof with __typeof__, Paolo Bonzini, 2023/01/10
- [PULL 24/29] libvduse: Fix assignment in vring_set_avail_event, Paolo Bonzini, 2023/01/10
- [PULL 22/29] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU, Paolo Bonzini, 2023/01/10
- [PULL 21/29] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant, Paolo Bonzini, 2023/01/10
- [PULL 06/29] target/i386: Remove compilation errors when -Werror=maybe-uninitialized, Paolo Bonzini, 2023/01/10