int arch_livepatch_quiesce(void) { mfn_t text_mfn; unsigned int text_order; if ( vmap_of_xen_text ) return -EINVAL; text_mfn = virt_to_mfn(_start); text_order = get_order_from_bytes(_end - _start); /* * The text section is read-only. So re-map Xen to be able to patch * the code. */ vmap_of_xen_text = __vmap(&text_mfn, 1U << text_order, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT); if ( !vmap_of_xen_text ) { printk(XENLOG_ERR LIVEPATCH "Failed to setup vmap of hypervisor! (order=%u)\n", text_order); return -ENOMEM; } return 0; }
void *vmap(const unsigned long *mfn, unsigned int nr) { return __vmap(mfn, 1, nr, 1, PAGE_HYPERVISOR); }