From d262f2dcfcebfebae8d3cf6e6b0422510be9a8a2 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Fri, 31 Dec 2010 17:39:31 +0000 Subject: [PATCH] Make i386_set_ldt work on i386/XEN, step 1/5. Lock the vm page queue mutex around calls to pte_store. As with many other uses of the vm page queue mutex in i386/xen/pmap.c, this is bogus and needs to be replaced at some future date by a spin lock dedicated to protecting the queue of pending xen page mapping hypervisor calls. (But for now, bogus locking is better than a panic.) MFC after: 3 days --- sys/i386/xen/pmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c index e956777b5b01..e91ebaf48751 100644 --- a/sys/i386/xen/pmap.c +++ b/sys/i386/xen/pmap.c @@ -3647,7 +3647,9 @@ pmap_map_readonly(pmap_t pmap, vm_offset_t va, int len) for (i = 0; i < npages; i++) { pt_entry_t *pte; pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); + vm_page_lock_queues(); pte_store(pte, xpmap_mtop(*pte & ~(PG_RW|PG_M))); + vm_page_unlock_queues(); PMAP_MARK_PRIV(xpmap_mtop(*pte)); pmap_pte_release(pte); } @@ -3661,7 +3663,9 @@ pmap_map_readwrite(pmap_t pmap, vm_offset_t va, int len) pt_entry_t *pte; pte = pmap_pte(pmap, (vm_offset_t)(va + i*PAGE_SIZE)); PMAP_MARK_UNPRIV(xpmap_mtop(*pte)); + vm_page_lock_queues(); pte_store(pte, xpmap_mtop(*pte) | (PG_RW|PG_M)); + vm_page_unlock_queues(); pmap_pte_release(pte); } }