arch/arm64/tools/gen-cpucaps.awk

Source file repositories/reference/linux-study-clean/arch/arm64/tools/gen-cpucaps.awk

File Facts

System
Linux kernel
Corpus path
arch/arm64/tools/gen-cpucaps.awk
Extension
.awk
Size
773 bytes
Lines
41
Domain
Architecture Layer
Bucket
arch/arm64
Inferred role
Architecture Layer: arch/arm64
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

function fatal(msg) {
	print "Error at line " NR ": " msg > "/dev/stderr"
	exit 1
}

# skip blank lines and comment lines
/^$/ { next }
/^#/ { next }

BEGIN {
	print "#ifndef __ASM_CPUCAP_DEFS_H"
	print "#define __ASM_CPUCAP_DEFS_H"
	print ""
	print "/* Generated file - do not edit */"
	cap_num = 0
	print ""
}

/^[vA-Z0-9_]+$/ {
	printf("#define ARM64_%-40s\t%d\n", $0, cap_num++)
	next
}

END {
	printf("#define ARM64_NCAPS\t\t\t\t\t%d\n", cap_num)
	print ""
	print "#endif /* __ASM_CPUCAP_DEFS_H */"
}

# Any lines not handled by previous rules are unexpected
{
	fatal("unhandled statement")
}

Annotation

Implementation Notes