https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113312
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to H. Peter Anvin from comment #3)
> Created attachment 57032 [details]
> FRED assembly entry stub (example, slightly modified from the Linux kernel)
Can you do
asm_fred_entry_\type:
endbr64
push %rdi
push %rsi
push %rdx
push %rax
push %r8
push %r9
push %r10
push %r11
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
lea 15*8(%rsp),%rdi <<<<<< RDI will point to the event info after
CALL.
call fred_entry_\type /* call C code */
endbr64
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
pop %r11
pop %r10
pop %r9
pop %r8
pop %rax
pop %rdx
pop %rsi
pop %rdi
\eret