arch/x86/include/asm/xen/hypercall.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/xen/hypercall.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/xen/hypercall.h- Extension
.h- Size
- 14325 bytes
- Lines
- 512
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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/kernel.hlinux/spinlock.hlinux/errno.hlinux/string.hlinux/types.hlinux/pgtable.hlinux/instrumentation.htrace/events/xen.hasm/alternative.hasm/page.hasm/smap.hasm/nospec-branch.hxen/interface/xen.hxen/interface/sched.hxen/interface/physdev.hxen/interface/platform.hxen/interface/xen-mca.h
Detected Declarations
struct xen_dm_op_buffunction xen_single_callfunction __xen_stacfunction __xen_clacfunction privcmd_callfunction HYPERVISOR_set_trap_tablefunction HYPERVISOR_mmu_updatefunction HYPERVISOR_mmuext_opfunction HYPERVISOR_set_gdtfunction HYPERVISOR_callback_opfunction HYPERVISOR_set_debugregfunction HYPERVISOR_get_debugregfunction HYPERVISOR_update_descriptorfunction HYPERVISOR_update_va_mappingfunction HYPERVISOR_set_segment_basefunction MULTI_fpu_taskswitchfunction MULTI_update_va_mappingfunction MULTI_update_descriptorfunction MULTI_mmu_updatefunction MULTI_mmuext_opfunction MULTI_stack_switchfunction HYPERVISOR_sched_opfunction HYPERVISOR_set_timer_opfunction HYPERVISOR_mcafunction HYPERVISOR_platform_opfunction HYPERVISOR_memory_opfunction HYPERVISOR_multicallfunction HYPERVISOR_event_channel_opfunction HYPERVISOR_xen_versionfunction HYPERVISOR_console_iofunction HYPERVISOR_physdev_opfunction HYPERVISOR_grant_table_opfunction HYPERVISOR_vm_assistfunction HYPERVISOR_vcpu_opfunction HYPERVISOR_suspendfunction HYPERVISOR_hvm_opfunction HYPERVISOR_xenpmu_opfunction HYPERVISOR_dm_op
Annotated Snippet
#ifndef _ASM_X86_XEN_HYPERCALL_H
#define _ASM_X86_XEN_HYPERCALL_H
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/pgtable.h>
#include <linux/instrumentation.h>
#include <trace/events/xen.h>
#include <asm/alternative.h>
#include <asm/page.h>
#include <asm/smap.h>
#include <asm/nospec-branch.h>
#include <xen/interface/xen.h>
#include <xen/interface/sched.h>
#include <xen/interface/physdev.h>
#include <xen/interface/platform.h>
#include <xen/interface/xen-mca.h>
struct xen_dm_op_buf;
/*
* The hypercall asms have to meet several constraints:
* - Work on 32- and 64-bit.
* The two architectures put their arguments in different sets of
* registers.
*
* - Work around asm syntax quirks
* It isn't possible to specify one of the rNN registers in a
* constraint, so we use explicit register variables to get the
* args into the right place.
*
* - Mark all registers as potentially clobbered
* Even unused parameters can be clobbered by the hypervisor, so we
* need to make sure gcc knows it.
*
* - Avoid compiler bugs.
* This is the tricky part. Because x86_32 has such a constrained
* register set, gcc versions below 4.3 have trouble generating
* code when all the arg registers and memory are trashed by the
* asm. There are syntactically simpler ways of achieving the
* semantics below, but they cause the compiler to crash.
*
* The only combination I found which works is:
* - assign the __argX variables first
* - list all actually used parameters as "+r" (__argX)
* - clobber the rest
*
* The result certainly isn't pretty, and it really shows up cpp's
* weakness as a macro language. Sorry. (But let's just give thanks
* there aren't more than 5 arguments...)
*/
void xen_hypercall_func(void);
DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func);
#ifdef MODULE
#define __ADDRESSABLE_xen_hypercall
#else
#define __ADDRESSABLE_xen_hypercall \
__stringify(.global STATIC_CALL_KEY(xen_hypercall);)
#endif
#define __HYPERCALL \
__ADDRESSABLE_xen_hypercall \
__stringify(call STATIC_CALL_TRAMP(xen_hypercall))
#define __HYPERCALL_ENTRY(x) "a" (x)
#ifdef CONFIG_X86_32
#define __HYPERCALL_RETREG "eax"
#define __HYPERCALL_ARG1REG "ebx"
#define __HYPERCALL_ARG2REG "ecx"
#define __HYPERCALL_ARG3REG "edx"
#define __HYPERCALL_ARG4REG "esi"
#define __HYPERCALL_ARG5REG "edi"
#else
#define __HYPERCALL_RETREG "rax"
#define __HYPERCALL_ARG1REG "rdi"
#define __HYPERCALL_ARG2REG "rsi"
#define __HYPERCALL_ARG3REG "rdx"
#define __HYPERCALL_ARG4REG "r10"
#define __HYPERCALL_ARG5REG "r8"
#endif
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/spinlock.h`, `linux/errno.h`, `linux/string.h`, `linux/types.h`, `linux/pgtable.h`, `linux/instrumentation.h`, `trace/events/xen.h`.
- Detected declarations: `struct xen_dm_op_buf`, `function xen_single_call`, `function __xen_stac`, `function __xen_clac`, `function privcmd_call`, `function HYPERVISOR_set_trap_table`, `function HYPERVISOR_mmu_update`, `function HYPERVISOR_mmuext_op`, `function HYPERVISOR_set_gdt`, `function HYPERVISOR_callback_op`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.