Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
4d9310e
Documentation
arch
alpha
arm
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
boot
configs
crypto
ia32
include/asm
numachip
uv
visws
xen
events.h
hypercall.h
hypervisor.h
interface.h
interface_32.h
interface_64.h
page.h
pci.h
swiotlb-xen.h
trace_types.h
Kbuild
a.out-core.h
a.out.h
acpi.h
aes.h
agp.h
alternative-asm.h
alternative.h
amd_nb.h
apb_timer.h
apic.h
apic_flat_64.h
apicdef.h
apm.h
arch_hweight.h
archrandom.h
asm-offsets.h
asm.h
atomic.h
atomic64_32.h
atomic64_64.h
auxvec.h
barrier.h
bios_ebda.h
bitops.h
bitsperlong.h
boot.h
bootparam.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
calgary.h
calling.h
ce4100.h
checksum.h
checksum_32.h
checksum_64.h
clocksource.h
cmpxchg.h
cmpxchg_32.h
cmpxchg_64.h
compat.h
cpu.h
cpu_device_id.h
cpufeature.h
cpumask.h
cputime.h
current.h
debugreg.h
delay.h
desc.h
desc_defs.h
device.h
div64.h
dma-contiguous.h
dma-mapping.h
dma.h
dmi.h
dwarf2.h
e820.h
edac.h
efi.h
elf.h
emergency-restart.h
entry_arch.h
errno.h
exec.h
fb.h
fcntl.h
fixmap.h
floppy.h
fpu-internal.h
frame.h
ftrace.h
futex.h
gart.h
genapic.h
geode.h
gpio.h
hardirq.h
highmem.h
hpet.h
hugetlb.h
hw_breakpoint.h
hw_irq.h
hypertransport.h
hyperv.h
hypervisor.h
i387.h
i8259.h
ia32.h
ia32_unistd.h
idle.h
inat.h
inat_types.h
init.h
insn.h
inst.h
intel_scu_ipc.h
io.h
io_apic.h
ioctl.h
ioctls.h
iomap.h
iommu.h
iommu_table.h
ipcbuf.h
ipi.h
irq.h
irq_regs.h
irq_remapping.h
irq_vectors.h
irqflags.h
ist.h
jump_label.h
kbdleds.h
kdebug.h
kexec.h
kgdb.h
kmap_types.h
kmemcheck.h
kprobes.h
kvm.h
kvm_emulate.h
kvm_host.h
kvm_para.h
ldt.h
lguest.h
lguest_hcall.h
linkage.h
local.h
local64.h
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h
mce.h
microcode.h
mman.h
mmconfig.h
mmu.h
mmu_context.h
mmx.h
mmzone.h
mmzone_32.h
mmzone_64.h
module.h
mpspec.h
mpspec_def.h
mrst-vrtc.h
mrst.h
msgbuf.h
mshyperv.h
msidef.h
msr-index.h
msr.h
mtrr.h
mutex.h
mutex_32.h
mutex_64.h
mwait.h
nmi.h
nops.h
numa.h
numa_32.h
numa_64.h
numaq.h
olpc.h
olpc_ofw.h
page.h
page_32.h
page_32_types.h
page_64.h
page_64_types.h
page_types.h
param.h
paravirt.h
paravirt_types.h
parport.h
pat.h
pci-direct.h
pci-functions.h
pci.h
pci_64.h
pci_x86.h
percpu.h
perf_event.h
perf_event_p4.h
pgalloc.h
pgtable-2level.h
pgtable-2level_types.h
pgtable-3level.h
pgtable-3level_types.h
pgtable.h
pgtable_32.h
pgtable_32_types.h
pgtable_64.h
pgtable_64_types.h
pgtable_types.h
poll.h
posix_types.h
posix_types_32.h
posix_types_64.h
posix_types_x32.h
prctl.h
probe_roms.h
processor-cyrix.h
processor-flags.h
processor.h
prom.h
proto.h
ptrace-abi.h
ptrace.h
pvclock-abi.h
pvclock.h
realmode.h
reboot.h
reboot_fixups.h
required-features.h
resource.h
resume-trace.h
rio.h
rtc.h
rwlock.h
rwsem.h
scatterlist.h
seccomp.h
seccomp_32.h
seccomp_64.h
sections.h
segment.h
sembuf.h
serial.h
serpent.h
setup.h
setup_arch.h
shmbuf.h
shmparam.h
sigcontext.h
sigcontext32.h
sigframe.h
sighandling.h
siginfo.h
signal.h
smp.h
smpboot_hooks.h
socket.h
sockios.h
sparsemem.h
special_insns.h
spinlock.h
spinlock_types.h
sta2x11.h
stackprotector.h
stacktrace.h
stat.h
statfs.h
string.h
string_32.h
string_64.h
suspend.h
suspend_32.h
suspend_64.h
svm.h
swab.h
swiotlb.h
switch_to.h
sync_bitops.h
sys_ia32.h
syscall.h
syscalls.h
tce.h
termbits.h
termios.h
thread_info.h
time.h
timer.h
timex.h
tlb.h
tlbflush.h
topology.h
traps.h
tsc.h
types.h
uaccess.h
uaccess_32.h
uaccess_64.h
ucontext.h
unaligned.h
unistd.h
uprobes.h
user.h
user32.h
user_32.h
user_64.h
vdso.h
vga.h
vgtod.h
virtext.h
vm86.h
vmx.h
vsyscall.h
vvar.h
word-at-a-time.h
x2apic.h
x86_init.h
xcr.h
xor.h
xor_32.h
xor_64.h
xor_avx.h
xsave.h
kernel
kvm
lguest
lib
math-emu
mm
net
oprofile
pci
platform
power
realmode
syscalls
tools
um
vdso
video
xen
.gitignore
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile.um
Makefile_32.cpu
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
x86
/
include
/
asm
/
xen
/
interface.h
Copy path
Blame
Blame
Latest commit
History
History
179 lines (162 loc) · 6.05 KB
Breadcrumbs
linux
/
arch
/
x86
/
include
/
asm
/
xen
/
interface.h
Top
File metadata and controls
Code
Blame
179 lines (162 loc) · 6.05 KB
Raw
/****************************************************************************** * arch-x86_32.h * * Guest OS interface to x86 Xen. * * Copyright (c) 2004, K A Fraser */ #ifndef _ASM_X86_XEN_INTERFACE_H #define _ASM_X86_XEN_INTERFACE_H #ifdef __XEN__ #define __DEFINE_GUEST_HANDLE(name, type) \ typedef struct { type *p; } __guest_handle_ ## name #else #define __DEFINE_GUEST_HANDLE(name, type) \ typedef type * __guest_handle_ ## name #endif #define DEFINE_GUEST_HANDLE_STRUCT(name) \ __DEFINE_GUEST_HANDLE(name, struct name) #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) #define GUEST_HANDLE(name) __guest_handle_ ## name #ifdef __XEN__ #if defined(__i386__) #define set_xen_guest_handle(hnd, val) \ do { \ if (sizeof(hnd) == 8) \ *(uint64_t *)&(hnd) = 0; \ (hnd).p = val; \ } while (0) #elif defined(__x86_64__) #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) #endif #else #if defined(__i386__) #define set_xen_guest_handle(hnd, val) \ do { \ if (sizeof(hnd) == 8) \ *(uint64_t *)&(hnd) = 0; \ (hnd) = val; \ } while (0) #elif defined(__x86_64__) #define set_xen_guest_handle(hnd, val) do { (hnd) = val; } while (0) #endif #endif #ifndef __ASSEMBLY__ /* Guest handles for primitive C types. */ __DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uint, unsigned int); __DEFINE_GUEST_HANDLE(ulong, unsigned long); DEFINE_GUEST_HANDLE(char); DEFINE_GUEST_HANDLE(int); DEFINE_GUEST_HANDLE(long); DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint32_t); #endif #ifndef HYPERVISOR_VIRT_START #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) #endif #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>__MACH2PHYS_SHIFT) /* Maximum number of virtual CPUs in multi-processor guests. */ #define MAX_VIRT_CPUS 32 /* * SEGMENT DESCRIPTOR TABLES */ /* * A number of GDT entries are reserved by Xen. These are not situated at the * start of the GDT because some stupid OSes export hard-coded selector values * in their ABI. These hard-coded values are always near the start of the GDT, * so Xen places itself out of the way, at the far end of the GDT. */ #define FIRST_RESERVED_GDT_PAGE 14 #define FIRST_RESERVED_GDT_BYTE (FIRST_RESERVED_GDT_PAGE * 4096) #define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8) /* * Send an array of these to HYPERVISOR_set_trap_table() * The privilege level specifies which modes may enter a trap via a software * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate * privilege levels as follows: * Level == 0: No one may enter * Level == 1: Kernel may enter * Level == 2: Kernel may enter * Level == 3: Everyone may enter */ #define TI_GET_DPL(_ti) ((_ti)->flags & 3) #define TI_GET_IF(_ti) ((_ti)->flags & 4) #define TI_SET_DPL(_ti, _dpl) ((_ti)->flags |= (_dpl)) #define TI_SET_IF(_ti, _if) ((_ti)->flags |= ((!!(_if))<<2)) #ifndef __ASSEMBLY__ struct trap_info { uint8_t vector; /* exception vector */ uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */ uint16_t cs; /* code selector */ unsigned long address; /* code offset */ }; DEFINE_GUEST_HANDLE_STRUCT(trap_info); struct arch_shared_info { unsigned long max_pfn; /* max pfn that appears in table */ /* Frame containing list of mfns containing list of mfns containing p2m. */ unsigned long pfn_to_mfn_frame_list_list; unsigned long nmi_reason; }; #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_X86_32 #include "interface_32.h" #else #include "interface_64.h" #endif #include <asm/pvclock-abi.h> #ifndef __ASSEMBLY__ /* * The following is all CPU context. Note that the fpu_ctxt block is filled * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used. */ struct vcpu_guest_context { /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */ struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */ #define VGCF_I387_VALID (1<<0) #define VGCF_HVM_GUEST (1<<1) #define VGCF_IN_KERNEL (1<<2) unsigned long flags; /* VGCF_* flags */ struct cpu_user_regs user_regs; /* User-level CPU registers */ struct trap_info trap_ctxt[256]; /* Virtual IDT */ unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */ unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */ unsigned long kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1) */ /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */ unsigned long ctrlreg[8]; /* CR0-CR7 (control registers) */ unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */ #ifdef __i386__ unsigned long event_callback_cs; /* CS:EIP of event callback */ unsigned long event_callback_eip; unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */ unsigned long failsafe_callback_eip; #else unsigned long event_callback_eip; unsigned long failsafe_callback_eip; unsigned long syscall_callback_eip; #endif unsigned long vm_assist; /* VMASST_TYPE_* bitmap */ #ifdef __x86_64__ /* Segment base addresses. */ uint64_t fs_base; uint64_t gs_base_kernel; uint64_t gs_base_user; #endif }; DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context); #endif /* !__ASSEMBLY__ */ /* * Prefix forces emulation of some non-trapping instructions. * Currently only CPUID. */ #ifdef __ASSEMBLY__ #define XEN_EMULATE_PREFIX .byte 0x0f,0x0b,0x78,0x65,0x6e ; #define XEN_CPUID XEN_EMULATE_PREFIX cpuid #else #define XEN_EMULATE_PREFIX ".byte 0x0f,0x0b,0x78,0x65,0x6e ; " #define XEN_CPUID XEN_EMULATE_PREFIX "cpuid" #endif #endif /* _ASM_X86_XEN_INTERFACE_H */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
You can’t perform that action at this time.