FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * REMARKS:
 * Implements the RCR instruction and side effects.
 */
Implements the RCR instruction and side effects.
Implements the RCR instruction and side effects .
static uint32_t 
rcr_long(struct x86emu *emu, uint32_t d, uint8_t s)
{
	uint32_t res, cnt;
	uint32_t mask, cf, ocf = 0;
	res = d;
	if ((cnt = s % 33) != 0) {
		if (cnt == 1) {
			cf = d & 0x1;
			ocf = ACCESS_FLAG(F_CF) != 0;
		} else
			cf = (d >> (cnt - 1)) & 0x1;
		mask = (1 << (32 - cnt)) - 1;
		res = (d >> cnt) & mask;
		if (cnt != 1)
			res |= (d << (33 - cnt));
		if (ACCESS_FLAG(F_CF)) {	
			res |= 1 << (32 - cnt);
		}
		CONDITIONAL_SET_FLAG(cf, F_CF);
		if (cnt == 1) {
			CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)),
			    F_OF);
		}
	}
	return res;
}
static uint32_t rcr_long ( struct x86emu * emu , uint32_t d , uint8_t s ) { uint32_t res , cnt ; uint32_t mask , cf , ocf = 0 ; res = d ; if ( ( cnt = s % 33 ) != 0 ) { if ( cnt == 1 ) { cf = d & 0x1 ; ocf = ACCESS_FLAG ( F_CF ) != 0 ; } else cf = ( d >> ( cnt - 1 ) ) & 0x1 ; mask = ( 1 << ( 32 - cnt ) ) - 1 ; res = ( d >> cnt ) & mask ; if ( cnt != 1 ) res |= ( d << ( 33 - cnt ) ) ; if ( ACCESS_FLAG ( F_CF ) ) { res |= 1 << ( 32 - cnt ) ; } CONDITIONAL_SET_FLAG ( cf , F_CF ) ; if ( cnt == 1 ) { CONDITIONAL_SET_FLAG ( XOR2 ( ocf + ( ( d >> 30 ) & 0x2 ) ) , F_OF ) ; } } return res ; }
REMARKS:
 Implements the RCR instruction and side effects.
REMARKS : Implements the RCR instruction and side effects .
/* rotate right through carry */ /* carry flag is set */