arch/loongarch/include/asm/pgtable.h
Source file repositories/reference/linux-study-clean/arch/loongarch/include/asm/pgtable.h
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/include/asm/pgtable.h- Extension
.h- Size
- 16529 bytes
- Lines
- 647
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hasm/addrspace.hasm/asm.hasm/page.hasm/pgtable-bits.hasm-generic/pgtable-nopmd.hasm-generic/pgtable-nopud.hasm-generic/pgtable-nop4d.hasm/highmem.hlinux/mm_types.hlinux/mmzone.hasm/fixmap.hasm/sparsemem.h
Detected Declarations
struct mm_structstruct vm_area_structfunction p4d_nonefunction p4d_badfunction p4d_presentfunction set_p4dfunction p4d_clearfunction pud_nonefunction pud_badfunction pud_presentfunction set_pudfunction pud_clearfunction pmd_nonefunction pmd_badfunction pmd_presentfunction set_pmdfunction pmd_clearfunction mk_swap_ptefunction pte_swp_exclusivefunction pte_swp_mkexclusivefunction pte_swp_clear_exclusivefunction set_ptefunction pte_clearfunction pte_presentfunction pte_youngfunction pte_dirtyfunction pte_mkoldfunction pte_mkyoungfunction pte_mkcleanfunction pte_mkdirtyfunction pte_mkwrite_novmafunction pte_wrprotectfunction pte_hugefunction pte_mkhugefunction pte_specialfunction pte_mkspecialfunction pte_accessiblefunction pte_modifyfunction update_mmu_cache_rangefunction update_mmu_cache_pmdfunction pmd_pfnfunction pmd_trans_hugefunction pmd_mkhugefunction pmd_writefunction pmd_mkwrite_novmafunction pmd_wrprotectfunction pmd_dirtyfunction pmd_mkclean
Annotated Snippet
static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
static inline int pte_dirty(pte_t pte) { return pte_val(pte) & (_PAGE_DIRTY | _PAGE_MODIFIED); }
static inline pte_t pte_mkold(pte_t pte)
{
pte_val(pte) &= ~_PAGE_ACCESSED;
return pte;
}
static inline pte_t pte_mkyoung(pte_t pte)
{
pte_val(pte) |= _PAGE_ACCESSED;
return pte;
}
static inline pte_t pte_mkclean(pte_t pte)
{
pte_val(pte) &= ~(_PAGE_DIRTY | _PAGE_MODIFIED);
return pte;
}
static inline pte_t pte_mkdirty(pte_t pte)
{
pte_val(pte) |= _PAGE_MODIFIED;
if (pte_val(pte) & _PAGE_WRITE)
pte_val(pte) |= _PAGE_DIRTY;
return pte;
}
static inline pte_t pte_mkwrite_novma(pte_t pte)
{
pte_val(pte) |= _PAGE_WRITE;
if (pte_val(pte) & _PAGE_MODIFIED)
pte_val(pte) |= _PAGE_DIRTY;
return pte;
}
static inline pte_t pte_wrprotect(pte_t pte)
{
pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_DIRTY);
return pte;
}
static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE; }
static inline pte_t pte_mkhuge(pte_t pte)
{
pte_val(pte) |= _PAGE_HUGE;
return pte;
}
#if defined(CONFIG_ARCH_HAS_PTE_SPECIAL)
static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
static inline pte_t pte_mkspecial(pte_t pte) { pte_val(pte) |= _PAGE_SPECIAL; return pte; }
#endif /* CONFIG_ARCH_HAS_PTE_SPECIAL */
#define pte_accessible pte_accessible
static inline unsigned long pte_accessible(struct mm_struct *mm, pte_t a)
{
if (pte_val(a) & _PAGE_PRESENT)
return true;
if ((pte_val(a) & _PAGE_PROTNONE) &&
atomic_read(&mm->tlb_flush_pending))
return true;
return false;
}
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{
if (pte_val(pte) & _PAGE_DIRTY)
pte_val(pte) |= _PAGE_MODIFIED;
return __pte((pte_val(pte) & _PAGE_CHG_MASK) |
(pgprot_val(newprot) & ~_PAGE_CHG_MASK));
}
extern void __update_tlb(struct vm_area_struct *vma,
unsigned long address, pte_t *ptep);
static inline void update_mmu_cache_range(struct vm_fault *vmf,
struct vm_area_struct *vma, unsigned long address,
pte_t *ptep, unsigned int nr)
{
for (;;) {
__update_tlb(vma, address, ptep);
if (--nr == 0)
break;
Annotation
- Immediate include surface: `linux/compiler.h`, `asm/addrspace.h`, `asm/asm.h`, `asm/page.h`, `asm/pgtable-bits.h`, `asm-generic/pgtable-nopmd.h`, `asm-generic/pgtable-nopud.h`, `asm-generic/pgtable-nop4d.h`.
- Detected declarations: `struct mm_struct`, `struct vm_area_struct`, `function p4d_none`, `function p4d_bad`, `function p4d_present`, `function set_p4d`, `function p4d_clear`, `function pud_none`, `function pud_bad`, `function pud_present`.
- Atlas domain: Architecture Layer / arch/loongarch.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.