Includeasmx86linkage32h

#define asmlinkage CPP_ASMLINKAGE _attribute_((regparm(O)))

#define FASTCALL(x) x _attribute_((regparm(3)))

#define fastcall _attribute_((regparm(3)))

fastcall is used — as the name clearly suggests — to invoke a function quickly.

asmlinkage identifies functions to be called from within assembler code. Because parameter passing must be coded manually in this case (and are therefore not accessible to the compiler), there must be no surprises as to how many parameters are to be passed in registers and how many are to be passed on the stack — this is why the option of passing parameters in registers must be explicitly disabled. The cpp_asmlinkage keyword usually expands to an empty string (the extern C keyword is inserted only if a C++ compiler is used to compile the kernel), which instructs the compiler to use the C calling convention (the first argument is last on the stack) instead of the C++ calling convention (the first argument is first on the stack).

On all architectures other than IA-32, the macros shown above are defined to expand to an empty string.

□ section allows the compiler to place variables and functions in other sections of the binary file than would usually be the case (refer to Appendix E for a more detailed description of the binary format). This is important when implementing the init and exit calls mentioned throughout this book. The name of the section where the material is to be placed must be passed to the attribute as a string parameter.

To define init calls, the compiler uses, for example, the following macro to place the functions in sections named .initcallO.init and so on:

Continue reading here: Info

Was this article helpful?

0 0