void *check_mmap(const char *file, const int lineno, void *addr, size_t length, int prot, int flags, int fd, off_t offset) { void *p; p = safe_mmap(file, lineno, addr, length, prot, flags, fd, offset); tst_res_(file, lineno, TPASS, "mmap(%p, %zu, %i, %i, %i, %li) succeeded", addr, length, prot, flags, fd, (long)offset); return p; }
void alloc_prolog_memory(prolog_engine *pe, size_t stack_size, size_t heap_size) { pe->stack_size = stack_size; pe->heap_size = heap_size; pe->memory_base = (PCell *)safe_mmap(0, (heap_size + stack_size)*sizeof(PCell) + heap_size/8, 0); pe->mark_area = pe->memory_base + heap_size + stack_size; pe->stack_max = pe->memory_base; pe->stack_base = pe->heap_base = pe->stack_max + stack_size; pe->trail_base = pe->globals_top = pe->globals_base = pe->heap_base + heap_size - 1; pe->globals_free_list.uint = MMK_INT(-1); protect_stack(pe); }