arch/sh/tools/gen-mach-types
Source file repositories/reference/linux-study-clean/arch/sh/tools/gen-mach-types
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/tools/gen-mach-types- Extension
[no extension]- Size
- 1340 bytes
- Lines
- 49
- Domain
- Architecture Layer
- Bucket
- arch/sh
- Inferred role
- Architecture Layer: arch/sh
- 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
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/awk
# SPDX-License-Identifier: GPL-2.0
#
# Awk script to generate include/generated/machtypes.h
# Heavily based on arch/arm/tools/gen-mach-types
#
BEGIN { nr = 0 }
/^#/ { next }
/^[ ]*$/ { next }
NF == 2 {
mach[nr] = $1;
config[nr] = "CONFIG_"$2;
nr++;
}
END {
printf("/*\n");
printf(" * Automagically generated, don't touch.\n");
printf(" */\n");
printf("#ifndef __ASM_SH_MACHTYPES_H\n");
printf("#define __ASM_SH_MACHTYPES_H\n");
printf("\n");
printf("/*\n");
printf(" * We'll use the following MACH_xxx defs for placeholders for the time\n");
printf(" * being .. these will all go away once sh_machtype is assigned per-board.\n");
printf(" *\n");
printf(" * For now we leave things the way they are for backwards compatibility.\n");
printf(" */\n");
printf("\n");
printf("/* Mach types */\n");
for (i = 0; i < nr; i++) {
printf("#ifdef %s\n", config[i]);
printf(" #define MACH_%s\t\t1\n", mach[i]);
printf("#else\n");
printf(" #define MACH_%s\t\t0\n", mach[i]);
printf("#endif\n");
}
printf("\n");
printf("/* Machtype checks */\n");
for (i = 0; i < nr; i++)
printf("#define mach_is_%s()\t\t\t(MACH_%s)\n",
tolower(mach[i]), mach[i]);
printf("\n");
printf("#endif /* __ASM_SH_MACHTYPES_H */\n");
}
Annotation
- Atlas domain: Architecture Layer / arch/sh.
- 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.