FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * PARAMETERS:
 * reg	- Register to decode
 * 
 * RETURNS:
 * Pointer to the appropriate register
 * 
 * REMARKS:
 * Return a pointer to the register given by the R/RM field of the
 * modrm byte, for word operands.  Also enables the decoding of instructions.
 */
reg  - Register to decode

Pointer to the appropriate register

Return a pointer to the register given by the R/RM field of the
modrm byte, for word operands.  Also enables the decoding of instructions.
reg - Register to decode Pointer to the appropriate register Return a pointer to the register given by the R / RM field of the modrm byte for word operands . Also enables the decoding of instructions .
static uint16_t *
decode_rm_word_register(struct x86emu *emu, int reg)
{
	switch (reg) {
	case 0:
		return &emu->x86.R_AX;
	case 1:
		return &emu->x86.R_CX;
	case 2:
		return &emu->x86.R_DX;
	case 3:
		return &emu->x86.R_BX;
	case 4:
		return &emu->x86.R_SP;
	case 5:
		return &emu->x86.R_BP;
	case 6:
		return &emu->x86.R_SI;
	case 7:
		return &emu->x86.R_DI;
	default:
		x86emu_halt_sys(emu);
	}
}
static uint16_t * decode_rm_word_register ( struct x86emu * emu , int reg ) { switch ( reg ) { case 0 : return & emu -> x86 . R_AX ; case 1 : return & emu -> x86 . R_CX ; case 2 : return & emu -> x86 . R_DX ; case 3 : return & emu -> x86 . R_BX ; case 4 : return & emu -> x86 . R_SP ; case 5 : return & emu -> x86 . R_BP ; case 6 : return & emu -> x86 . R_SI ; case 7 : return & emu -> x86 . R_DI ; default : x86emu_halt_sys ( emu ) ; } }
PARAMETERS:
 reg  - Register to decode
PARAMETERS : reg - Register to decode