Lines Matching refs:mem
149 guard_position (void *mem, size_t size, size_t guardsize, struct pthread *pd, in guard_position() argument
153 return mem + (((size - guardsize) / 2) & ~pagesize_m1); in guard_position()
155 return mem; in guard_position()
164 setup_stack_prot (char *mem, size_t size, char *guard, size_t guardsize, in setup_stack_prot() argument
174 size_t mprots1 = (uintptr_t) guard - (uintptr_t) mem; in setup_stack_prot()
175 if (__mprotect (mem, mprots1, prot) != 0) in setup_stack_prot()
177 size_t mprots2 = ((uintptr_t) mem + size) - (uintptr_t) guardend; in setup_stack_prot()
187 advise_stack_range (void *mem, size_t size, uintptr_t pd, size_t guardsize) in advise_stack_range() argument
192 size_t freesize = (sp - (uintptr_t) mem) & ~pagesize_m1; in advise_stack_range()
195 __madvise (mem, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED); in advise_stack_range()
331 void *mem; in allocate_stack() local
364 pd = get_cached_stack (&size, &mem); in allocate_stack()
370 mem = __mmap (NULL, size, (guardsize == 0) ? prot : PROT_NONE, in allocate_stack()
373 if (__glibc_unlikely (mem == MAP_FAILED)) in allocate_stack()
378 assert (mem != NULL); in allocate_stack()
382 pd = (struct pthread *) ((((uintptr_t) mem + size) in allocate_stack()
386 pd = (struct pthread *) ((((uintptr_t) mem + size in allocate_stack()
395 char *guard = guard_position (mem, size, guardsize, pd, in allocate_stack()
397 if (setup_stack_prot (mem, size, guard, guardsize, prot) != 0) in allocate_stack()
399 __munmap (mem, size); in allocate_stack()
405 pd->stackblock = mem; in allocate_stack()
436 (void) __munmap (mem, size); in allocate_stack()
462 (void) __munmap (mem, size); in allocate_stack()
480 char *guard = guard_position (mem, size, guardsize, pd, in allocate_stack()
500 (void) __munmap (mem, size); in allocate_stack()
513 char *guard = mem + (((size - guardsize) / 2) & ~pagesize_m1); in allocate_stack()
514 char *oldguard = mem + (((size - pd->guardsize) / 2) & ~pagesize_m1); in allocate_stack()
525 if (__mprotect ((char *) mem + guardsize, pd->guardsize - guardsize, in allocate_stack()