arch/nios2/kernel/setup.c
Source file repositories/reference/linux-study-clean/arch/nios2/kernel/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/nios2/kernel/setup.c- Extension
.c- Size
- 4854 bytes
- Lines
- 209
- Domain
- Architecture Layer
- Bucket
- arch/nios2
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/kernel.hlinux/mm.hlinux/sched.hlinux/sched/task.hlinux/console.hlinux/memblock.hlinux/initrd.hlinux/of_fdt.hasm/mmu_context.hasm/sections.hasm/setup.hasm/cpuinfo.h
Detected Declarations
function copy_exception_handlerfunction copy_fast_tlb_miss_handlerfunction nios2_boot_initfunction find_limitsfunction adjust_lowmem_boundsfunction for_each_mem_rangefunction setup_archexport memory_startexport memory_end
Annotated Snippet
if (r5) { /* initramfs */
initrd_start = r5;
initrd_end = r6;
}
#endif /* CONFIG_BLK_DEV_INITRD */
dtb_passed = r6;
if (r7)
strscpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE);
}
#endif
early_init_devtree((void *)dtb_passed);
#ifndef CONFIG_CMDLINE_FORCE
if (cmdline_passed[0])
strscpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE);
#ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB
else
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif
#endif
parse_early_param();
}
static void __init find_limits(unsigned long *min, unsigned long *max_low,
unsigned long *max_high)
{
*max_low = PFN_DOWN(memblock_get_current_limit());
*min = PFN_UP(memblock_start_of_DRAM());
*max_high = PFN_DOWN(memblock_end_of_DRAM());
}
static void __init adjust_lowmem_bounds(void)
{
phys_addr_t block_start, block_end;
u64 i;
phys_addr_t memblock_limit = 0;
for_each_mem_range(i, &block_start, &block_end) {
if (block_end > memblock_limit)
memblock_limit = block_end;
}
memblock_set_current_limit(memblock_limit);
}
void __init setup_arch(char **cmdline_p)
{
console_verbose();
memory_start = memblock_start_of_DRAM();
memory_end = memblock_end_of_DRAM();
pr_debug("%s: start=%lx, end=%lx\n", __func__, memory_start, memory_end);
setup_initial_init_mm(_stext, _etext, _edata, _end);
init_task.thread.kregs = &fake_regs;
/* Keep a copy of command line */
*cmdline_p = boot_command_line;
adjust_lowmem_bounds();
find_limits(&min_low_pfn, &max_low_pfn, &max_pfn);
memblock_reserve(__pa_symbol(_stext), _end - _stext);
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start) {
memblock_reserve(virt_to_phys((void *)initrd_start),
initrd_end - initrd_start);
}
#endif /* CONFIG_BLK_DEV_INITRD */
early_init_fdt_reserve_self();
early_init_fdt_scan_reserved_mem();
unflatten_and_copy_device_tree();
setup_cpuinfo();
copy_exception_handler(cpuinfo.exception_addr);
mmu_init();
copy_fast_tlb_miss_handler(cpuinfo.fast_tlb_miss_exc_addr);
/*
* Initialize MMU context handling here because data from cpuinfo is
* needed for this.
Annotation
- Immediate include surface: `linux/export.h`, `linux/kernel.h`, `linux/mm.h`, `linux/sched.h`, `linux/sched/task.h`, `linux/console.h`, `linux/memblock.h`, `linux/initrd.h`.
- Detected declarations: `function copy_exception_handler`, `function copy_fast_tlb_miss_handler`, `function nios2_boot_init`, `function find_limits`, `function adjust_lowmem_bounds`, `function for_each_mem_range`, `function setup_arch`, `export memory_start`, `export memory_end`.
- Atlas domain: Architecture Layer / arch/nios2.
- Implementation status: integration 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.