Lines Matching full:if
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
31 if (mmap_lock_count++ == 0) { in mmap_lock()
39 if (--mmap_lock_count == 0) { in mmap_unlock()
52 if (mmap_lock_count) in mmap_fork_start()
59 if (child) in mmap_fork_end()
76 if ((start & ~TARGET_PAGE_MASK) != 0) in target_mprotect()
80 if (end < start) in target_mprotect()
83 if (len == 0) in target_mprotect()
89 if (start > host_start) { in target_mprotect()
95 if (host_end == host_start + qemu_host_page_size) { in target_mprotect()
103 if (ret != 0) in target_mprotect()
107 if (end < host_end) { in target_mprotect()
114 if (ret != 0) in target_mprotect()
120 if (host_start < host_end) { in target_mprotect()
122 if (ret != 0) in target_mprotect()
136 * If @zero, zero the rest of the block at EOF.
144 if (likely(r == len)) { in mmap_pread()
148 if (r == 0) { in mmap_pread()
150 if (zero) { in mmap_pread()
155 if (r > 0) { in mmap_pread()
160 } else if (errno != EINTR) { in mmap_pread()
170 * mmap_frag can be called with a valid fd, if flags doesn't contain one of
171 * MAP_ANON, MAP_STACK, MAP_GUARD. If we need to map a page in those cases, we
172 * pass fd == -1. However, if flags contains MAP_GUARD then MAP_ANON cannot be
175 * * If fd is valid (not -1) we want to map the pages with MAP_ANON.
176 * * If flags contains MAP_GUARD we don't want to add MAP_ANON because it
179 * * If flags contains MAP_ANON it doesn't matter if we add it or not.
180 * * If flags contains MAP_STACK, mmap adds MAP_ANON when called so doesn't
181 * matter if we add it or not either. See enforcing of constraints for
202 if (addr < start || addr >= end) in mmap_frag()
206 if (prot1 == 0) { in mmap_frag()
210 if (p == MAP_FAILED) in mmap_frag()
217 if (fd != -1) { in mmap_frag()
218 /* msync() won't work here, so we return an error if write is in mmap_frag()
220 if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && in mmap_frag()
225 if (!(prot1 & PROT_WRITE)) in mmap_frag()
229 if (!mmap_pread(fd, g2h_untagged(start), end - start, offset, true)) { in mmap_frag()
234 if (prot_new != (prot1 | PROT_WRITE)) in mmap_frag()
237 if (prot_new != prot1) { in mmap_frag()
240 if (prot_new & PROT_WRITE) { in mmap_frag()
247 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
264 if (ret == -1 && start > TARGET_PAGE_SIZE) { in mmap_find_vma_reserved()
277 * Return -1 if error.
286 /* If 'start' == 0, then a default start address is used. */ in mmap_find_vma()
287 if (start == 0) { in mmap_find_vma()
295 if (reserved_va) { in mmap_find_vma()
305 if (alignment != 0) { in mmap_find_vma()
320 /* ENOMEM, if host address space has no memory */ in mmap_find_vma()
321 if (ptr == MAP_FAILED) { in mmap_find_vma()
331 if (h2g_valid(ptr + size - 1)) { in mmap_find_vma()
334 if ((addr & ~TARGET_PAGE_MASK) == 0) { in mmap_find_vma()
336 if (start == mmap_next_start && addr >= TASK_UNMAPPED_BASE) { in mmap_find_vma()
371 * again at low memory. If any repetition, fail. in mmap_find_vma()
379 /* ENOMEM if we checked the whole of the target address space. */ in mmap_find_vma()
380 if (addr == (abi_ulong)-1) { in mmap_find_vma()
382 } else if (addr == 0) { in mmap_find_vma()
383 if (wrapped) { in mmap_find_vma()
392 } else if (wrapped && addr >= start) { in mmap_find_vma()
405 if (qemu_loglevel_mask(CPU_LOG_PAGE)) { in target_mmap()
412 if (flags & MAP_ALIGNMENT_MASK) { in target_mmap()
416 if (flags & MAP_GUARD) { in target_mmap()
419 if (flags & MAP_FIXED) { in target_mmap()
422 if (flags & MAP_ANON) { in target_mmap()
425 if (flags & MAP_EXCL) { in target_mmap()
428 if (flags & MAP_PRIVATE) { in target_mmap()
431 if (flags & MAP_SHARED) { in target_mmap()
434 if (flags & MAP_NOCORE) { in target_mmap()
437 if (flags & MAP_STACK) { in target_mmap()
443 if ((flags & MAP_ANON) && fd != -1) { in target_mmap()
447 if (flags & MAP_STACK) { in target_mmap()
448 if ((fd != -1) || ((prot & (PROT_READ | PROT_WRITE)) != in target_mmap()
454 if ((flags & MAP_GUARD) && (prot != PROT_NONE || fd != -1 || in target_mmap()
462 if (offset & ~TARGET_PAGE_MASK) { in target_mmap()
467 if (len == 0) { in target_mmap()
474 if (len == 0) { in target_mmap()
483 * If the user is asking for the kernel to find a location, do that in target_mmap()
486 if (!(flags & MAP_FIXED)) { in target_mmap()
493 if (start == (abi_ulong)-1) { in target_mmap()
503 * For example, if mmaping a file of 100 bytes on a host with 4K pages in target_mmap()
513 if ((qemu_real_host_page_size() < qemu_host_page_size) && fd != -1) { in target_mmap()
516 if (fstat(fd, &sb) == -1) { in target_mmap()
521 if (offset + len > sb.st_size) { in target_mmap()
523 * If so, truncate the file map at eof aligned with in target_mmap()
531 if (!(flags & MAP_FIXED)) { in target_mmap()
540 * especially important if qemu_host_page_size > in target_mmap()
545 if (p == MAP_FAILED) in target_mmap()
549 if (fd != -1) { in target_mmap()
552 if (p == MAP_FAILED) { in target_mmap()
560 if (start & ~TARGET_PAGE_MASK) { in target_mmap()
568 * Test if requested memory area fits target address space in target_mmap()
572 if (!guest_range_valid_untagged(start, len)) { in target_mmap()
581 if (fd != -1 && in target_mmap()
584 * msync() won't work here, so we return an error if write is in target_mmap()
587 if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && in target_mmap()
595 if (retaddr == -1) in target_mmap()
597 if (!mmap_pread(fd, g2h_untagged(start), len, offset, false)) { in target_mmap()
600 if (!(prot & PROT_WRITE)) { in target_mmap()
607 /* Reject the mapping if any page within the range is mapped */ in target_mmap()
608 if ((flags & MAP_EXCL) && !page_check_range_empty(start, end - 1)) { in target_mmap()
614 if (start > real_start) { in target_mmap()
615 if (real_end == real_start + qemu_host_page_size) { in target_mmap()
619 if (ret == -1) in target_mmap()
625 if (ret == -1) in target_mmap()
630 if (end < real_end) { in target_mmap()
635 if (ret == -1) in target_mmap()
641 if (real_start < real_end) { in target_mmap()
644 if (flags & MAP_ANON) in target_mmap()
650 if (p == MAP_FAILED) in target_mmap()
680 if (start > real_start) { in mmap_reserve()
686 if (real_end == real_start + qemu_host_page_size) { in mmap_reserve()
692 if (prot != 0) { in mmap_reserve()
696 if (end < real_end) { in mmap_reserve()
701 if (prot != 0) { in mmap_reserve()
705 if (real_start != real_end) { in mmap_reserve()
721 if (start & ~TARGET_PAGE_MASK) in target_munmap()
724 if (len == 0) in target_munmap()
731 if (start > real_start) { in target_munmap()
737 if (real_end == real_start + qemu_host_page_size) { in target_munmap()
743 if (prot != 0) in target_munmap()
746 if (end < real_end) { in target_munmap()
751 if (prot != 0) in target_munmap()
757 if (real_start < real_end) { in target_munmap()
758 if (reserved_va) { in target_munmap()
765 if (ret == 0) { in target_munmap()
776 if (start & ~TARGET_PAGE_MASK) in target_msync()
780 if (end < start) in target_msync()
782 if (end == start) in target_msync()