在linux内核中,asm还是asm-generic?

Hai*_* Li 9 linux-kernel

在mm/memory.c中,它包含一个文件:

#include <asm/tlb.h>
Run Code Online (Sandbox Code Playgroud)

该tlb.h是include/asm-generic/tlb.h还是arch/arm/include/asm/tlb.h?

Hai*_* Li 4

如果需要, 中的头文件arch/arm/include/asm将包含include/asm-generic.

所以在这个例子中,tlb.h是arch/arm/include/asm/tlb.h。如果有必要,它将包括include/asm-generic/tlb.h.

您可以通过运行以下命令来验证这一点:

# The memory.s target creates the assembly file for memory.c
make mm/memory.s
Run Code Online (Sandbox Code Playgroud)

由此,您可以识别正在使用哪个头文件。