Lines Matching full:task

48 /* ------ PGTask and task operations: new/destroy/map/unmap ------ */
56 * A "task" in PVG terminology represents a host-virtual contiguous address
57 * range which is reserved in a large chunk on task creation. The mapMemory
64 * task memory.
73 * task, and on which we have thus called memory_region_ref(). There are
85 PGTask_t *task;
93 task = g_new0(PGTask_t, 1);
94 task->s = s;
95 task->address = task_mem;
96 task->len = len;
97 task->mapped_regions = g_ptr_array_sized_new(2 /* Usually enough */);
100 QTAILQ_INSERT_TAIL(&s->tasks, task, node);
102 return task;
105 static void apple_gfx_destroy_task(AppleGFXState *s, PGTask_t *task)
107 GPtrArray *regions = task->mapped_regions;
117 mach_vm_deallocate(mach_task_self(), task->address, task->len);
120 QTAILQ_REMOVE(&s->tasks, task, node);
121 g_free(task);
154 static bool apple_gfx_task_map_memory(AppleGFXState *s, PGTask_t *task,
169 trace_apple_gfx_map_memory(task, range_count, virtual_offset, read_only);
173 target = task->address + virtual_offset;
188 if (!g_ptr_array_find(task->mapped_regions, region, NULL)) {
189 g_ptr_array_add(task->mapped_regions, region);
195 /* Map guest RAM at range->physicalAddress into PG task memory range */
210 static void apple_gfx_task_unmap_memory(AppleGFXState *s, PGTask_t *task,
216 trace_apple_gfx_unmap_memory(task, virtual_offset, length);
219 * Replace task memory range with fresh 0 pages, undoing the mapping
222 range_address = task->address + virtual_offset;
603 PGTask_t *task = apple_gfx_new_task(s, vmSize);
604 *baseAddress = (void *)task->address;
606 return task;
609 desc.destroyTask = ^(PGTask_t * _Nonnull task) {
610 trace_apple_gfx_destroy_task(task, task->mapped_regions->len);
612 apple_gfx_destroy_task(s, task);
615 desc.mapMemory = ^bool(PGTask_t * _Nonnull task, uint32_t range_count,
618 return apple_gfx_task_map_memory(s, task, virtual_offset,
622 desc.unmapMemory = ^bool(PGTask_t * _Nonnull task, uint64_t virtual_offset,
624 apple_gfx_task_unmap_memory(s, task, virtual_offset, length);