diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 3f85b156d828..4505907172c0 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -204,6 +204,7 @@ hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack) uint64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE); uint64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE); int i; + char *kenv; xen_domain_type = XEN_PV_DOMAIN; vm_guest = VM_GUEST_XEN; @@ -252,6 +253,15 @@ hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack) } load_cr3(((uint64_t)&PT4[0]) - KERNBASE); + /* + * Init an empty static kenv using a free page. The contents will be + * filled from the parse_preload_data hook. + */ + kenv = (void *)(physfree + KERNBASE); + physfree += PAGE_SIZE; + bzero(kenv, PAGE_SIZE); + init_static_kenv(kenv, PAGE_SIZE); + /* Set the hooks for early functions that diverge from bare metal */ init_ops = xen_legacy_init_ops; apic_ops = xen_apic_ops;