Lines Matching refs:shared_region
138 static void vm_shared_region_reference_locked(vm_shared_region_t shared_region);
143 static void vm_shared_region_destroy(vm_shared_region_t shared_region);
152 ("shared_region: -> init\n"));
163 ("shared_region: <- init\n"));
176 vm_shared_region_t shared_region;
179 ("shared_region: -> get(%p)\n",
184 shared_region = task->shared_region;
185 if (shared_region) {
186 assert(shared_region->sr_ref_count > 0);
187 vm_shared_region_reference_locked(shared_region);
193 ("shared_region: get(%p) <- %p\n",
194 task, shared_region));
196 return shared_region;
209 vm_shared_region_t shared_region)
212 ("shared_region: -> base_address(%p)\n",
213 shared_region));
214 assert(shared_region->sr_ref_count > 1);
216 ("shared_region: base_address(%p) <- 0x%llx\n",
217 shared_region, (long long)shared_region->sr_base_address));
218 return shared_region->sr_base_address;
231 vm_shared_region_t shared_region)
234 ("shared_region: -> size(%p)\n",
235 shared_region));
236 assert(shared_region->sr_ref_count > 1);
238 ("shared_region: size(%p) <- 0x%llx\n",
239 shared_region, (long long)shared_region->sr_size));
240 return shared_region->sr_size;
253 vm_shared_region_t shared_region)
256 ("shared_region: -> mem_entry(%p)\n",
257 shared_region));
258 assert(shared_region->sr_ref_count > 1);
260 ("shared_region: mem_entry(%p) <- %p\n",
261 shared_region, shared_region->sr_mem_entry));
262 return shared_region->sr_mem_entry;
280 ("shared_region: -> set(%p, %p)\n",
286 old_shared_region = task->shared_region;
291 task->shared_region = new_shared_region;
302 ("shared_region: set(%p) <- old=%p new=%p\n",
319 vm_shared_region_t shared_region;
323 ("shared_region: -> lookup(root=%p,cpu=%d,64bit=%d)\n",
326 shared_region = NULL;
332 shared_region,
335 assert(shared_region->sr_ref_count > 0);
336 if (shared_region->sr_cpu_type == cputype &&
337 shared_region->sr_root_dir == root_dir &&
338 shared_region->sr_64bit == is_64bit) {
340 vm_shared_region_reference_locked(shared_region);
355 shared_region = new_shared_region;
358 shared_region,
379 ("shared_region: lookup(root=%p,cpu=%d,64bit=%d) <- %p\n",
380 root_dir, cputype, is_64bit, shared_region));
382 assert(shared_region->sr_ref_count > 0);
383 return shared_region;
392 vm_shared_region_t shared_region)
399 ("shared_region: -> reference_locked(%p)\n",
400 shared_region));
401 assert(shared_region->sr_ref_count > 0);
402 shared_region->sr_ref_count++;
404 ("shared_region: reference_locked(%p) <- %d\n",
405 shared_region, shared_region->sr_ref_count));
414 vm_shared_region_t shared_region)
417 ("shared_region: -> deallocate(%p)\n",
418 shared_region));
422 assert(shared_region->sr_ref_count > 0);
424 if (shared_region->sr_root_dir == NULL) {
432 !shared_region->sr_persists) {
434 shared_region->sr_ref_count++;
435 shared_region->sr_persists = TRUE;
437 shared_region->sr_persists) {
439 assert(shared_region->sr_ref_count > 1);
440 shared_region->sr_ref_count--;
441 shared_region->sr_persists = FALSE;
445 assert(shared_region->sr_ref_count > 0);
446 shared_region->sr_ref_count--;
448 ("shared_region: deallocate(%p): ref now %d\n",
449 shared_region, shared_region->sr_ref_count));
451 if (shared_region->sr_ref_count == 0) {
452 assert(! shared_region->sr_mapping_in_progress);
455 shared_region,
460 vm_shared_region_destroy(shared_region);
461 shared_region = NULL;
467 ("shared_region: deallocate(%p) <-\n",
468 shared_region));
483 vm_shared_region_t shared_region;
489 ("shared_region: -> create(root=%p,cpu=%d,64bit=%d)\n",
499 shared_region = kalloc(sizeof (*shared_region));
500 if (shared_region == NULL) {
502 ("shared_region: create: couldn't allocate\n"));
523 ("shared_region: create: unknown cpu type %d\n",
525 kfree(shared_region, sizeof (*shared_region));
526 shared_region = NULL;
553 ("shared_region: create: unknown cpu type %d\n",
555 kfree(shared_region, sizeof (*shared_region));
556 shared_region = NULL;
566 kfree(shared_region, sizeof (*shared_region));
567 shared_region = NULL;
569 ("shared_region: create: "
580 kfree(shared_region, sizeof (*shared_region));
581 shared_region = NULL;
583 ("shared_region: create: "
595 shared_region->sr_mem_entry = mem_entry_port;
598 shared_region->sr_base_address = base_address;
599 shared_region->sr_size = size;
600 shared_region->sr_pmap_nesting_start = pmap_nesting_start;
601 shared_region->sr_pmap_nesting_size = pmap_nesting_size;
602 shared_region->sr_cpu_type = cputype;
603 shared_region->sr_64bit = is_64bit;
604 shared_region->sr_root_dir = root_dir;
606 queue_init(&shared_region->sr_q);
607 shared_region->sr_mapping_in_progress = FALSE;
608 shared_region->sr_persists = FALSE;
609 shared_region->sr_first_mapping = (mach_vm_offset_t) -1;
612 shared_region->sr_ref_count = 1;
615 if (shared_region) {
617 ("shared_region: create(root=%p,cpu=%d,64bit=%d,"
621 (long long)size, shared_region,
625 ("shared_region: create(root=%p,cpu=%d,64bit=%d,"
630 return shared_region;
639 vm_shared_region_t shared_region)
645 ("shared_region: -> destroy(%p) (root=%p,cpu=%d,64bit=%d)\n",
646 shared_region,
647 shared_region->sr_root_dir,
648 shared_region->sr_cpu_type,
649 shared_region->sr_64bit));
651 assert(shared_region->sr_ref_count == 0);
652 assert(!shared_region->sr_persists);
654 mem_entry = (vm_named_entry_t) shared_region->sr_mem_entry->ip_kobject;
670 shared_region->sr_base_address,
671 (shared_region->sr_base_address +
672 shared_region->sr_size));
682 mach_memory_entry_port_release(shared_region->sr_mem_entry);
684 shared_region->sr_mem_entry = IPC_PORT_NULL;
687 kfree(shared_region, sizeof (*shared_region));
689 ("shared_region: destroy(%p) <-\n",
690 shared_region));
691 shared_region = NULL;
700 vm_shared_region_t shared_region,
708 ("shared_region: -> start_address(%p)\n",
709 shared_region));
710 assert(shared_region->sr_ref_count > 1);
719 while (shared_region->sr_mapping_in_progress) {
721 assert(shared_region->sr_ref_count > 1);
722 vm_shared_region_sleep(&shared_region->sr_mapping_in_progress,
725 assert(! shared_region->sr_mapping_in_progress);
726 assert(shared_region->sr_ref_count > 1);
728 sr_base_address = shared_region->sr_base_address;
729 sr_first_mapping = shared_region->sr_first_mapping;
742 ("shared_region: start_address(%p) <- 0x%llx\n",
743 shared_region, (long long)shared_region->sr_base_address));
759 vm_shared_region_t shared_region,
782 assert(shared_region->sr_ref_count > 1);
784 if (shared_region->sr_root_dir != root_dir) {
801 while (shared_region->sr_mapping_in_progress) {
803 vm_shared_region_sleep(&shared_region->sr_mapping_in_progress,
806 assert(! shared_region->sr_mapping_in_progress);
807 assert(shared_region->sr_ref_count > 1);
809 shared_region->sr_mapping_in_progress = TRUE;
814 sr_handle = shared_region->sr_mem_entry;
817 sr_base_address = shared_region->sr_base_address;
820 ("shared_region: -> map(%p,%d,%p,%p,0x%llx)\n",
821 shared_region, mappings_count, mappings,
830 ("shared_region: mapping[%d]: "
909 ("shared_region: mapping[%d]: "
932 ("shared_region: mapping[%d]: "
958 ("shared_region: mapping[%d]: "
987 * so no need to lock "shared_region".
989 if (shared_region->sr_first_mapping == (mach_vm_offset_t) -1) {
990 shared_region->sr_first_mapping = target_address;
995 assert(shared_region->sr_ref_count > 1);
996 assert(shared_region->sr_mapping_in_progress);
998 shared_region->sr_mapping_in_progress = FALSE;
999 thread_wakeup((event_t) &shared_region->sr_mapping_in_progress);
1004 ("shared_region: map(%p,%d,%p,%p,0x%llx) <- 0x%x \n",
1005 shared_region, mappings_count, mappings,
1024 vm_shared_region_t shared_region;
1035 ("shared_region: -> "
1040 shared_region = vm_shared_region_lookup(fsroot, cpu, is_64bit);
1041 if (shared_region == NULL) {
1044 ("shared_region: -> "
1053 vm_shared_region_set(task, shared_region);
1057 sr_address = shared_region->sr_base_address;
1058 sr_size = shared_region->sr_size;
1059 sr_handle = shared_region->sr_mem_entry;
1060 sr_pmap_nesting_start = shared_region->sr_pmap_nesting_start;
1061 sr_pmap_nesting_size = shared_region->sr_pmap_nesting_size;
1086 ("shared_region: enter(%p,%p,%p,%d,%d): "
1094 ("shared_region: enter(%p,%p,%p,%d,%d): "
1131 ("shared_region: enter(%p,%p,%p,%d,%d): "
1139 ("shared_region: enter(%p,%p,%p,%d,%d): "
1163 ("shared_region: enter(%p,%p,%p,%d,%d): "
1171 ("shared_region: enter(%p,%p,%p,%d,%d): "
1183 ("shared_region: enter(%p,%p,%p,%d,%d) <- 0x%x\n",