[LinuxBIOS] Bugs in rom emulator

Nick Barker nick.barker9 at btinternet.com
Wed Nov 2 11:37:27 CET 2005


Whilst trying to get the emulator to spark up the vga on the epia-m I came
across
the following bugs in the emulator:

opcodes a0 thru a3 need to respond to the address size prefix and should
look as
below in src/devices/emulator/x86emu/ops.c

The address size prefix is used by the epia-m bios on these instructions,
however
the emulator still doesn't work for this bios. I am assuming that there are
other
infrequently used instructions which are less well tested and which are
still preventing
the bios from running

Nick Barker


/***************************************************************************
*
REMARKS:
Handles opcode 0xa0
****************************************************************************
/
void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
{
    u32 offset;

    START_OF_INSTR();
    DECODE_PRINTF("MOV\tAL,");
    if( M.x86.mode & SYSMODE_PREFIX_ADDR )
        offset = fetch_long_imm();
    else
        offset = fetch_word_imm();
    DECODE_PRINTF2("[%04x]\n", offset);
    TRACE_AND_STEP();
    M.x86.R_AL = fetch_data_byte(offset);
    DECODE_CLEAR_SEGOVR();
    END_OF_INSTR();
}

/***************************************************************************
*
REMARKS:
Handles opcode 0xa1
****************************************************************************
/
void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
{
    u32 offset;

    START_OF_INSTR();
    if( M.x86.mode & SYSMODE_PREFIX_ADDR )
        offset = fetch_long_imm();
    else
        offset = fetch_word_imm();
    if (M.x86.mode & SYSMODE_PREFIX_DATA) {
        DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
    } else {
        DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
    }
    TRACE_AND_STEP();
    if (M.x86.mode & SYSMODE_PREFIX_DATA) {
        M.x86.R_EAX = fetch_data_long(offset);
    } else {
        M.x86.R_AX = fetch_data_word(offset);
    }
    DECODE_CLEAR_SEGOVR();
    END_OF_INSTR();
}

/***************************************************************************
*
REMARKS:
Handles opcode 0xa2
****************************************************************************
/
void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
{
    u32 offset;

    START_OF_INSTR();
    DECODE_PRINTF("MOV\t");
    if( M.x86.mode & SYSMODE_PREFIX_ADDR )
        offset = fetch_long_imm();
    else
        offset = fetch_word_imm();
    DECODE_PRINTF2("[%04x],AL\n", offset);
    TRACE_AND_STEP();
    store_data_byte(offset, M.x86.R_AL);
    DECODE_CLEAR_SEGOVR();
    END_OF_INSTR();
}

/***************************************************************************
*
REMARKS:
Handles opcode 0xa3
****************************************************************************
/
void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
{
    u32 offset;

    START_OF_INSTR();
    if( M.x86.mode & SYSMODE_PREFIX_ADDR )
        offset = fetch_long_imm();
    else
        offset = fetch_word_imm();
    if (M.x86.mode & SYSMODE_PREFIX_DATA) {
        DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
    } else {
        DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
    }
    TRACE_AND_STEP();
    if (M.x86.mode & SYSMODE_PREFIX_DATA) {
        store_data_long(offset, M.x86.R_EAX);
    } else {
        store_data_word(offset, M.x86.R_AX);
    }
    DECODE_CLEAR_SEGOVR();
    END_OF_INSTR();
}





More information about the coreboot mailing list