arch/powerpc/mm/nohash/book3e_pgtable.c
Source file repositories/reference/linux-study-clean/arch/powerpc/mm/nohash/book3e_pgtable.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/mm/nohash/book3e_pgtable.c- Extension
.c- Size
- 3564 bytes
- Lines
- 133
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
Dependency Surface
linux/sched.hlinux/memblock.hasm/pgalloc.hasm/tlb.hasm/dma.hasm/text-patching.hmm/mmu_decl.h
Detected Declarations
function vmemmap_create_mappingfunction vmemmap_remove_mappingfunction map_kernel_pagefunction __patch_exception
Annotated Snippet
if (p4d_none(*p4dp)) {
pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
p4d_populate(&init_mm, p4dp, pudp);
}
pudp = pud_offset(p4dp, ea);
if (pud_none(*pudp)) {
pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
pud_populate(&init_mm, pudp, pmdp);
}
pmdp = pmd_offset(pudp, ea);
if (!pmd_present(*pmdp)) {
ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
pmd_populate_kernel(&init_mm, pmdp, ptep);
}
ptep = pte_offset_kernel(pmdp, ea);
}
set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, prot));
smp_wmb();
return 0;
}
void __patch_exception(int exc, unsigned long addr)
{
unsigned int *ibase = &interrupt_base_book3e;
/*
* Our exceptions vectors start with a NOP and -then- a branch
* to deal with single stepping from userspace which stops on
* the second instruction. Thus we need to patch the second
* instruction of the exception, not the first one.
*/
patch_branch(ibase + (exc / 4) + 1, addr, 0);
}
Annotation
- Immediate include surface: `linux/sched.h`, `linux/memblock.h`, `asm/pgalloc.h`, `asm/tlb.h`, `asm/dma.h`, `asm/text-patching.h`, `mm/mmu_decl.h`.
- Detected declarations: `function vmemmap_create_mapping`, `function vmemmap_remove_mapping`, `function map_kernel_page`, `function __patch_exception`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.