arch/sparc/mm/init_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/mm/init_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/mm/init_32.c- Extension
.c- Size
- 7749 bytes
- Lines
- 300
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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/module.hlinux/signal.hlinux/sched.hlinux/kernel.hlinux/errno.hlinux/string.hlinux/types.hlinux/ptrace.hlinux/mman.hlinux/mm.hlinux/swap.hlinux/initrd.hlinux/init.hlinux/highmem.hlinux/memblock.hlinux/pagemap.hlinux/poison.hlinux/gfp.hasm/sections.hasm/page.hasm/vaddrs.hasm/setup.hasm/tlb.hasm/prom.hasm/leon.hmm_32.h
Detected Declarations
function calc_highpagesfunction calc_max_low_pfnfunction find_ramdiskfunction bootmem_initfunction paging_initfunction taint_real_pagesfunction arch_mm_preinitfunction sparc_flush_page_to_ramfunction sparc_flush_folio_to_ramexport phys_baseexport pfn_baseexport sparc_flush_page_to_ramexport sparc_flush_folio_to_ram
Annotated Snippet
if (curr_pfn >= tmp) {
if (last_pfn < tmp)
tmp = last_pfn;
break;
}
last_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT;
}
return tmp;
}
static void __init find_ramdisk(unsigned long end_of_phys_memory)
{
#ifdef CONFIG_BLK_DEV_INITRD
unsigned long size;
/* Now have to check initial ramdisk, so that it won't pass
* the end of memory
*/
if (sparc_ramdisk_image) {
if (sparc_ramdisk_image >= (unsigned long)&_end - 2 * PAGE_SIZE)
sparc_ramdisk_image -= KERNBASE;
initrd_start = sparc_ramdisk_image + phys_base;
initrd_end = initrd_start + sparc_ramdisk_size;
if (initrd_end > end_of_phys_memory) {
printk(KERN_CRIT "initrd extends beyond end of memory "
"(0x%016lx > 0x%016lx)\ndisabling initrd\n",
initrd_end, end_of_phys_memory);
initrd_start = 0;
} else {
/* Reserve the initrd image area. */
size = initrd_end - initrd_start;
memblock_reserve(initrd_start, size);
initrd_start = (initrd_start - phys_base) + PAGE_OFFSET;
initrd_end = (initrd_end - phys_base) + PAGE_OFFSET;
}
}
#endif
}
unsigned long __init bootmem_init(unsigned long *pages_avail)
{
unsigned long start_pfn, bytes_avail, size;
unsigned long end_of_phys_memory = 0;
unsigned long high_pages = 0;
int i;
memblock_set_bottom_up(true);
memblock_allow_resize();
bytes_avail = 0UL;
for (i = 0; sp_banks[i].num_bytes != 0; i++) {
end_of_phys_memory = sp_banks[i].base_addr +
sp_banks[i].num_bytes;
bytes_avail += sp_banks[i].num_bytes;
if (cmdline_memory_size) {
if (bytes_avail > cmdline_memory_size) {
unsigned long slack = bytes_avail - cmdline_memory_size;
bytes_avail -= slack;
end_of_phys_memory -= slack;
sp_banks[i].num_bytes -= slack;
if (sp_banks[i].num_bytes == 0) {
sp_banks[i].base_addr = 0xdeadbeef;
} else {
memblock_add(sp_banks[i].base_addr,
sp_banks[i].num_bytes);
sp_banks[i+1].num_bytes = 0;
sp_banks[i+1].base_addr = 0xdeadbeef;
}
break;
}
}
memblock_add(sp_banks[i].base_addr, sp_banks[i].num_bytes);
}
/* Start with page aligned address of last symbol in kernel
* image.
*/
start_pfn = (unsigned long)__pa(PAGE_ALIGN((unsigned long) &_end));
/* Now shift down to get the real physical page frame number. */
start_pfn >>= PAGE_SHIFT;
max_pfn = end_of_phys_memory >> PAGE_SHIFT;
max_low_pfn = max_pfn;
Annotation
- Immediate include surface: `linux/module.h`, `linux/signal.h`, `linux/sched.h`, `linux/kernel.h`, `linux/errno.h`, `linux/string.h`, `linux/types.h`, `linux/ptrace.h`.
- Detected declarations: `function calc_highpages`, `function calc_max_low_pfn`, `function find_ramdisk`, `function bootmem_init`, `function paging_init`, `function taint_real_pages`, `function arch_mm_preinit`, `function sparc_flush_page_to_ram`, `function sparc_flush_folio_to_ram`, `export phys_base`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.