Skip to content

Commit bd3d5e5

Browse files
authored
Merge pull request #10627 from iyastreb/ucm-cuda-bistro-hook-fix-1.18
UCM/CUDA: Fixed cuda12.9 amd64 bistro hook missing instruction - v1.18.x
2 parents 81baeb1 + f4ff1e5 commit bd3d5e5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/ucm/bistro/bistro_x86_64.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ typedef struct {
8282
/* Immediate Grp 1(1A), Ev, Iz */
8383
#define UCM_BISTRO_X86_IMM_GRP1_EV_IZ 0x81
8484

85+
/* Immediate Grp 1(1A), Ev, Ib - 8-bit immediate */
86+
#define UCM_BISTRO_X86_IMM_GRP1_EV_IB 0x83
87+
8588
/* MOV Ev,Gv */
8689
#define UCM_BISTRO_X86_MOV_EV_GV 0x89
8790

@@ -156,11 +159,18 @@ ucs_status_t ucm_bistro_relocate_one(ucm_bistro_relocate_context_t *ctx)
156159
/* push reg */
157160
goto out_copy_src;
158161
} else if ((rex == UCM_BISTRO_X86_REX_W) &&
159-
(opcode == UCM_BISTRO_X86_IMM_GRP1_EV_IZ)) {
162+
((opcode == UCM_BISTRO_X86_IMM_GRP1_EV_IZ) || /* sub $imm32, r/m64 */
163+
(opcode == UCM_BISTRO_X86_IMM_GRP1_EV_IB))) { /* sub $imm8, r/m64 */
160164
modrm = *ucs_serialize_next(&ctx->src_p, const uint8_t);
161165
if (modrm == UCM_BISTRO_X86_MODRM_SUB_SP) {
162-
/* sub $imm32, %rsp */
163-
ucs_serialize_next(&ctx->src_p, const uint32_t);
166+
if (opcode == UCM_BISTRO_X86_IMM_GRP1_EV_IB) {
167+
/* sub $imm8, %rsp */
168+
ucs_serialize_next(&ctx->src_p, const uint8_t);
169+
} else {
170+
/* sub $imm32, %rsp */
171+
ucs_serialize_next(&ctx->src_p, const uint32_t);
172+
}
173+
164174
goto out_copy_src;
165175
}
166176
} else if ((rex == UCM_BISTRO_X86_REX_W) &&

0 commit comments

Comments
 (0)