arch/x86/kernel/paravirt.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/paravirt.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/paravirt.c- Extension
.c- Size
- 5720 bytes
- Lines
- 220
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/init.hlinux/export.hlinux/efi.hlinux/bcd.hlinux/highmem.hlinux/kprobes.hlinux/pgtable.hlinux/static_call.hasm/bug.hasm/paravirt.hasm/debugreg.hasm/desc.hasm/setup.hasm/time.hasm/pgalloc.hasm/irq.hasm/cpuid/api.hasm/delay.hasm/fixmap.hasm/apic.hasm/tlbflush.hasm/timer.hasm/special_insns.hasm/tlb.hasm/io_bitmap.hasm/gsseg.hasm/msr.h
Detected Declarations
function default_bannerfunction pv_native_safe_haltfunction pv_native_write_cr2function pv_native_read_cr3function pv_native_write_cr3function pv_native_get_debugregfunction pv_native_set_debugregexport pv_opsexport pv_info
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/* Paravirtualization interfaces
Copyright (C) 2006 Rusty Russell IBM Corporation
2007 - x86_64 support added by Glauber de Oliveira Costa, Red Hat Inc
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/export.h>
#include <linux/efi.h>
#include <linux/bcd.h>
#include <linux/highmem.h>
#include <linux/kprobes.h>
#include <linux/pgtable.h>
#include <linux/static_call.h>
#include <asm/bug.h>
#include <asm/paravirt.h>
#include <asm/debugreg.h>
#include <asm/desc.h>
#include <asm/setup.h>
#include <asm/time.h>
#include <asm/pgalloc.h>
#include <asm/irq.h>
#include <asm/cpuid/api.h>
#include <asm/delay.h>
#include <asm/fixmap.h>
#include <asm/apic.h>
#include <asm/tlbflush.h>
#include <asm/timer.h>
#include <asm/special_insns.h>
#include <asm/tlb.h>
#include <asm/io_bitmap.h>
#include <asm/gsseg.h>
#include <asm/msr.h>
/* stub always returning 0. */
DEFINE_ASM_FUNC(paravirt_ret0, "xor %eax,%eax", .entry.text);
void __init default_banner(void)
{
printk(KERN_INFO "Booting paravirtualized kernel on %s\n",
pv_info.name);
}
#ifdef CONFIG_PARAVIRT_XXL
unsigned long pv_native_save_fl(void);
void pv_native_irq_disable(void);
void pv_native_irq_enable(void);
unsigned long pv_native_read_cr2(void);
DEFINE_ASM_FUNC(_paravirt_ident_64, "mov %rdi, %rax", .text);
DEFINE_ASM_FUNC(pv_native_save_fl, "pushf; pop %rax", .noinstr.text);
DEFINE_ASM_FUNC(pv_native_irq_disable, "cli", .noinstr.text);
DEFINE_ASM_FUNC(pv_native_irq_enable, "sti", .noinstr.text);
DEFINE_ASM_FUNC(pv_native_read_cr2, "mov %cr2, %rax", .noinstr.text);
#endif
static noinstr void pv_native_safe_halt(void)
{
native_safe_halt();
}
#ifdef CONFIG_PARAVIRT_XXL
static noinstr void pv_native_write_cr2(unsigned long val)
{
native_write_cr2(val);
}
static noinstr unsigned long pv_native_read_cr3(void)
{
return __native_read_cr3();
}
static noinstr void pv_native_write_cr3(unsigned long cr3)
{
native_write_cr3(cr3);
}
static noinstr unsigned long pv_native_get_debugreg(int regno)
{
return native_get_debugreg(regno);
}
static noinstr void pv_native_set_debugreg(int regno, unsigned long val)
{
native_set_debugreg(regno, val);
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/init.h`, `linux/export.h`, `linux/efi.h`, `linux/bcd.h`, `linux/highmem.h`, `linux/kprobes.h`, `linux/pgtable.h`.
- Detected declarations: `function default_banner`, `function pv_native_safe_halt`, `function pv_native_write_cr2`, `function pv_native_read_cr3`, `function pv_native_write_cr3`, `function pv_native_get_debugreg`, `function pv_native_set_debugreg`, `export pv_ops`, `export pv_info`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.