mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target/i386: implement SYSCALL/SYSRET in 32-bit emulators
AMD supports both 32-bit and 64-bit SYSCALL/SYSRET, but the TCG only exposes it for 64-bit targets. For system emulation just reuse the helper; for user-mode emulation the ABI is the same as "int $80". The BSDs does not support any fast system call mechanism in 32-bit mode so add to bsd-user the same stub that FreeBSD has for 64-bit compatibility mode. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
6750485bf4
commit
63fd8ef080
8 changed files with 20 additions and 17 deletions
|
@ -977,6 +977,7 @@ static void do_interrupt64(CPUX86State *env, int intno, int is_int,
|
|||
e2);
|
||||
env->eip = offset;
|
||||
}
|
||||
#endif /* TARGET_X86_64 */
|
||||
|
||||
void helper_sysret(CPUX86State *env, int dflag)
|
||||
{
|
||||
|
@ -990,6 +991,7 @@ void helper_sysret(CPUX86State *env, int dflag)
|
|||
raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC());
|
||||
}
|
||||
selector = (env->star >> 48) & 0xffff;
|
||||
#ifdef TARGET_X86_64
|
||||
if (env->hflags & HF_LMA_MASK) {
|
||||
cpu_load_eflags(env, (uint32_t)(env->regs[11]), TF_MASK | AC_MASK
|
||||
| ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | RF_MASK |
|
||||
|
@ -1015,7 +1017,9 @@ void helper_sysret(CPUX86State *env, int dflag)
|
|||
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
|
||||
DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
|
||||
DESC_W_MASK | DESC_A_MASK);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
env->eflags |= IF_MASK;
|
||||
cpu_x86_load_seg_cache(env, R_CS, selector | 3,
|
||||
0, 0xffffffff,
|
||||
|
@ -1030,7 +1034,6 @@ void helper_sysret(CPUX86State *env, int dflag)
|
|||
DESC_W_MASK | DESC_A_MASK);
|
||||
}
|
||||
}
|
||||
#endif /* TARGET_X86_64 */
|
||||
|
||||
/* real mode interrupt */
|
||||
static void do_interrupt_real(CPUX86State *env, int intno, int is_int,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue