uint8_t CFIWalker::processMixedInstr(void* opaque, int (*mapRegisterNumber)(void*, int), uint8_t instr) { int origRegNo = int(instr) & 0x3f; int newRegNo = mapRegisterNumber(opaque, origRegNo); if (origRegNo != newRegNo) return (uint8_t) (instr & 0xC0) | newRegNo; else return instr; }
void CFIWalker::processNextReg(void* opaque, int (*mapRegisterNumber)(void*, int)) { uint64_t reg, newReg; reg = m_buffer.readULEB128(); newReg = mapRegisterNumber(opaque, reg); if (newReg != reg) { LOG << "Updating register number: " << reg << " -> " << newReg << std::endl; m_buffer.updateLastULEB128(newReg); } }
uint8_t CFIWalker::processMixedInstr(void* opaque, int (*mapRegisterNumber)(void*, int), uint8_t instr) { int origRegNo = int(instr) & 0x3f; int newRegNo = mapRegisterNumber(opaque, origRegNo); if (origRegNo != newRegNo) { LOG << "Updating mixed instr. register number: " << origRegNo << " -> " << newRegNo << std::endl; return (uint8_t) (instr & 0xC0) | (newRegNo & 0x3f); } else return instr; }