[PATCH v2] x86emu: Correctly handle 0x66 prefix for some instructions

Julian Pidancet julian.pidancet at gmail.com
Thu Mar 15 15:39:33 PDT 2012

On Fri, Mar 9, 2012 at 2:08 AM, Guillem Jover <guillem at hadrons.org> wrote:
> On Fri, 2012-03-09 at 00:02:55 +0000, Julian Pidancet wrote:
>> 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.
>> 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.
>> Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
> Looks good to me:
> Reviewed-by: Guillem Jover <guillem at hadrons.org>
> thanks,
> guillem

Anyone interested in this ? Is there a maintainer for x86emu ? The
MAINTAINERS file in xorg-docs doesn't mention anything about it.


More information about the xorg-devel mailing list