MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xen_hvm_init_hypercall_stubs

Function xen_hvm_init_hypercall_stubs

freebsd/x86/xen/hvm.c:168–204  ·  view source on GitHub ↗

* Allocate and fill in the hypcall page. */

Source from the content-addressed store, hash-verified

166 * Allocate and fill in the hypcall page.
167 */
168int
169xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
170{
171 uint32_t regs[4];
172
173 /* Legacy PVH will get here without the cpuid leaf being set. */
174 if (cpuid_base == 0)
175 cpuid_base = xen_hvm_cpuid_base();
176 if (cpuid_base == 0)
177 return (ENXIO);
178
179 if (xen_domain() && init_type == XEN_HVM_INIT_LATE) {
180 /*
181 * If the domain type is already set we can assume that the
182 * hypercall page has been populated too, so just print the
183 * version (and apply any quirks) and exit.
184 */
185 hypervisor_version();
186 return 0;
187 }
188
189 if (init_type == XEN_HVM_INIT_LATE)
190 hypervisor_version();
191
192 /*
193 * Find the hypercall pages.
194 */
195 do_cpuid(cpuid_base + 2, regs);
196 if (regs[0] != 1)
197 return (EINVAL);
198
199 wrmsr(regs[1], (init_type == XEN_HVM_INIT_EARLY)
200 ? ((vm_paddr_t)&hypercall_page - KERNBASE)
201 : vtophys(&hypercall_page));
202
203 return (0);
204}
205
206static void
207xen_hvm_init_shared_info_page(void)

Callers 2

xen_hvm_initFunction · 0.85
hammer_time_xenFunction · 0.85

Calls 4

xen_hvm_cpuid_baseFunction · 0.85
hypervisor_versionFunction · 0.85
do_cpuidFunction · 0.50
wrmsrFunction · 0.50

Tested by

no test coverage detected