Can the fastcall & inline function be in the linux kernel?

I would like to define a function that will be called from entry_32.S. It will be called just before the actual call handling function is called.

To avoid the overhead of calling the function and passing parameters, 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)

      

+3


source to share


1 answer


The compiler can inline functions into C code (whether they have a keyword inline

or not), but the assembler is not that smart. What you write in an assembly is what will be assembled without optimization (like inline).



0


source







All Articles