struct proc *p;
xs.initialized = false;
+
if (xen_hvm_domain()) {
xs.evtchn = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN);
xs.gpfn = hvm_get_parameter(HVM_PARAM_STORE_PFN);
- xen_store = xen_pmap(xs.gpfn * PAGE_SIZE, PAGE_SIZE);
- xs.initialized = true;
+ if (xs.evtchn != 0)
+ xen_store = xen_pmap(xs.gpfn * PAGE_SIZE, PAGE_SIZE);
} else if (xen_pv_domain()) {
- if (HYPERVISOR_start_info->store_evtchn == 0) {
- struct evtchn_alloc_unbound alloc_unbound;
-
- /* Allocate a local event channel for xenstore */
- alloc_unbound.dom = DOMID_SELF;
- alloc_unbound.remote_dom = DOMID_SELF;
- error = HYPERVISOR_event_channel_op(
- EVTCHNOP_alloc_unbound, &alloc_unbound);
- if (error != 0)
- panic(
- "unable to alloc event channel for Dom0: %d",
- error);
-
- HYPERVISOR_start_info->store_evtchn =
- alloc_unbound.port;
- xs.evtchn = alloc_unbound.port;
-
- /* Allocate memory for the xs shared ring */
- xen_store = malloc(PAGE_SIZE, M_XENSTORE,
- M_WAITOK | M_ZERO);
- } else {
- xs.evtchn = HYPERVISOR_start_info->store_evtchn;
- xs.initialized = true;
- }
+ xs.evtchn = HYPERVISOR_start_info->store_evtchn;
} else {
panic("Unknown domain type, cannot initialize xenstore.");
}
+ if (xs.evtchn == 0) {
+ struct evtchn_alloc_unbound alloc_unbound;
+
+ /* Allocate a local event channel for xenstore */
+ alloc_unbound.dom = DOMID_SELF;
+ alloc_unbound.remote_dom = DOMID_SELF;
+ error = HYPERVISOR_event_channel_op(
+ EVTCHNOP_alloc_unbound, &alloc_unbound);
+ if (error != 0)
+ panic(
+ "unable to alloc event channel for Dom0: %d",
+ error);
+
+ HYPERVISOR_start_info->store_evtchn =
+ alloc_unbound.port;
+ xs.evtchn = alloc_unbound.port;
+
+ /* Allocate memory for the xs shared ring */
+ xen_store = malloc(PAGE_SIZE, M_XENSTORE,
+ M_WAITOK | M_ZERO);
+ }
+ else
+ xs.initialized = true;
+
TAILQ_INIT(&xs.reply_list);
TAILQ_INIT(&xs.watch_events);