arch/riscv/kernel/pi/cmdline_early.c
Source file repositories/reference/linux-study-clean/arch/riscv/kernel/pi/cmdline_early.c
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/kernel/pi/cmdline_early.c- Extension
.c- Size
- 1529 bytes
- Lines
- 69
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
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
linux/types.hlinux/init.hlinux/libfdt.hlinux/string.hasm/pgtable.hasm/setup.hpi.h
Detected Declarations
function match_noXlvlfunction set_satp_mode_from_cmdlinefunction match_nokaslrfunction set_nokaslr_from_cmdline
Annotated Snippet
if (chosen_node >= 0) {
fdt_cmdline = fdt_getprop((void *)dtb_pa, chosen_node,
"bootargs", NULL);
if (fdt_cmdline) {
fdt_cmdline_size = strscpy(early_cmdline, fdt_cmdline);
if (fdt_cmdline_size < 0)
return early_cmdline;
}
}
}
if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
fdt_cmdline_size == 0 /* CONFIG_CMDLINE_FALLBACK */)
strscpy(early_cmdline + fdt_cmdline_size, CONFIG_CMDLINE,
COMMAND_LINE_SIZE - fdt_cmdline_size);
return early_cmdline;
}
static u64 match_noXlvl(char *cmdline)
{
if (strstr(cmdline, "no4lvl"))
return SATP_MODE_39;
else if (strstr(cmdline, "no5lvl"))
return SATP_MODE_48;
return 0;
}
u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa)
{
char *cmdline = get_early_cmdline(dtb_pa);
return match_noXlvl(cmdline);
}
static bool match_nokaslr(char *cmdline)
{
return strstr(cmdline, "nokaslr");
}
bool set_nokaslr_from_cmdline(uintptr_t dtb_pa)
{
char *cmdline = get_early_cmdline(dtb_pa);
return match_nokaslr(cmdline);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/init.h`, `linux/libfdt.h`, `linux/string.h`, `asm/pgtable.h`, `asm/setup.h`, `pi.h`.
- Detected declarations: `function match_noXlvl`, `function set_satp_mode_from_cmdline`, `function match_nokaslr`, `function set_nokaslr_from_cmdline`.
- Atlas domain: Architecture Layer / arch/riscv.
- Implementation status: source implementation candidate.
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.