/freebsd/tests/sys/vm/ |
H A D | mmap_test.c | 115 int pagesize; in checked_mmap() local 117 ATF_REQUIRE((pagesize = getpagesize()) > 0); in checked_mmap() 118 p = mmap(NULL, pagesize, prot, flags, fd, 0); in checked_mmap() 129 munmap(p, pagesize); in checked_mmap() 136 int devstatfd, pagesize, shmfd, zerofd; in ATF_TC_BODY() local 138 ATF_REQUIRE((pagesize = getpagesize()) > 0); in ATF_TC_BODY() 141 ATF_REQUIRE(ftruncate(shmfd, pagesize) == 0); in ATF_TC_BODY() 208 int fd, i, pagesize; in ATF_TC_BODY() local 210 ATF_REQUIRE((pagesize = getpagesize()) > 0); in ATF_TC_BODY() 213 p1 = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); in ATF_TC_BODY() [all …]
|
H A D | mmap_map_32bit_helper.c | 19 size_t pagesize; in main() local 23 if ((pagesize = getpagesize()) <= 0) in main() 30 s32 = mmap(NULL, pagesize, PROT_READ, MAP_32BIT | MAP_PRIVATE, fd, 0); in main() 33 if (((vm_offset_t)s32 + pagesize) > MAP_32BIT_MAX_ADDR) in main() 37 if (munmap(s32, pagesize) != 0) in main() 40 s32 = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, in main() 44 if (((vm_offset_t)s32 + pagesize) > MAP_32BIT_MAX_ADDR) in main() 47 if (munmap(s32, pagesize) != 0) in main()
|
H A D | shared_shadow_inval_test.c | 91 size_t pagesize; member 144 for (i = 0; i < ss->len; i += ss->pagesize) in child_fault() 153 for (i = 0; i < len; i += ss->pagesize) in child_write() 175 for (i = 0; i < ss->len; i += ss->pagesize) { in child_verify() 313 do_one_shared_shadow_inval(bool lazy_cow, size_t pagesize, size_t len, in do_one_shared_shadow_inval() argument 334 ss->pagesize = pagesize; in do_one_shared_shadow_inval() 360 size_t largepagesize, pagesize, pagesizes[MAXPAGESIZES], sysctllen; in do_shared_shadow_inval() local 367 pagesize = pagesizes[0]; in do_shared_shadow_inval() 373 do_one_shared_shadow_inval(lazy_cow, pagesize, in do_shared_shadow_inval() 374 pagesize, i); in do_shared_shadow_inval() [all …]
|
/freebsd/lib/libgeom/ |
H A D | geom_stats.c | 49 static int pagesize, statsfd = -1; variable 58 if (munmap(statp, npages * pagesize) != 0) in geom_stats_close() 79 if (statp != NULL && munmap(statp, npages * pagesize) != 0) in geom_stats_resync() 85 npages = mediasize / pagesize; in geom_stats_resync() 96 pagesize = getpagesize(); in geom_stats_open() 97 spp = pagesize / sizeof(struct devstat); in geom_stats_open() 106 uint pagesize; member 122 sp->ptr = malloc(pagesize * npages); in geom_stats_snapshot_get() 127 explicit_bzero(sp->ptr, pagesize * npages); /* page in, cache */ in geom_stats_snapshot_get() 129 memcpy(sp->ptr, statp, pagesize * npages); in geom_stats_snapshot_get() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/gwp_asan/ |
H A D | common.cpp | 75 size_t AllocatorState::maximumAllocationSize() const { return PageSize; } in maximumAllocationSize() 78 return GuardedPagePool + (PageSize * (1 + N)) + (maximumAllocationSize() * N); in slotToAddr() 83 size_t PageOffsetFromPoolStart = (Ptr - GuardedPagePool) / PageSize; in isGuardPage() 84 size_t PagesPerSlot = maximumAllocationSize() / PageSize; in isGuardPage() 91 (State->maximumAllocationSize() + State->PageSize); in addrToSlot() 95 if (Ptr <= GuardedPagePool + PageSize) in getNearestSlot() 97 if (Ptr > GuardedPagePoolEnd - PageSize) in getNearestSlot() 103 if (Ptr % PageSize <= PageSize / 2) in getNearestSlot() 104 return addrToSlot(this, Ptr - PageSize); // Round down. in getNearestSlot() 105 return addrToSlot(this, Ptr + PageSize); // Round up. in getNearestSlot()
|
H A D | guarded_pool_allocator.cpp | 34 uintptr_t getPageAddr(uintptr_t Ptr, uintptr_t PageSize) { in getPageAddr() argument 35 return Ptr & ~(PageSize - 1); in getPageAddr() 74 const size_t PageSize = getPlatformPageSize(); in init() local 76 assert((PageSize & (PageSize - 1)) == 0); in init() 77 State.PageSize = PageSize; in init() 87 PageSize * (2 + State.MaxSimultaneousAllocations) + in init() 89 assert(PoolBytesRequired % PageSize == 0); in init() 93 roundUpTo(State.MaxSimultaneousAllocations * sizeof(*Metadata), PageSize); in init() 99 State.MaxSimultaneousAllocations * sizeof(*FreeSlots), PageSize); in init() 153 State.PageSize)); in uninitTestOnly() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/scudo/standalone/ |
H A D | release.h | 392 PageSize = getPageSizeCached(); in BlockSize() 393 if (BlockSize <= PageSize) { in BlockSize() 394 if (PageSize % BlockSize == 0) { in BlockSize() 396 FullPagesBlockCountMax = PageSize / BlockSize; in BlockSize() 398 } else if (BlockSize % (PageSize % BlockSize) == 0) { in BlockSize() 402 FullPagesBlockCountMax = PageSize / BlockSize + 1; in BlockSize() 407 FullPagesBlockCountMax = PageSize / BlockSize + 2; in BlockSize() 411 if (BlockSize % PageSize == 0) { in BlockSize() 430 PagesCount = roundUp(ReleaseSize, PageSize) / PageSize; in ensurePageMapAllocated() 601 uptr PageSize; global() member 616 const uptr PageSize = Context.PageSize; releaseFreeMemoryToOS() local [all...] |
H A D | secondary.h | 125 const uptr PageSize = getPageSizeCached(); in mapSecondary() local 133 if (useMemoryTagging<Config>(Options) && isAligned(TaggedSize, PageSize)) { in mapSecondary() 147 const uptr MaxUnusedCacheBytes = MaxUnusedCachePages * PageSize; in mapSecondary() 300 const uptr PageSize = getPageSizeCached(); in retrieve() local 326 AllocPos > CommitBase + PageSize * MaxUnusedCachePages) { in retrieve() 593 const uptr PageSize = getPageSizeCached(); in allocate() local 597 const uptr MinNeededSizeForCache = roundUp(Size + getHeadersSize(), PageSize); in allocate() 599 if (Alignment < PageSize && Cache.canCache(MinNeededSizeForCache)) { in allocate() 629 roundUp(roundUp(Size, Alignment) + getHeadersSize(), PageSize); in allocate() 630 if (Alignment > PageSize) in allocate() [all …]
|
/freebsd/sys/dev/flash/ |
H A D | at45d.c | 79 uint16_t pagesize; member 93 uint16_t pagesize; member 306 uint16_t pagesize; in at45d_delayed_attach() local 337 pagesize = ident->pagesize2n; in at45d_delayed_attach() 339 pagesize = ident->pagesize; in at45d_delayed_attach() 340 sc->pagesize = pagesize; in at45d_delayed_attach() 348 sectorsize = pagesize; in at45d_delayed_attach() 360 if ((sectorsize % pagesize) != 0) { in at45d_delayed_attach() 362 "must be a multiple of %d\n", sectorsize, pagesize); in at45d_delayed_attach() 366 sc->dummybuf = malloc(pagesize, M_DEVBUF, M_WAITOK | M_ZERO); in at45d_delayed_attach() [all …]
|
/freebsd/share/doc/papers/sysperf/ |
H A D | a1.t | 447 int npages = 4096, pagesize, vflag = 0; 477 pages = valloc(npages * pagesize); 480 npages, (npages * pagesize) / (1024. * 1024.)); 483 lastpage = pages + (npages * pagesize); 487 for (pf = pages; pf < lastpage; pf += pagesize) 506 register int npages = 4096, pagesize, pn, i, niter; 542 pages = valloc(npages * pagesize); 545 npages, (npages * pagesize) / (1024. * 1024.)); 554 pages[pagesize * pn] = 1; 581 int npages = 4096, pagesize, debug = 0; [all …]
|
/freebsd/crypto/krb5/src/plugins/kdb/db2/libdb2/mpool/ |
H A D | mpool.c | 59 mpool_open(key, fd, pagesize, maxcache) in mpool_open() argument 62 db_pgno_t pagesize, maxcache; 88 mp->npages = sb.st_size / pagesize; 89 mp->pagesize = pagesize; 230 off = mp->pagesize * pgno; 231 if (off / mp->pagesize != pgno) { 240 if ((nr = read(mp->fd, bp->page, mp->pagesize)) != 241 (ssize_t)mp->pagesize) { 251 memset(bp->page, 0, mp->pagesize); 383 memset(bp, 0xff, sizeof(BKT) + mp->pagesize); [all …]
|
/freebsd/tools/test/stress2/misc/ |
H A D | mprotect3.sh | 31 long pagesize; 35 pagesize = sysconf(_SC_PAGESIZE); 36 if (pagesize < 0) 39 alloc_size = 0x200000 + pagesize; 49 guard = addr + alloc_size - 0x20 * pagesize; 51 if (mprotect(guard, pagesize, PROT_NONE)) {
|
H A D | datamove2.sh | 94 int pagesize; 149 addr = mmap(NULL, pagesize * 2, PROT_READ | PROT_WRITE, MAP_SHARED, fd1, 0); 155 addr = mmap(buffer + pagesize, pagesize, PROT_READ | PROT_WRITE, MAP_FIXED | 169 if (munmap(bufferp, pagesize * 2) == -1) 178 if (munmap(bufferp + pagesize * 2, pagesize * 2) == -1) 188 len = write(fd, buffer, 2 * pagesize); 206 pagesize = getpagesize();
|
H A D | datamove4.sh | 101 int pagesize; 156 addr = mmap(NULL, pagesize * 2, PROT_READ | PROT_WRITE, MAP_SHARED, fd1, 0); 162 addr = mmap(buffer + pagesize, pagesize, PROT_READ | PROT_WRITE, MAP_FIXED | 176 if (munmap(bufferp, pagesize * 2) == -1) 185 if (munmap(bufferp + pagesize * 2, pagesize * 2) == -1) 195 len = write(fd, buffer, 2 * pagesize); 213 pagesize = getpagesize();
|
/freebsd/contrib/llvm-project/compiler-rt/lib/gwp_asan/platform_specific/ |
H A D | guarded_pool_allocator_fuchsia.cpp | 24 assert((Size % State.PageSize) == 0); in map() 39 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in unmap() 40 assert((Size % State.PageSize) == 0); in unmap() 47 assert((Size % State.PageSize) == 0); in reserveGuardedPool() 68 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in allocateInGuardedPool() 69 assert((Size % State.PageSize) == 0); in allocateInGuardedPool() 90 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in deallocateInGuardedPool() 91 assert((Size % State.PageSize) == 0); in deallocateInGuardedPool()
|
H A D | guarded_pool_allocator_posix.cpp | 46 assert((Size % State.PageSize) == 0); in map() 55 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in unmap() 56 assert((Size % State.PageSize) == 0); in unmap() 62 assert((Size % State.PageSize) == 0); in reserveGuardedPool() 76 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in allocateInGuardedPool() 77 assert((Size % State.PageSize) == 0); in allocateInGuardedPool() 85 assert((reinterpret_cast<uintptr_t>(Ptr) % State.PageSize) == 0); in deallocateInGuardedPool() 86 assert((Size % State.PageSize) == 0); in deallocateInGuardedPool()
|
/freebsd/crypto/heimdal/lib/roken/ |
H A D | test-mem.c | 114 size_t pagesize = getpagesize(); in rk_test_mem_alloc() 132 map.size = size + pagesize - (size % pagesize) + pagesize * 2; in rk_test_mem_alloc() 141 ret = mprotect ((void *)p, pagesize, 0); in rk_test_mem_alloc() 145 ret = mprotect (p + map.size - pagesize, pagesize, 0); in rk_test_mem_alloc() 151 map.data_start = p + map.size - pagesize - size; in rk_test_mem_alloc() 154 map.data_start = p + pagesize; in rk_test_mem_alloc()
|
/freebsd/contrib/llvm-project/llvm/lib/Support/Unix/ |
H A D | Memory.inc | 108 static const size_t PageSize = Process::getPageSizeEstimate(); 109 const size_t NumPages = (NumBytes + PageSize - 1) / PageSize; 111 if (Start && Start % PageSize) 112 Start += PageSize - Start % PageSize; 115 void *Addr = ::mmap(reinterpret_cast<void *>(Start), PageSize * NumPages, 138 Result.AllocatedSize = PageSize * NumPages; 166 static const Align PageSize = Align(Process::getPageSizeEstimate()); 175 alignAddr((const uint8_t *)M.Address - PageSize.value() + 1, PageSize); 177 alignAddr((const uint8_t *)M.Address + M.AllocatedSize, PageSize);
|
/freebsd/tools/regression/mlock/ |
H A D | mlock.c | 49 int pagesize; in main() local 64 pagesize = getpagesize(); in main() 65 page = mmap(NULL, pagesize, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0); in main() 69 if (mlock(page, pagesize) < 0) in main() 72 if (munlock(page, pagesize) < 0) in main() 78 if (mlock(page, pagesize) == 0) in main() 83 if (munlock(page, pagesize) == 0) in main()
|
/freebsd/contrib/netbsd-tests/fs/tmpfs/ |
H A D | t_statvfs.sh | 43 pagesize=$(sysctl -n hw.pagesize) 46 pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3) 51 [ ${pagesize} -eq ${f_bsize} ] || \ 56 $((10 * 1024 * 1024 + ${pagesize})) ] || \
|
/freebsd/contrib/llvm-project/compiler-rt/lib/xray/ |
H A D | xray_interface.cpp | 106 std::size_t PageSize) XRAY_NEVER_INSTRUMENT in MProtectHelper() argument 111 MProtectLen = RoundUpTo(MProtectLen, PageSize); in MProtectHelper() 311 const size_t PageSize = flags()->xray_page_size_override > 0 in controlPatching() local 314 if ((PageSize == 0) || ((PageSize & (PageSize - 1)) != 0)) { in controlPatching() 315 Report("System page size is not a power of two: %zu\n", PageSize); in controlPatching() 320 reinterpret_cast<void *>(MinSled->address() & ~(PageSize - 1)); in controlPatching() 324 MProtectHelper Protector(PageAlignedAddr, MProtectLen, PageSize); in controlPatching() 362 const size_t PageSize = flags()->xray_page_size_override > 0 in mprotectAndPatchFunction() local 365 if ((PageSize == 0) || ((PageSize & (PageSize - 1)) != 0)) { in mprotectAndPatchFunction() 366 Report("Provided page size is not a power of two: %zu\n", PageSize); in mprotectAndPatchFunction() [all …]
|
/freebsd/lib/libsys/ |
H A D | getpagesizes.c | 38 * "pagesize" is NULL and "nelem" is 0. Otherwise, assigns up to "nelem" of 40 * referenced by "pagesize", and returns the number of such page sizes that it 48 getpagesizes(size_t pagesize[], int nelem) in getpagesizes() argument 54 if (nelem < 0 || (nelem > 0 && pagesize == NULL)) { in getpagesizes() 67 if (pagesize == NULL) in getpagesizes() 73 pagesize[i] = ps[i]; in getpagesizes()
|
/freebsd/sys/contrib/openzfs/module/os/freebsd/zfs/ |
H A D | dmu_os.c | 90 ASSERT3U(db->db_size, >=, PAGESIZE); in dmu_write_pages() 109 for (copied = 0; copied < tocpy; copied += PAGESIZE) { in dmu_write_pages() 112 thiscpy = MIN(PAGESIZE, tocpy - copied); in dmu_write_pages() 118 bufoff += PAGESIZE; in dmu_write_pages() 185 memcpy(va, (char *)db->db_data + bufoff, PAGESIZE); in dmu_read_pages() 222 tocpy = MIN(db->db_size - bufoff, PAGESIZE - pgoff); in dmu_read_pages() 231 ASSERT3S(pgoff, <=, PAGESIZE); in dmu_read_pages() 232 if (pgoff == PAGESIZE) { in dmu_read_pages() 283 memset(va + pgoff, 0, PAGESIZE - pgoff); in dmu_read_pages() 303 tocpy = MIN(db->db_size - bufoff, PAGESIZE); in dmu_read_pages() [all …]
|
/freebsd/lib/libusbhid/ |
H A D | usage.c | 52 int pagesize, pagesizemax; member 64 for (j = 0; j < pages[i].pagesize; j++) { in dump_hid_table() 112 if (curpage->pagesize >= curpage->pagesizemax) { in hid_init() 121 curpage->page_contents[curpage->pagesize].name = n; in hid_init() 122 curpage->page_contents[curpage->pagesize].usage = no; in hid_init() 123 curpage->pagesize++; in hid_init() 142 curpage->pagesize = 0; in hid_init() 186 for (j = 0; j < pages[k].pagesize; j++) { in hid_usage_in_page() 234 for (j = 0; j < pages[k].pagesize; j++) in hid_parse_usage_in_page()
|
/freebsd/lib/libc/db/mpool/ |
H A D | mpool.c | 59 mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache) in mpool_open() argument 85 mp->npages = sb.st_size / pagesize; in mpool_open() 86 mp->pagesize = pagesize; in mpool_open() 215 off = mp->pagesize * pgno; in mpool_get() 216 if ((nr = pread(mp->fd, bp->page, mp->pagesize, off)) != (ssize_t)mp->pagesize) { in mpool_get() 228 memset(bp->page, 0, mp->pagesize); in mpool_get() 366 memset(bp, 0xff, sizeof(BKT) + mp->pagesize); in mpool_bkt() 374 new: if ((bp = (BKT *)calloc(1, sizeof(BKT) + mp->pagesize)) == NULL) in mpool_bkt() 402 off = mp->pagesize * bp->pgno; in mpool_write() 403 if (pwrite(mp->fd, bp->page, mp->pagesize, off) != (ssize_t)mp->pagesize) in mpool_write() [all …]
|