arch/nios2/mm/pgtable.c
Source file repositories/reference/linux-study-clean/arch/nios2/mm/pgtable.c
File Facts
- System
- Linux kernel
- Corpus path
arch/nios2/mm/pgtable.c- Extension
.c- Size
- 1733 bytes
- Lines
- 75
- Domain
- Architecture Layer
- Bucket
- arch/nios2
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mm.hlinux/sched.hasm/cpuinfo.hasm/pgalloc.h
Detected Declarations
function Copyrightfunction pagetable_init
Annotated Snippet
#include <linux/mm.h>
#include <linux/sched.h>
#include <asm/cpuinfo.h>
#include <asm/pgalloc.h>
/* pteaddr:
* ptbase | vpn* | zero
* 31-22 | 21-2 | 1-0
*
* *vpn is preserved on double fault
*
* tlbacc:
* IG |*flags| pfn
* 31-25|24-20 | 19-0
*
* *crwxg
*
* tlbmisc:
* resv |way |rd | we|pid |dbl|bad|perm|d
* 31-24 |23-20 |19 | 20|17-4|3 |2 |1 |0
*
*/
/*
* Initialize a new pgd / pmd table with invalid pointers.
*/
static void pgd_init(pgd_t *pgd)
{
unsigned long *p = (unsigned long *) pgd;
int i;
for (i = 0; i < USER_PTRS_PER_PGD; i += 8) {
p[i + 0] = (unsigned long) invalid_pte_table;
p[i + 1] = (unsigned long) invalid_pte_table;
p[i + 2] = (unsigned long) invalid_pte_table;
p[i + 3] = (unsigned long) invalid_pte_table;
p[i + 4] = (unsigned long) invalid_pte_table;
p[i + 5] = (unsigned long) invalid_pte_table;
p[i + 6] = (unsigned long) invalid_pte_table;
p[i + 7] = (unsigned long) invalid_pte_table;
}
}
pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *ret, *init;
ret = __pgd_alloc(mm, 0);
if (ret) {
init = pgd_offset(&init_mm, 0UL);
pgd_init(ret);
memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
}
return ret;
}
void __init pagetable_init(void)
{
/* Initialize the entire pgd. */
pgd_init(swapper_pg_dir);
pgd_init(swapper_pg_dir + USER_PTRS_PER_PGD);
}
Annotation
- Immediate include surface: `linux/mm.h`, `linux/sched.h`, `asm/cpuinfo.h`, `asm/pgalloc.h`.
- Detected declarations: `function Copyright`, `function pagetable_init`.
- Atlas domain: Architecture Layer / arch/nios2.
- 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.