I would like to define a function that will be invoked from entry_32.S. It will be invoked just before the real system call handling function is called.
In order to avoid the overhead of function calling and parameter passing, can I declare my_foo as
fastcall inline int my_foo (int n);
/*in entry_32.S*/
pushl %eax
CFI_ADJUST_CFA_OFFSET 4
SAVE_ALL
....
/* My code begins*/
call my_foo
cmpl $0, %eax
jne syscall_wrong
movl PT_ORIG_EAX(%esp), %eax
/* My code ends */
call *sys_call_table(,%eax,4)
The compiler can inline functions in C code (whether they have the
inlinekeyword or not) but the assembler is not that smart. What you write in assembly is exactly what will be assembled, no optimization (like inlining) at all.