1. The Code in the underlying Linux kernel is mostly completed in assembly language.
assembly code exists in two forms. One is a pure assembly code file suffixed with. S. Of course, the precompilation option is also added to such assembly code, rather than just assembly. The other is to embed the assembly language in the C language. Although there are no provisions on Assembly fragments in ansi c language standards, in fact, all the actually used C compilations have been expanded in this regard. The gnu c compiler GCC has also made great extensions in this regard.
the gnu c compiler GCC uses different syntaxes than the commonly used 386 assembly language in the kernel "pure" assembly code; in the Assembly snippet embedded in the C Program , it also adds a number of language components that guide assembly tools on how to allocate registers and how to combine variables defined in C Programs. these components make this assembly language actually an intermediate language between 386 assembly and C.
2. assembly Language embedded in C Code
the assembly language segments inserted into C code can be divided into four parts, separated by, the general format is
command department: Output Department: Input department: department of damage
where the command department is required, the format is roughly the same as that of standard assembly.
output indicates the association between the assembly code segment and the C code variable. The format is as follows:
"M" "V" "O" ---- memory unit
"R" ---- any register
"Q" ---- register eax, EBX, ECx,
"I" "H" ---- direct operand
"E" "F" ---- floating point number
"G" ---- arbitrary
""" B "" C "" D "-eax is used, EBX, ECx, EDX
"S" "D" ---- use ESI, EDI
"I" ---- constant (0-31)