arch/powerpc/kernel/vdso.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/vdso.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/vdso.c- Extension
.c- Size
- 7777 bytes
- Lines
- 282
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/sched.hlinux/kernel.hlinux/mm.hlinux/smp.hlinux/stddef.hlinux/unistd.hlinux/slab.hlinux/user.hlinux/elf.hlinux/security.hlinux/syscalls.hlinux/vdso_datastore.hvdso/datapage.hasm/syscall.hasm/syscalls.hasm/processor.hasm/mmu.hasm/mmu_context.hasm/machdep.hasm/cputable.hasm/sections.hasm/firmware.hasm/vdso.hasm/vdso_datapage.hasm/setup.h
Detected Declarations
function vdso_mremapfunction vdso32_mremapfunction vdso64_mremapfunction vdso_closefunction __arch_setup_additional_pagesfunction arch_setup_additional_pagesfunction vdso_fixup_featuresfunction vdso_setup_syscall_mapfunction vdso_getcpu_initfunction vdso_setup_pagesfunction vdso_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
* <benh@kernel.crashing.org>
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/elf.h>
#include <linux/security.h>
#include <linux/syscalls.h>
#include <linux/vdso_datastore.h>
#include <vdso/datapage.h>
#include <asm/syscall.h>
#include <asm/syscalls.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/mmu_context.h>
#include <asm/machdep.h>
#include <asm/cputable.h>
#include <asm/sections.h>
#include <asm/firmware.h>
#include <asm/vdso.h>
#include <asm/vdso_datapage.h>
#include <asm/setup.h>
static_assert(__VDSO_PAGES == VDSO_NR_PAGES);
/* The alignment of the vDSO */
#define VDSO_ALIGNMENT (1 << 16)
extern char vdso32_start, vdso32_end;
extern char vdso64_start, vdso64_end;
static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma,
unsigned long text_size)
{
unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
if (new_size != text_size)
return -EINVAL;
current->mm->context.vdso = (void __user *)new_vma->vm_start;
return 0;
}
static int vdso32_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma)
{
return vdso_mremap(sm, new_vma, &vdso32_end - &vdso32_start);
}
static int vdso64_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma)
{
return vdso_mremap(sm, new_vma, &vdso64_end - &vdso64_start);
}
static void vdso_close(const struct vm_special_mapping *sm, struct vm_area_struct *vma)
{
struct mm_struct *mm = vma->vm_mm;
/*
* close() is called for munmap() but also for mremap(). In the mremap()
* case the vdso pointer has already been updated by the mremap() hook
* above, so it must not be set to NULL here.
*/
if (vma->vm_start != (unsigned long)mm->context.vdso)
return;
mm->context.vdso = NULL;
}
static struct vm_special_mapping vdso32_spec __ro_after_init = {
.name = "[vdso]",
.mremap = vdso32_mremap,
.close = vdso_close,
};
static struct vm_special_mapping vdso64_spec __ro_after_init = {
.name = "[vdso]",
.mremap = vdso64_mremap,
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/kernel.h`, `linux/mm.h`, `linux/smp.h`, `linux/stddef.h`, `linux/unistd.h`, `linux/slab.h`.
- Detected declarations: `function vdso_mremap`, `function vdso32_mremap`, `function vdso64_mremap`, `function vdso_close`, `function __arch_setup_additional_pages`, `function arch_setup_additional_pages`, `function vdso_fixup_features`, `function vdso_setup_syscall_map`, `function vdso_getcpu_init`, `function vdso_setup_pages`.
- 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.