arch/arm64/tools/gen-sysreg.awk
Source file repositories/reference/linux-study-clean/arch/arm64/tools/gen-sysreg.awk
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/tools/gen-sysreg.awk- Extension
.awk- Size
- 8629 bytes
- Lines
- 412
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function block_currentfunction fatalfunction block_pushfunction expect_fields
Annotated Snippet
function block_current() {
return __current_block[__current_block_depth];
}
# Log an error and terminate
function fatal(msg) {
print "Error at " NR ": " msg > "/dev/stderr"
printf "Current block nesting:"
for (i = 0; i <= __current_block_depth; i++) {
printf " " __current_block[i]
}
printf "\n"
exit 1
}
# Enter a new block, setting the active block to @block
function block_push(block) {
__current_block[++__current_block_depth] = block
}
# Exit a block, setting the active block to the parent block
function block_pop() {
if (__current_block_depth == 0)
fatal("error: block_pop() in root block")
__current_block_depth--;
}
# Sanity check the number of records for a field makes sense. If not, produce
# an error and terminate.
function expect_fields(nf) {
if (NF != nf)
fatal(NF " fields found where " nf " expected")
}
# Print a CPP macro definition, padded with spaces so that the macro bodies
# line up in a column
function define(prefix, name, val) {
printf "%-56s%s\n", "#define " prefix name, val
}
# Same as above, but without a prefix
function define_reg(name, val) {
define(null, name, val)
}
# Print standard BITMASK/SHIFT/WIDTH CPP definitions for a field
function define_field(prefix, reg, field, msb, lsb) {
define(prefix, reg "_" field, "GENMASK(" msb ", " lsb ")")
define(prefix, reg "_" field "_MASK", "GENMASK(" msb ", " lsb ")")
define(prefix, reg "_" field "_SHIFT", lsb)
define(prefix, reg "_" field "_WIDTH", msb - lsb + 1)
}
# Print a field _SIGNED definition for a field
function define_field_sign(prefix, reg, field, sign) {
define(prefix, reg "_" field "_SIGNED", sign)
}
# Print the Res0, Res1, Unkn masks
function define_resx_unkn(prefix, reg, res0, res1, unkn) {
if (res0 != null)
define(prefix, reg "_RES0", "(" res0 ")")
if (res1 != null)
define(prefix, reg "_RES1", "(" res1 ")")
if (unkn != null)
define(prefix, reg "_UNKN", "(" unkn ")")
Annotation
- Detected declarations: `function block_current`, `function fatal`, `function block_push`, `function expect_fields`.
- Atlas domain: Architecture Layer / arch/arm64.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.