MCPcopy Create free account
hub / github.com/GJDuck/e9patch / sendMovFromR64ToR64

Function sendMovFromR64ToR64

src/e9tool/e9codegen.cpp:1164–1180  ·  view source on GitHub ↗

* Send a `mov %r64,%r64' instruction. */

Source from the content-addressed store, hash-verified

1162 * Send a `mov %r64,%r64' instruction.
1163 */
1164bool sendMovFromR64ToR64(FILE *out, int srcno, int dstno)
1165{
1166 if (srcno == dstno)
1167 return false;
1168 const uint8_t REX_MASK[] =
1169 {0, 0, 0, 0, 1, 1, 0,
1170 0, 1, 1, 0, 0, 1, 1, 1, 1, 0};
1171 const uint8_t REX[] = {0x48, 0x4c, 0x49, 0x4d};
1172 const uint8_t REG[] =
1173 {0x07, 0x06, 0x02, 0x01, 0x00, 0x01, 0x00,
1174 0x00, 0x02, 0x03, 0x03, 0x05, 0x04, 0x05, 0x06, 0x07, 0x04};
1175
1176 uint8_t rex = REX[(REX_MASK[dstno] << 1) | REX_MASK[srcno]];
1177 uint8_t modrm = (0x03 << 6) | (REG[srcno] << 3) | REG[dstno];
1178 fprintf(out, "%u,%u,%u,", rex, 0x89, modrm);
1179 return true;
1180}
1181
1182/*
1183 * Send a `movslq %r32,%r64' instruction.

Callers 7

sendTemporaryMovRegFunction · 0.85
sendUndoTemporaryMovRegFunction · 0.85
sendLoadRegToArgFunction · 0.85
sendLoadTargetMetadataFunction · 0.85
sendPushFunction · 0.85
sendPopFunction · 0.85
sendLeaFromStackToR64Function · 0.85

Calls 1

fprintfFunction · 0.50

Tested by

no test coverage detected