xserver/hw/xfree86/x86emu
Julian Pidancet 59b618227e x86emu: Correctly handle 0x66 prefix for some instructions
(Sorry for double posting)

I repost this patch because I havn't got any replies from maintainers
since I posted the initial patch back in March.

Some instructions are not emulated correctly by x86emu when they
are prefixed by the 0x66 opcode.
I've identified problems in the emulation of these intructions: ret,
enter, leave, iret and some forms of call.

Most of the time, the problem is that these instructions should push or
pop 32-bit values to/from the stack, instead of 16bit, when they are
prefixed by the 0x66 special opcode.

The SeaBIOS project aims to produce a complete legacy BIOS
implementation as well as a VGA option ROM, entirely written in C and
using the GCC compiler.

In 16bit code produced by the GCC compiler, the 0x66 prefix is used
almost everywhere. This patch is necessary to allow the SeaBIOS VGA
option ROM to function with Xorg when using the vesa driver.

SeaBIOS currently use postprocessing on the ROM assembly output to
replace the affected instruction with alternative unaffected instructions.
This is obviously not very elegant, and this fix in x86emu would be
more appropriate.

v2: - Decrement BP instead of EBP in accordance with the Intel Manual
    - Assign EIP instead of IP when poping the return address from the
    stack in 32-bit operand size mode in ret_far_IMM, ret_far, and iret
    - When poping EFLAGS from the stack in iret in 32-bit operand size
    mode, apply some mask to preserve Read-only flags.

v3: - Rebase

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
2015-12-07 14:49:36 -05:00
..
x86emu Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
Makefile.am Replace INCLUDES with AM_CPPFLAGS 2013-08-06 13:08:13 +10:00
debug.c x86emu: Fix some set-but-not-used warnings. 2015-09-23 15:01:25 -04:00
decode.c Avoid conflicts with Solaris <sys/regset.h> defines that clash with our names 2013-11-12 21:03:53 +09:00
fpu.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
ops.c x86emu: Correctly handle 0x66 prefix for some instructions 2015-12-07 14:49:36 -05:00
ops2.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
prim_ops.c Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
sys.c Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
validate.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
x86emu.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00