xen.h
来自「linux 内核源代码」· C头文件 代码 · 共 448 行 · 第 1/2 页
H
448 行
/****************************************************************************** * xen.h * * Guest OS interface to Xen. * * Copyright (c) 2004, K A Fraser */#ifndef __XEN_PUBLIC_XEN_H__#define __XEN_PUBLIC_XEN_H__#include <asm/xen/interface.h>/* * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). *//* * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. * EAX = return value * (argument registers may be clobbered on return) * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6. * RAX = return value * (argument registers not clobbered on return; RCX, R11 are) */#define __HYPERVISOR_set_trap_table 0#define __HYPERVISOR_mmu_update 1#define __HYPERVISOR_set_gdt 2#define __HYPERVISOR_stack_switch 3#define __HYPERVISOR_set_callbacks 4#define __HYPERVISOR_fpu_taskswitch 5#define __HYPERVISOR_sched_op 6#define __HYPERVISOR_dom0_op 7#define __HYPERVISOR_set_debugreg 8#define __HYPERVISOR_get_debugreg 9#define __HYPERVISOR_update_descriptor 10#define __HYPERVISOR_memory_op 12#define __HYPERVISOR_multicall 13#define __HYPERVISOR_update_va_mapping 14#define __HYPERVISOR_set_timer_op 15#define __HYPERVISOR_event_channel_op_compat 16#define __HYPERVISOR_xen_version 17#define __HYPERVISOR_console_io 18#define __HYPERVISOR_physdev_op_compat 19#define __HYPERVISOR_grant_table_op 20#define __HYPERVISOR_vm_assist 21#define __HYPERVISOR_update_va_mapping_otherdomain 22#define __HYPERVISOR_iret 23 /* x86 only */#define __HYPERVISOR_vcpu_op 24#define __HYPERVISOR_set_segment_base 25 /* x86/64 only */#define __HYPERVISOR_mmuext_op 26#define __HYPERVISOR_acm_op 27#define __HYPERVISOR_nmi_op 28#define __HYPERVISOR_sched_op_new 29#define __HYPERVISOR_callback_op 30#define __HYPERVISOR_xenoprof_op 31#define __HYPERVISOR_event_channel_op 32#define __HYPERVISOR_physdev_op 33#define __HYPERVISOR_hvm_op 34/* * VIRTUAL INTERRUPTS * * Virtual interrupts that a guest OS may receive from Xen. */#define VIRQ_TIMER 0 /* Timebase update, and/or requested timeout. */#define VIRQ_DEBUG 1 /* Request guest to dump debug info. */#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */#define NR_VIRQS 8/* * MMU-UPDATE REQUESTS * * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs. * A foreigndom (FD) can be specified (or DOMID_SELF for none). * Where the FD has some effect, it is described below. * ptr[1:0] specifies the appropriate MMU_* command. * * ptr[1:0] == MMU_NORMAL_PT_UPDATE: * Updates an entry in a page table. If updating an L1 table, and the new * table entry is valid/present, the mapped frame must belong to the FD, if * an FD has been specified. If attempting to map an I/O page then the * caller assumes the privilege of the FD. * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller. * FD == DOMID_XEN: Map restricted areas of Xen's heap space. * ptr[:2] -- Machine address of the page-table entry to modify. * val -- Value to write. * * ptr[1:0] == MMU_MACHPHYS_UPDATE: * Updates an entry in the machine->pseudo-physical mapping table. * ptr[:2] -- Machine address within the frame whose mapping to modify. * The frame must belong to the FD, if one is specified. * val -- Value to write into the mapping entry. */#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for *//* * MMU EXTENDED OPERATIONS * * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures. * A foreigndom (FD) can be specified (or DOMID_SELF for none). * Where the FD has some effect, it is described below. * * cmd: MMUEXT_(UN)PIN_*_TABLE * mfn: Machine frame number to be (un)pinned as a p.t. page. * The frame must belong to the FD, if one is specified. * * cmd: MMUEXT_NEW_BASEPTR * mfn: Machine frame number of new page-table base to install in MMU. * * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only] * mfn: Machine frame number of new page-table base to install in MMU * when in user space. * * cmd: MMUEXT_TLB_FLUSH_LOCAL * No additional arguments. Flushes local TLB. * * cmd: MMUEXT_INVLPG_LOCAL * linear_addr: Linear address to be flushed from the local TLB. * * cmd: MMUEXT_TLB_FLUSH_MULTI * vcpumask: Pointer to bitmap of VCPUs to be flushed. * * cmd: MMUEXT_INVLPG_MULTI * linear_addr: Linear address to be flushed. * vcpumask: Pointer to bitmap of VCPUs to be flushed. * * cmd: MMUEXT_TLB_FLUSH_ALL * No additional arguments. Flushes all VCPUs' TLBs. * * cmd: MMUEXT_INVLPG_ALL * linear_addr: Linear address to be flushed from all VCPUs' TLBs. * * cmd: MMUEXT_FLUSH_CACHE * No additional arguments. Writes back and flushes cache contents. * * cmd: MMUEXT_SET_LDT * linear_addr: Linear address of LDT base (NB. must be page-aligned). * nr_ents: Number of entries in LDT. */#define MMUEXT_PIN_L1_TABLE 0#define MMUEXT_PIN_L2_TABLE 1#define MMUEXT_PIN_L3_TABLE 2#define MMUEXT_PIN_L4_TABLE 3#define MMUEXT_UNPIN_TABLE 4#define MMUEXT_NEW_BASEPTR 5#define MMUEXT_TLB_FLUSH_LOCAL 6#define MMUEXT_INVLPG_LOCAL 7#define MMUEXT_TLB_FLUSH_MULTI 8#define MMUEXT_INVLPG_MULTI 9#define MMUEXT_TLB_FLUSH_ALL 10#define MMUEXT_INVLPG_ALL 11#define MMUEXT_FLUSH_CACHE 12#define MMUEXT_SET_LDT 13#define MMUEXT_NEW_USER_BASEPTR 15#ifndef __ASSEMBLY__struct mmuext_op { unsigned int cmd; union { /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ unsigned long mfn; /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ unsigned long linear_addr; } arg1; union { /* SET_LDT */ unsigned int nr_ents; /* TLB_FLUSH_MULTI, INVLPG_MULTI */ void *vcpumask; } arg2;};DEFINE_GUEST_HANDLE_STRUCT(mmuext_op);#endif/* These are passed as 'flags' to update_va_mapping. They can be ORed. *//* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. *//* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */#define UVMF_NONE (0UL<<0) /* No flushing at all. */#define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */#define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */#define UVMF_FLUSHTYPE_MASK (3UL<<0)#define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */#define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */#define UVMF_ALL (1UL<<2) /* Flush all TLBs. *//* * Commands to HYPERVISOR_console_io(). */#define CONSOLEIO_write 0#define CONSOLEIO_read 1/* * Commands to HYPERVISOR_vm_assist(). */#define VMASST_CMD_enable 0#define VMASST_CMD_disable 1#define VMASST_TYPE_4gb_segments 0#define VMASST_TYPE_4gb_segments_notify 1#define VMASST_TYPE_writable_pagetables 2#define VMASST_TYPE_pae_extended_cr3 3#define MAX_VMASST_TYPE 3#ifndef __ASSEMBLY__typedef uint16_t domid_t;/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */#define DOMID_FIRST_RESERVED (0x7FF0U)/* DOMID_SELF is used in certain contexts to refer to oneself. */#define DOMID_SELF (0x7FF0U)/* * DOMID_IO is used to restrict page-table updates to mapping I/O memory. * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO * is useful to ensure that no mappings to the OS's own heap are accidentally * installed. (e.g., in Linux this could cause havoc as reference counts * aren't adjusted on the I/O-mapping code path). * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can * be specified by any calling domain.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?