mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
target-i386: eliminate dead code and hoist common code out of "if"
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 <pbonzini@redhat.com>
This commit is contained in:
parent
f69c111585
commit
ae67dc72e4
1 changed files with 4 additions and 13 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue