+ #ifdef TARGET_WIN32
+ /* Since we are doing a call as part of setting up stackframe, the reserved shadow stack used by Windows platform is allocated up in
+ the callee stack area but currently the callee reg area is in between. Windows calling convention dictates that room is made on stack where
+ callee can save any parameters passed in registers. Since Windows x64 calling convention
+ uses 4 registers for the first 4 parameters, stack needs to be adjusted before making the call.
+ NOTE, Windows calling convention assumes that space for all registers have been reserved, regardless
+ of the number of function parameters actually used.
+ */
+ int shadow_reg_size = 0;
+
+ shadow_reg_size = ALIGN_TO (PARAM_REGS * sizeof(gpointer), MONO_ARCH_FRAME_ALIGNMENT);
+ amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, shadow_reg_size);
+ amd64_call_reg (code, AMD64_R11);
+ amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, shadow_reg_size);
+ #else
+ amd64_call_reg (code, AMD64_R11);
+ #endif