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

Function sendMovFromR16ToR64

src/e9tool/e9codegen.cpp:1203–1216  ·  view source on GitHub ↗

* Send a `movswl %r16,%r64' instruction. */

Source from the content-addressed store, hash-verified

1201 * Send a `movswl %r16,%r64' instruction.
1202 */
1203void sendMovFromR16ToR64(FILE *out, int srcno, int dstno)
1204{
1205 const uint8_t REX_MASK[] =
1206 {0, 0, 0, 0, 1, 1, 0,
1207 0, 1, 1, 0, 0, 1, 1, 1, 1, 0};
1208 const uint8_t REX[] = {0x48, 0x4c, 0x49, 0x4d};
1209 const uint8_t REG[] =
1210 {0x07, 0x06, 0x02, 0x01, 0x00, 0x01, 0x00,
1211 0x00, 0x02, 0x03, 0x03, 0x05, 0x04, 0x05, 0x06, 0x07, 0x04};
1212
1213 uint8_t rex = REX[(REX_MASK[srcno] << 1) | REX_MASK[dstno]];
1214 uint8_t modrm = (0x03 << 6) | (REG[dstno] << 3) | REG[srcno];
1215 fprintf(out, "%u,%u,%u,%u,", rex, 0x0f, 0xbf, modrm);
1216}
1217
1218/*
1219 * Send a `movsbl %r8,%r32' instruction.

Callers 2

sendLoadRegToArgFunction · 0.85
sendLoadArgumentMetadataFunction · 0.85

Calls 1

fprintfFunction · 0.50

Tested by

no test coverage detected