void arch_init(start_info_t *si) { /* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ memcpy(&start_info, si, sizeof(*si)); /* set up minimal memory infos */ phys_to_machine_mapping = (unsigned long *)start_info.mfn_list; /* Grab the shared_info pointer and put it in a safe place. */ HYPERVISOR_shared_info = map_shared_info(start_info.shared_info); /* Set up event and failsafe callback addresses. */ #ifdef __i386__ HYPERVISOR_set_callbacks( __KERNEL_CS, (unsigned long)hypervisor_callback, __KERNEL_CS, (unsigned long)failsafe_callback); #else HYPERVISOR_set_callbacks( (unsigned long)hypervisor_callback, (unsigned long)failsafe_callback, 0); #endif }
CAMLprim value stub_hypervisor_suspend(value unit) { CAMLparam0(); int cancelled; printk("WARNING: stub_hypervisor_suspend not yet implemented\n"); cancelled = 1; #if 0 /* Turn the store and console mfns to pfns - required because xc_domain_restore uses these values */ start_info.store_mfn = mfn_to_pfn(start_info.store_mfn); start_info.console.domU.mfn = mfn_to_pfn(start_info.console.domU.mfn); /* canonicalize_pagetables can't cope with pagetable entries that are outside of the guest's mfns, so we must unmap anything outside of our space */ unmap_shared_info(); /* Actually do the suspend. When this function returns 0, we've been resumed */ cancelled = HYPERVISOR_suspend(virt_to_mfn(&start_info)); if(cancelled) { start_info.store_mfn = pfn_to_mfn(start_info.store_mfn); start_info.console.domU.mfn = pfn_to_mfn(start_info.console.domU.mfn); } /* Reinitialise several things */ trap_init(); init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); HYPERVISOR_shared_info = map_shared_info(start_info.shared_info); /* Set up event and failsafe callback addresses. */ HYPERVISOR_set_callbacks( (unsigned long)hypervisor_callback, (unsigned long)failsafe_callback, 0); init_time(); arch_rebuild_p2m(); unmask_evtchn(start_info.console.domU.evtchn); unmask_evtchn(start_info.store_evtchn); #endif CAMLreturn(Val_int(cancelled)); }