[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/13] target-i386: eliminate dead code and hoist com
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/13] target-i386: eliminate dead code and hoist common code out of "if" |
Date: |
Thu, 13 Nov 2014 16:40:23 +0100 |
ist != 0 is checked in the first "if", so it cannot be true in
the "else if" part. While at it, simplify the code and move
the ESP alignment out of the conditionals.
Reported by Coverity.
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/seg_helper.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index af5c1c6..c98eeb4 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -883,32 +883,23 @@ static void do_interrupt64(CPUX86State *env, int intno,
int is_int,
}
if ((!(e2 & DESC_C_MASK) && dpl < cpl) || ist != 0) {
/* to inner privilege */
- if (ist != 0) {
- esp = get_rsp_from_tss(env, ist + 3);
- } else {
- esp = get_rsp_from_tss(env, dpl);
- }
- esp &= ~0xfLL; /* align stack */
- ss = 0;
new_stack = 1;
+ esp = get_rsp_from_tss(env, ist != 0 ? ist + 3 : dpl);
+ ss = 0;
} else if ((e2 & DESC_C_MASK) || dpl == cpl) {
/* to same privilege */
if (env->eflags & VM_MASK) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
new_stack = 0;
- if (ist != 0) {
- esp = get_rsp_from_tss(env, ist + 3);
- } else {
- esp = env->regs[R_ESP];
- }
- esp &= ~0xfLL; /* align stack */
+ esp = env->regs[R_ESP];
dpl = cpl;
} else {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
new_stack = 0; /* avoid warning */
esp = 0; /* avoid warning */
}
+ esp &= ~0xfLL; /* align stack */
PUSHQ(esp, env->segs[R_SS].selector);
PUSHQ(esp, env->regs[R_ESP]);
--
1.8.3.1
- [Qemu-devel] [PULL 00/13] x86 and SCSI patches for QEMU 2.2.0-rc2, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 01/13] esp-pci: fixup deadlock with linux, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 02/13] virtio-scsi: work around bug in old BIOSes, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 03/13] esp: fix coding standards, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 04/13] virtio-scsi: dataplane: fix allocation for 'cmd_vrings', Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 05/13] esp: Do not overwrite ESP_TCHI after reset, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 06/13] virtio-scsi: dataplane: suppress guest notification, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 09/13] apic_common: migrate missing fields, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 11/13] kvmclock: Add comment explaining why we need cpu_clean_all_dirty(), Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 07/13] virtio-scsi: Fix comment for VirtIOSCSIReq, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 08/13] target-i386: eliminate dead code and hoist common code out of "if",
Paolo Bonzini <=
- [Qemu-devel] [PULL 12/13] smbios: change 'ram_addr_t' variables to 'uint64_t', Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 10/13] target-i386: fix Coverity complaints about overflows, Paolo Bonzini, 2014/11/13
- [Qemu-devel] [PULL 13/13] acpi: accurate overflow check, Paolo Bonzini, 2014/11/13
- Re: [Qemu-devel] [PULL 00/13] x86 and SCSI patches for QEMU 2.2.0-rc2, Peter Maydell, 2014/11/13