Jinoh Kang (@iamahuman) commented about dlls/ntdll/tests/exception.c:
0x55, /* push rbp */
0x56, /* push rsi */
0x57, /* push rdi */
0x41, 0x54, /* push r12 */
0x41, 0x55, /* push r13 */
0x41, 0x56, /* push r14 */
0x41, 0x57, /* push r15 */
0x48, 0x83, 0xec, 0x28, /* sub rsp, 8*5; stack space */
0x48, 0x89, 0x24, 0x24, /* mov [rsp+8*0], rsp; for validation */
/* save args */
0x48, 0x89, 0x4c, 0x24, 0x08, /* mov [rsp+8*1], rcx */
0x48, 0x89, 0x54, 0x24, 0x10, /* mov [rsp+8*2], rdx */
0x4c, 0x89, 0x44, 0x24, 0x18, /* mov [rsp+8*3], r8 */
0x4c, 0x89, 0x4c, 0x24, 0x20, /* mov [rsp+8*4], r9 */
Save arguments in the parameter home area wherever possible, instead of allocating its space yourself.
See https://learn.microsoft.com/en-us/cpp/build/stack-usage?view=msvc-170#stack-... for how x86-64 MSVC ABI defines the stack layout.