@@ -434,9 +434,9 @@ HostToGuestThunk X64ThunkEmitter::EmitHostToGuestThunk() {
434434 code_offsets.prolog = getSize ();
435435
436436 // rsp + 0 = return address
437- mov (qword[rsp + 8 * 3 ], GetNativeReg (2 ));
438- mov (qword[rsp + 8 * 2 ], GetNativeReg (1 ));
439- mov (qword[rsp + 8 * 1 ], GetNativeReg (0 ));
437+ mov (qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 2 ]) ], GetNativeReg (2 ));
438+ mov (qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 1 ]) ], GetNativeReg (1 ));
439+ mov (qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 0 ]) ], GetNativeReg (0 ));
440440 sub (rsp, stack_size);
441441
442442 code_offsets.prolog_stack_alloc = getSize ();
@@ -455,9 +455,9 @@ HostToGuestThunk X64ThunkEmitter::EmitHostToGuestThunk() {
455455 code_offsets.epilog = getSize ();
456456
457457 add (rsp, stack_size);
458- mov (GetNativeReg (0 ), qword[rsp + 8 * 1 ]);
459- mov (GetNativeReg (1 ), qword[rsp + 8 * 2 ]);
460- mov (GetNativeReg (2 ), qword[rsp + 8 * 3 ]);
458+ mov (GetNativeReg (0 ), qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 0 ]) ]);
459+ mov (GetNativeReg (1 ), qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 1 ]) ]);
460+ mov (GetNativeReg (2 ), qword[rsp + offsetof (StackLayout::Thunk, arg_temp[ 2 ]) ]);
461461 ret ();
462462
463463 code_offsets.tail = getSize ();
0 commit comments