Lines Matching refs:stack

261 	zend_fiber_stack *stack = emalloc(sizeof(zend_fiber_stack));  in zend_fiber_stack_allocate()  local
263 stack->pointer = (void *) ((uintptr_t) pointer + ZEND_FIBER_GUARD_PAGES * page_size); in zend_fiber_stack_allocate()
264 stack->size = stack_size; in zend_fiber_stack_allocate()
268 stack->ss_size= stack_size >> 5; in zend_fiber_stack_allocate()
271 stack->ss_size = (stack->ss_size + 7) & ~7; in zend_fiber_stack_allocate()
275 stack->ss_base = (void *)syscall(__NR_map_shadow_stack, 0, stack->ss_size, SHADOW_STACK_SET_TOKEN); in zend_fiber_stack_allocate()
277 if (stack->ss_base == MAP_FAILED) { in zend_fiber_stack_allocate()
284 uintptr_t base = (uintptr_t) stack->pointer; in zend_fiber_stack_allocate()
285 stack->valgrind_stack_id = VALGRIND_STACK_REGISTER(base, base + stack->size); in zend_fiber_stack_allocate()
289 stack->asan_pointer = stack->pointer; in zend_fiber_stack_allocate()
290 stack->asan_size = stack->size; in zend_fiber_stack_allocate()
293 return stack; in zend_fiber_stack_allocate()
296 static void zend_fiber_stack_free(zend_fiber_stack *stack) in zend_fiber_stack_free() argument
299 VALGRIND_STACK_DEREGISTER(stack->valgrind_stack_id); in zend_fiber_stack_free()
304 void *pointer = (void *) ((uintptr_t) stack->pointer - ZEND_FIBER_GUARD_PAGES * page_size); in zend_fiber_stack_free()
309 ASAN_UNPOISON_MEMORY_REGION(pointer, stack->size + ZEND_FIBER_GUARD_PAGES * page_size); in zend_fiber_stack_free()
315 munmap(pointer, stack->size + ZEND_FIBER_GUARD_PAGES * page_size); in zend_fiber_stack_free()
319 munmap(stack->ss_base, stack->ss_size); in zend_fiber_stack_free()
322 efree(stack); in zend_fiber_stack_free()
326 ZEND_API void* zend_fiber_stack_limit(zend_fiber_stack *stack) in zend_fiber_stack_limit() argument
340 return (int8_t*)stack->pointer + reserve; in zend_fiber_stack_limit()
343 ZEND_API void* zend_fiber_stack_base(zend_fiber_stack *stack) in zend_fiber_stack_base() argument
345 return (void*)((uintptr_t)stack->pointer + stack->size); in zend_fiber_stack_base()
365 __sanitizer_finish_switch_fiber(NULL, &from->stack->asan_pointer, &from->stack->asan_size); in zend_fiber_trampoline()
408 context->stack = zend_fiber_stack_allocate(stack_size); in zend_fiber_init_context()
410 if (UNEXPECTED(!context->stack)) { in zend_fiber_init_context()
415 ucontext_t *handle = &context->stack->ucontext; in zend_fiber_init_context()
419 handle->uc_stack.ss_size = context->stack->size; in zend_fiber_init_context()
420 handle->uc_stack.ss_sp = context->stack->pointer; in zend_fiber_init_context()
429 void *stack = (void *) ((uintptr_t) context->stack->pointer + context->stack->size); in zend_fiber_init_context() local
435 *((unsigned long*) (stack - 8)) = (unsigned long)context->stack->ss_base + context->stack->ss_size; in zend_fiber_init_context()
438 context->handle = make_fcontext(stack, context->stack->size, zend_fiber_trampoline); in zend_fiber_init_context()
461 zend_fiber_stack_free(context->stack); in zend_fiber_destroy_context()
503 to->stack->asan_pointer, in zend_fiber_switch_context()
504 to->stack->asan_size); in zend_fiber_switch_context()
529 __sanitizer_finish_switch_fiber(fake_stack, &to->stack->asan_pointer, &to->stack->asan_size); in zend_fiber_switch_context()
572 zend_vm_stack stack = zend_vm_stack_new_page(ZEND_FIBER_VM_STACK_SIZE, NULL); in zend_fiber_execute() local
573 EG(vm_stack) = stack; in zend_fiber_execute()
574 EG(vm_stack_top) = stack->top + ZEND_CALL_FRAME_SLOT; in zend_fiber_execute()
575 EG(vm_stack_end) = stack->end; in zend_fiber_execute()
578 fiber->execute_data = (zend_execute_data *) stack->top; in zend_fiber_execute()
591 EG(stack_base) = zend_fiber_stack_base(fiber->context.stack); in zend_fiber_execute()
592 EG(stack_limit) = zend_fiber_stack_limit(fiber->context.stack); in zend_fiber_execute()
1066 context->stack = emalloc(sizeof(zend_fiber_stack)); in zend_fiber_init()
1069 context->handle = &context->stack->ucontext; in zend_fiber_init()
1085 efree(EG(main_fiber_context)->stack); in zend_fiber_shutdown()