arch/loongarch/kernel/vdso.c
Source file repositories/reference/linux-study-clean/arch/loongarch/kernel/vdso.c
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/kernel/vdso.c- Extension
.c- Size
- 2886 bytes
- Lines
- 128
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/binfmts.hlinux/elf.hlinux/err.hlinux/init.hlinux/ioport.hlinux/kernel.hlinux/mm.hlinux/random.hlinux/sched.hlinux/slab.hlinux/vdso_datastore.hasm/page.hasm/vdso.hasm/vdso/vdso.hvdso/helpers.hvdso/vsyscall.hvdso/datapage.hgenerated/vdso-offsets.h
Detected Declarations
function vdso_mremapfunction init_vdsofunction vdso_basefunction arch_setup_additional_pagesmodule init init_vdso
Annotated Snippet
subsys_initcall(init_vdso);
static unsigned long vdso_base(void)
{
unsigned long base = STACK_TOP;
if (current->flags & PF_RANDOMIZE) {
base += get_random_u32_below(VDSO_RANDOMIZE_SIZE);
base = PAGE_ALIGN(base);
}
return base;
}
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
{
int ret;
unsigned long size, data_addr, vdso_addr;
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
struct loongarch_vdso_info *info = current->thread.vdso;
if (mmap_write_lock_killable(mm))
return -EINTR;
/*
* Determine total area size. This includes the VDSO data itself
* and the data pages.
*/
size = VVAR_SIZE + info->size;
data_addr = get_unmapped_area(NULL, vdso_base(), size, 0, 0);
if (IS_ERR_VALUE(data_addr)) {
ret = data_addr;
goto out;
}
vma = vdso_install_vvar_mapping(mm, data_addr);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
goto out;
}
vdso_addr = data_addr + VVAR_SIZE;
vma = _install_special_mapping(mm, vdso_addr, info->size,
VM_READ | VM_EXEC |
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
VM_SEALED_SYSMAP,
&info->code_mapping);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
goto out;
}
mm->context.vdso = (void *)vdso_addr;
ret = 0;
out:
mmap_write_unlock(mm);
return ret;
}
Annotation
- Immediate include surface: `linux/binfmts.h`, `linux/elf.h`, `linux/err.h`, `linux/init.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/mm.h`, `linux/random.h`.
- Detected declarations: `function vdso_mremap`, `function init_vdso`, `function vdso_base`, `function arch_setup_additional_pages`, `module init init_vdso`.
- Atlas domain: Architecture Layer / arch/loongarch.
- Implementation status: integration 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.