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 byte 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 byte 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 byte operands . Also enables the decoding of instructions .
static uint8_t *
decode_rm_byte_register(struct x86emu *emu, int reg)
{
	switch (reg) {
	case 0:
		return &emu->x86.R_AL;
	case 1:
		return &emu->x86.R_CL;
	case 2:
		return &emu->x86.R_DL;
	case 3:
		return &emu->x86.R_BL;
	case 4:
		return &emu->x86.R_AH;
	case 5:
		return &emu->x86.R_CH;
	case 6:
		return &emu->x86.R_DH;
	case 7:
		return &emu->x86.R_BH;
	default:
		x86emu_halt_sys(emu);
	}
}
static uint8_t * decode_rm_byte_register ( struct x86emu * emu , int reg ) { switch ( reg ) { case 0 : return & emu -> x86 . R_AL ; case 1 : return & emu -> x86 . R_CL ; case 2 : return & emu -> x86 . R_DL ; case 3 : return & emu -> x86 . R_BL ; case 4 : return & emu -> x86 . R_AH ; case 5 : return & emu -> x86 . R_CH ; case 6 : return & emu -> x86 . R_DH ; case 7 : return & emu -> x86 . R_BH ; default : x86emu_halt_sys ( emu ) ; } }
PARAMETERS:
 reg  - Register to decode
PARAMETERS : reg - Register to decode