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.

Dependency Surface

Detected Declarations

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

Implementation Notes