void ref_or_reg8_to_reg8(int from_reg, int to_reg) { char *f = get_byte_reg(from_reg), *t = get_byte_reg(to_reg); *t |= *f; }
void ref_or_reg8_to_mem8(char *mrm, long off) { int reg = (mrm[0]>>3)&0x7; if (!is_memop(mrm)) { ref_or_reg8_to_reg8(reg, mrm[0]&0x7); return; } char *addr = do_lea(mrm); *(char *)(addr+off) |= *get_byte_reg(reg); }
void ref_copy_mem8_to_al(char *mrm, long off) { int reg = 0; if (!is_memop(mrm)) { ref_copy_reg8_to_reg8(mrm[0]&0x7, reg); return; } char *addr = do_lea(mrm); char *t = get_byte_reg(reg); *t = *(char *)(addr+off); }
void ref_swap_reg8_mem8(char *mrm, long off) { int reg = (mrm[0]>>3)&0x7; if (!is_memop(mrm)) { ref_swap_reg8_reg8(reg, mrm[0]&0x7); return; } char *addr = do_lea(mrm); char *r = get_byte_reg(reg); char tmp = *(char*)(addr+off); *(char*)(addr+off) = *r; *r = tmp; }
void ref_copy_reg8_to_reg16(int from_reg, int to_reg) { char *f=get_byte_reg(from_reg); taint_regs[to_reg] = (taint_regs[to_reg]&0xFFFF0000) | (unsigned char)(*f); }
void ref_swap_reg8_reg8(int reg1, int reg2) { char *r1 = get_byte_reg(reg1); char *r2 = get_byte_reg(reg2); char tmp = *r1; *r1=*r2; *r2=tmp; }
void ref_erase_reg8(int reg) { *get_byte_reg(reg) = 0; }
static unsigned decode_r8b(BYTE *seg, unsigned off, char *buf) { unsigned ModRM = GetMemInc(seg,off); sprintf(buf,"%s,%s", get_byte_reg(ModRM), get_mem(ModRM, seg, &off, byte_reg, blank)); return off; }