kernel - Major MPSAFE Infrastructure
[dragonfly.git] / sys / dev / agp / agp.c
index d7e70d2..1f284c7 100644 (file)
@@ -569,11 +569,13 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
                                vm_page_wakeup(m);
                                for (k = 0; k < i + j; k += AGP_PAGE_SIZE)
                                        AGP_UNBIND_PAGE(dev, offset + k);
+                               lwkt_gettoken(&vm_token);
                                for (k = 0; k <= i; k += PAGE_SIZE) {
                                        m = vm_page_lookup(mem->am_obj,
                                                           OFF_TO_IDX(k));
                                        vm_page_unwire(m, 0);
                                }
+                               lwkt_reltoken(&vm_token);
                                lockmgr(&sc->as_lock, LK_RELEASE);
                                return error;
                        }
@@ -622,10 +624,12 @@ agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
         */
        for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE)
                AGP_UNBIND_PAGE(dev, mem->am_offset + i);
+       lwkt_gettoken(&vm_token);
        for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
                m = vm_page_lookup(mem->am_obj, atop(i));
                vm_page_unwire(m, 0);
        }
+       lwkt_reltoken(&vm_token);
                
        agp_flush_cache();
        AGP_FLUSH_TLB(dev);