* Send a `movzbl offset(%rsp),%r64' instruction. */
| 1371 | * Send a `movzbl offset(%rsp),%r64' instruction. |
| 1372 | */ |
| 1373 | void sendMovFromStack8ToR64(FILE *out, int32_t offset, int regno) |
| 1374 | { |
| 1375 | const uint8_t REX[] = |
| 1376 | {0x48, 0x48, 0x48, 0x48, 0x4c, 0x4c, 0x00, |
| 1377 | 0x48, 0x4c, 0x4c, 0x48, 0x48, 0x4c, 0x4c, 0x4c, 0x4c, 0x48}; |
| 1378 | const uint8_t MODRM_0[] = |
| 1379 | {0x3c, 0x34, 0x14, 0x0c, 0x04, 0x0c, 0x00, |
| 1380 | 0x04, 0x14, 0x1c, 0x1c, 0x2c, 0x24, 0x2c, 0x34, 0x3c, 0x24}; |
| 1381 | const uint8_t MODRM_8[] = |
| 1382 | {0x7c, 0x74, 0x54, 0x4c, 0x44, 0x4c, 0x00, |
| 1383 | 0x44, 0x54, 0x5c, 0x5c, 0x6c, 0x64, 0x6c, 0x74, 0x7c, 0x64}; |
| 1384 | const uint8_t MODRM_32[] = |
| 1385 | {0xbc, 0xb4, 0x94, 0x8c, 0x84, 0x8c, 0x00, |
| 1386 | 0x84, 0x94, 0x9c, 0x9c, 0xac, 0xa4, 0xac, 0xb4, 0xbc, 0xa4}; |
| 1387 | |
| 1388 | if (offset == 0) |
| 1389 | fprintf(out, "%u,%u,%u,%u,%u,", |
| 1390 | REX[regno], 0x0f, 0xbe, MODRM_0[regno], 0x24); |
| 1391 | else if (offset >= INT8_MIN && offset <= INT8_MAX) |
| 1392 | fprintf(out, "%u,%u,%u,%u,%u,{\"int8\":%d},", |
| 1393 | REX[regno], 0x0f, 0xbe, MODRM_8[regno], 0x24, offset); |
| 1394 | else |
| 1395 | fprintf(out, "%u,%u,%u,%u,%u,{\"int32\":%d},", |
| 1396 | REX[regno], 0x0f, 0xbe, MODRM_32[regno], 0x24, offset); |
| 1397 | } |
| 1398 | |
| 1399 | /* |
| 1400 | * Send a `mov %r64,offset(%rsp)' instruction. |
no test coverage detected