Skip to content

Commit

Permalink
UCM/BISTRO: Parse libcuda debug hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Aug 6, 2021
1 parent 9f17d24 commit e010473
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ucm/bistro/bistro_x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ typedef struct {
/* ModR/M encoding for EBP/BP/CH/MM5/XMM5, AH/SP/ESP/MM4/XMM4 */
#define UCM_BISTRO_X86_MODRM_BP_SP 0xE5 /* 11 100 101 */

/* ModR/M encoding for CMP [RIP+x], Imm32 */
#define UCM_BISTRO_X86_MODRM_CMP_RIP 0x3D /* 11 111 101 */


/*
* Find the minimal length of initial instructions in the function which can be
Expand Down Expand Up @@ -144,6 +147,12 @@ static size_t ucm_bistro_detect_pic_prefix(const void *func, size_t min_length)
((opcode & UCM_BISTRO_X86_MOV_IR_MASK) == UCM_BISTRO_X86_MOV_IR)) {
offset += sizeof(uint32_t);
continue;
} else if ((rex == 0) && (opcode == UCM_BISTRO_X86_IMM_GRP1_EV_IZ)) {
modrm = *(uint8_t*)UCS_PTR_BYTE_OFFSET(func, offset++);
if (modrm == UCM_BISTRO_X86_MODRM_CMP_RIP) {
offset += sizeof(uint32_t) * 2; /* skip disp32 and imm32 */
}
continue;
}

/* unsupported instruction - bail */
Expand Down

0 comments on commit e010473

Please sign in to comment.