Lines Matching defs:shared_region

145 static void vm_shared_region_reference_locked(vm_shared_region_t shared_region);
150 static void vm_shared_region_destroy(vm_shared_region_t shared_region);
169 ("shared_region: -> init\n"));
180 ("shared_region: <- init\n"));
193 vm_shared_region_t shared_region;
196 ("shared_region: -> get(%p)\n",
201 shared_region = task->shared_region;
202 if (shared_region) {
203 assert(shared_region->sr_ref_count > 0);
204 vm_shared_region_reference_locked(shared_region);
210 ("shared_region: get(%p) <- %p\n",
211 task, shared_region));
213 return shared_region;
226 vm_shared_region_t shared_region)
229 ("shared_region: -> base_address(%p)\n",
230 shared_region));
231 assert(shared_region->sr_ref_count > 1);
233 ("shared_region: base_address(%p) <- 0x%llx\n",
234 shared_region, (long long)shared_region->sr_base_address));
235 return shared_region->sr_base_address;
248 vm_shared_region_t shared_region)
251 ("shared_region: -> size(%p)\n",
252 shared_region));
253 assert(shared_region->sr_ref_count > 1);
255 ("shared_region: size(%p) <- 0x%llx\n",
256 shared_region, (long long)shared_region->sr_size));
257 return shared_region->sr_size;
270 vm_shared_region_t shared_region)
273 ("shared_region: -> mem_entry(%p)\n",
274 shared_region));
275 assert(shared_region->sr_ref_count > 1);
277 ("shared_region: mem_entry(%p) <- %p\n",
278 shared_region, shared_region->sr_mem_entry));
279 return shared_region->sr_mem_entry;
297 ("shared_region: -> set(%p, %p)\n",
303 old_shared_region = task->shared_region;
308 task->shared_region = new_shared_region;
319 ("shared_region: set(%p) <- old=%p new=%p\n",
336 vm_shared_region_t shared_region;
340 ("shared_region: -> lookup(root=%p,cpu=%d,64bit=%d)\n",
343 shared_region = NULL;
349 shared_region,
352 assert(shared_region->sr_ref_count > 0);
353 if (shared_region->sr_cpu_type == cputype &&
354 shared_region->sr_root_dir == root_dir &&
355 shared_region->sr_64bit == is_64bit) {
357 vm_shared_region_reference_locked(shared_region);
372 shared_region = new_shared_region;
375 shared_region,
396 ("shared_region: lookup(root=%p,cpu=%d,64bit=%d) <- %p\n",
397 root_dir, cputype, is_64bit, shared_region));
399 assert(shared_region->sr_ref_count > 0);
400 return shared_region;
409 vm_shared_region_t shared_region)
416 ("shared_region: -> reference_locked(%p)\n",
417 shared_region));
418 assert(shared_region->sr_ref_count > 0);
419 shared_region->sr_ref_count++;
421 if (shared_region->sr_timer_call != NULL) {
425 cancelled = thread_call_cancel(shared_region->sr_timer_call);
427 thread_call_free(shared_region->sr_timer_call);
428 shared_region->sr_timer_call = NULL;
430 shared_region->sr_ref_count--;
437 ("shared_region: reference_locked(%p) <- %d\n",
438 shared_region, shared_region->sr_ref_count));
447 vm_shared_region_t shared_region)
450 ("shared_region: -> deallocate(%p)\n",
451 shared_region));
455 assert(shared_region->sr_ref_count > 0);
457 if (shared_region->sr_root_dir == NULL) {
465 !shared_region->sr_persists) {
467 shared_region->sr_ref_count++;
468 shared_region->sr_persists = TRUE;
470 shared_region->sr_persists) {
472 assert(shared_region->sr_ref_count > 1);
473 shared_region->sr_ref_count--;
474 shared_region->sr_persists = FALSE;
478 assert(shared_region->sr_ref_count > 0);
479 shared_region->sr_ref_count--;
481 ("shared_region: deallocate(%p): ref now %d\n",
482 shared_region, shared_region->sr_ref_count));
484 if (shared_region->sr_ref_count == 0) {
487 if (shared_region->sr_timer_call == NULL) {
489 assert(! shared_region->sr_mapping_in_progress);
490 shared_region->sr_ref_count++;
493 shared_region->sr_timer_call = thread_call_allocate(
495 (thread_call_param_t) shared_region);
501 thread_call_enter_delayed(shared_region->sr_timer_call,
505 ("shared_region: deallocate(%p): armed timer\n",
506 shared_region));
517 shared_region,
522 vm_shared_region_destroy(shared_region);
523 shared_region = NULL;
530 ("shared_region: deallocate(%p) <-\n",
531 shared_region));
539 vm_shared_region_t shared_region;
541 shared_region = (vm_shared_region_t) param0;
543 vm_shared_region_deallocate(shared_region);
558 vm_shared_region_t shared_region;
564 ("shared_region: -> create(root=%p,cpu=%d,64bit=%d)\n",
574 shared_region = kalloc(sizeof (*shared_region));
575 if (shared_region == NULL) {
577 ("shared_region: create: couldn't allocate\n"));
598 ("shared_region: create: unknown cpu type %d\n",
600 kfree(shared_region, sizeof (*shared_region));
601 shared_region = NULL;
628 ("shared_region: create: unknown cpu type %d\n",
630 kfree(shared_region, sizeof (*shared_region));
631 shared_region = NULL;
641 kfree(shared_region, sizeof (*shared_region));
642 shared_region = NULL;
644 ("shared_region: create: "
655 kfree(shared_region, sizeof (*shared_region));
656 shared_region = NULL;
658 ("shared_region: create: "
670 shared_region->sr_mem_entry = mem_entry_port;
673 shared_region->sr_base_address = base_address;
674 shared_region->sr_size = size;
675 shared_region->sr_pmap_nesting_start = pmap_nesting_start;
676 shared_region->sr_pmap_nesting_size = pmap_nesting_size;
677 shared_region->sr_cpu_type = cputype;
678 shared_region->sr_64bit = is_64bit;
679 shared_region->sr_root_dir = root_dir;
681 queue_init(&shared_region->sr_q);
682 shared_region->sr_mapping_in_progress = FALSE;
683 shared_region->sr_persists = FALSE;
684 shared_region->sr_timer_call = NULL;
685 shared_region->sr_first_mapping = (mach_vm_offset_t) -1;
688 shared_region->sr_ref_count = 1;
691 if (shared_region) {
693 ("shared_region: create(root=%p,cpu=%d,64bit=%d,"
697 (long long)size, shared_region,
701 ("shared_region: create(root=%p,cpu=%d,64bit=%d,"
706 return shared_region;
715 vm_shared_region_t shared_region)
721 ("shared_region: -> destroy(%p) (root=%p,cpu=%d,64bit=%d)\n",
722 shared_region,
723 shared_region->sr_root_dir,
724 shared_region->sr_cpu_type,
725 shared_region->sr_64bit));
727 assert(shared_region->sr_ref_count == 0);
728 assert(!shared_region->sr_persists);
730 mem_entry = (vm_named_entry_t) shared_region->sr_mem_entry->ip_kobject;
746 shared_region->sr_base_address,
747 (shared_region->sr_base_address +
748 shared_region->sr_size));
758 mach_memory_entry_port_release(shared_region->sr_mem_entry);
760 shared_region->sr_mem_entry = IPC_PORT_NULL;
762 if (shared_region->sr_timer_call) {
763 thread_call_free(shared_region->sr_timer_call);
766 if ((slide_info.slide_info_entry != NULL) && (slide_info.sr == shared_region)) {
782 kfree(shared_region, sizeof (*shared_region));
785 ("shared_region: destroy(%p) <-\n",
786 shared_region));
787 shared_region = NULL;
796 vm_shared_region_t shared_region,
804 ("shared_region: -> start_address(%p)\n",
805 shared_region));
806 assert(shared_region->sr_ref_count > 1);
815 while (shared_region->sr_mapping_in_progress) {
817 assert(shared_region->sr_ref_count > 1);
818 vm_shared_region_sleep(&shared_region->sr_mapping_in_progress,
821 assert(! shared_region->sr_mapping_in_progress);
822 assert(shared_region->sr_ref_count > 1);
824 sr_base_address = shared_region->sr_base_address;
825 sr_first_mapping = shared_region->sr_first_mapping;
838 ("shared_region: start_address(%p) <- 0x%llx\n",
839 shared_region, (long long)shared_region->sr_base_address));
852 vm_shared_region_t shared_region = NULL;
855 shared_region = vm_shared_region_get(current_task());
856 if (shared_region == NULL) {
867 assert(shared_region->sr_ref_count > 1);
869 while (shared_region->sr_mapping_in_progress) {
871 vm_shared_region_sleep(&shared_region->sr_mapping_in_progress,
874 assert(! shared_region->sr_mapping_in_progress);
875 assert(shared_region->sr_ref_count > 1);
877 shared_region->sr_mapping_in_progress = TRUE;
884 sr_handle = shared_region->sr_mem_entry;
887 sr_base_address = shared_region->sr_base_address;
903 ("shared_region: mapping[%d]: "
927 shared_region->sr_first_mapping = (mach_vm_offset_t) -1;
931 assert(shared_region->sr_ref_count > 1);
932 assert(shared_region->sr_mapping_in_progress);
934 shared_region->sr_mapping_in_progress = FALSE;
935 thread_wakeup((event_t) &shared_region->sr_mapping_in_progress);
940 vm_shared_region_deallocate(shared_region);
955 vm_shared_region_t shared_region,
980 assert(shared_region->sr_ref_count > 1);
982 if (shared_region->sr_root_dir != root_dir) {
999 while (shared_region->sr_mapping_in_progress) {
1001 vm_shared_region_sleep(&shared_region->sr_mapping_in_progress,
1004 assert(! shared_region->sr_mapping_in_progress);
1005 assert(shared_region->sr_ref_count > 1);
1007 shared_region->sr_mapping_in_progress = TRUE;
1012 sr_handle = shared_region->sr_mem_entry;
1015 sr_base_address = shared_region->sr_base_address;
1018 ("shared_region: -> map(%p,%d,%p,%p,0x%llx)\n",
1019 shared_region, mappings_count, mappings,
1028 ("shared_region: mapping[%d]: "
1052 ("shared_region: mapping[%d]: "
1133 ("shared_region: mapping[%d]: "
1154 ("shared_region: mapping[%d]: "
1176 * so no need to lock "shared_region".
1178 if (shared_region->sr_first_mapping == (mach_vm_offset_t) -1) {
1179 shared_region->sr_first_mapping = target_address;
1184 assert(shared_region->sr_ref_count > 1);
1185 assert(shared_region->sr_mapping_in_progress);
1187 shared_region->sr_mapping_in_progress = FALSE;
1188 thread_wakeup((event_t) &shared_region->sr_mapping_in_progress);
1193 ("shared_region: map(%p,%d,%p,%p,0x%llx) <- 0x%x \n",
1194 shared_region, mappings_count, mappings,
1213 vm_shared_region_t shared_region;
1224 ("shared_region: -> "
1229 shared_region = vm_shared_region_lookup(fsroot, cpu, is_64bit);
1230 if (shared_region == NULL) {
1233 ("shared_region: -> "
1242 vm_shared_region_set(task, shared_region);
1246 sr_address = shared_region->sr_base_address;
1247 sr_size = shared_region->sr_size;
1248 sr_handle = shared_region->sr_mem_entry;
1249 sr_pmap_nesting_start = shared_region->sr_pmap_nesting_start;
1250 sr_pmap_nesting_size = shared_region->sr_pmap_nesting_size;
1275 ("shared_region: enter(%p,%p,%p,%d,%d): "
1283 ("shared_region: enter(%p,%p,%p,%d,%d): "
1320 ("shared_region: enter(%p,%p,%p,%d,%d): "
1328 ("shared_region: enter(%p,%p,%p,%d,%d): "
1352 ("shared_region: enter(%p,%p,%p,%d,%d): "
1360 ("shared_region: enter(%p,%p,%p,%d,%d): "
1372 ("shared_region: enter(%p,%p,%p,%d,%d) <- 0x%x\n",