FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * REMARKS:
 * Implements the IMUL instruction and side effects.
 */
Implements the IMUL instruction and side effects.
Implements the IMUL instruction and side effects .
static void 
imul_word(struct x86emu *emu, uint16_t s)
{
	int32_t res = (int16_t) emu->x86.R_AX * (int16_t) s;
	emu->x86.R_AX = (uint16_t) res;
	emu->x86.R_DX = (uint16_t) (res >> 16);
	if (((emu->x86.R_AX & 0x8000) == 0 && emu->x86.R_DX == 0x00) ||
	    ((emu->x86.R_AX & 0x8000) != 0 && emu->x86.R_DX == 0xFF)) {
		CLEAR_FLAG(F_CF);
		CLEAR_FLAG(F_OF);
	} else {
		SET_FLAG(F_CF);
		SET_FLAG(F_OF);
	}
}
static void imul_word ( struct x86emu * emu , uint16_t s ) { int32_t res = ( int16_t ) emu -> x86 . R_AX * ( int16_t ) s ; emu -> x86 . R_AX = ( uint16_t ) res ; emu -> x86 . R_DX = ( uint16_t ) ( res >> 16 ) ; if ( ( ( emu -> x86 . R_AX & 0x8000 ) == 0 && emu -> x86 . R_DX == 0x00 ) || ( ( emu -> x86 . R_AX & 0x8000 ) != 0 && emu -> x86 . R_DX == 0xFF ) ) { CLEAR_FLAG ( F_CF ) ; CLEAR_FLAG ( F_OF ) ; } else { SET_FLAG ( F_CF ) ; SET_FLAG ( F_OF ) ; } }
REMARKS:
 Implements the IMUL instruction and side effects.
REMARKS : Implements the IMUL instruction and side effects .