Lines Matching refs:ptr

41 	void		*ptr;  member
133 cmd.addr = (__u64)buffer->ptr; in hmm_dmirror_cmd()
134 cmd.ptr = (__u64)buffer->mirror; in hmm_dmirror_cmd()
156 if (buffer->ptr) in hmm_buffer_free()
157 munmap(buffer->ptr, buffer->size); in hmm_buffer_free()
230 int *ptr; in TEST_F() local
246 buffer->ptr = mmap(NULL, size, in TEST_F()
250 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
256 i = 2 * self->page_size / sizeof(*ptr); in TEST_F()
257 for (ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
258 ptr[i] = i; in TEST_F()
261 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
265 val = *(int *)(buffer->ptr + self->page_size); in TEST_F()
275 ptr = buffer->mirror; in TEST_F()
276 for (i = 0; i < 2 * self->page_size / sizeof(*ptr); ++i) in TEST_F()
277 ASSERT_EQ(ptr[i], 0); in TEST_F()
278 for (; i < size / sizeof(*ptr); ++i) in TEST_F()
279 ASSERT_EQ(ptr[i], i); in TEST_F()
294 int *ptr; in TEST_F() local
309 buffer->ptr = mmap(NULL, size, in TEST_F()
313 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
316 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
317 ptr[i] = i; in TEST_F()
320 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
321 ptr[i] = -i; in TEST_F()
324 ret = mprotect(buffer->ptr, size, PROT_NONE); in TEST_F()
332 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
334 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
335 ASSERT_EQ(ptr[i], i); in TEST_F()
338 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
339 ASSERT_EQ(ptr[i], -i); in TEST_F()
353 int *ptr; in TEST_F() local
368 buffer->ptr = mmap(NULL, size, in TEST_F()
372 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
375 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
376 ptr[i] = i; in TEST_F()
385 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
386 ASSERT_EQ(ptr[i], i); in TEST_F()
401 int *ptr; in TEST_F() local
416 buffer->ptr = mmap(NULL, size, in TEST_F()
420 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
429 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
430 ptr[i] = i; in TEST_F()
437 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
438 ASSERT_EQ(ptr[i], 0); in TEST_F()
441 ret = mprotect(buffer->ptr, size, PROT_WRITE | PROT_READ); in TEST_F()
451 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
452 ASSERT_EQ(ptr[i], i); in TEST_F()
467 int *ptr; in TEST_F() local
484 buffer->ptr = mmap(NULL, size, in TEST_F()
488 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
491 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
492 ptr[i] = i; in TEST_F()
495 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
496 ptr[i] = -i; in TEST_F()
506 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
507 ASSERT_EQ(ptr[i], i); in TEST_F()
512 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
513 ASSERT_EQ(ptr[i], i); in TEST_F()
514 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
515 ASSERT_EQ(ptr[i], -i); in TEST_F()
528 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
529 ASSERT_EQ(ptr[i], -i); in TEST_F()
545 int *ptr; in TEST_F() local
562 buffer->ptr = mmap(NULL, size, in TEST_F()
566 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
569 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
570 ptr[i] = i; in TEST_F()
573 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
574 ptr[i] = -i; in TEST_F()
584 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
585 ASSERT_EQ(ptr[i], -i); in TEST_F()
590 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
591 ASSERT_EQ(ptr[i], i); in TEST_F()
592 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
593 ASSERT_EQ(ptr[i], -i); in TEST_F()
606 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
607 ASSERT_EQ(ptr[i], -i); in TEST_F()
624 int *ptr; in TEST_F() local
637 buffer->ptr = mmap(NULL, size, in TEST_F()
641 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
645 map = (void *)ALIGN((uintptr_t)buffer->ptr, size); in TEST_F()
648 old_ptr = buffer->ptr; in TEST_F()
649 buffer->ptr = map; in TEST_F()
652 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
653 ptr[i] = i; in TEST_F()
662 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
663 ASSERT_EQ(ptr[i], i); in TEST_F()
665 buffer->ptr = old_ptr; in TEST_F()
679 int *ptr; in TEST_F() local
699 buffer->ptr = get_hugepage_region(size, GHR_STRICT); in TEST_F()
700 if (buffer->ptr == NULL) { in TEST_F()
711 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
712 ptr[i] = i; in TEST_F()
721 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
722 ASSERT_EQ(ptr[i], i); in TEST_F()
724 free_hugepage_region(buffer->ptr); in TEST_F()
725 buffer->ptr = NULL; in TEST_F()
739 int *ptr; in TEST_F() local
760 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
761 ptr[i] = i; in TEST_F()
766 buffer->ptr = mmap(NULL, size, in TEST_F()
770 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
779 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
780 ASSERT_EQ(ptr[i], i); in TEST_F()
794 int *ptr; in TEST_F() local
814 buffer->ptr = mmap(NULL, size, in TEST_F()
818 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
821 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
822 ptr[i] = i; in TEST_F()
831 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
832 ASSERT_EQ(ptr[i], i); in TEST_F()
837 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
838 ASSERT_EQ(ptr[i], i); in TEST_F()
852 int *ptr; in TEST_F() local
867 buffer->ptr = mmap(NULL, size, in TEST_F()
871 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
874 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
875 ptr[i] = i; in TEST_F()
883 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
884 ASSERT_EQ(ptr[i], i); in TEST_F()
900 int *ptr; in TEST_F() local
915 buffer->ptr = mmap(NULL, size, in TEST_F()
919 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
922 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
923 ptr[i] = i; in TEST_F()
931 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
932 ASSERT_EQ(ptr[i], i); in TEST_F()
935 for (i = 0, ptr = buffer->ptr; i < size / (2 * sizeof(*ptr)); ++i) in TEST_F()
936 ASSERT_EQ(ptr[i], i); in TEST_F()
944 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
945 ASSERT_EQ(ptr[i], i); in TEST_F()
972 buffer->ptr = mmap(NULL, size, in TEST_F()
976 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
993 int *ptr; in TEST_F() local
1010 buffer->ptr = mmap(NULL, size, in TEST_F()
1014 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1015 p = buffer->ptr; in TEST_F()
1022 ret = munmap(buffer->ptr + self->page_size, self->page_size); in TEST_F()
1030 ret = mprotect(buffer->ptr + 2 * self->page_size, self->page_size, in TEST_F()
1033 ptr = (int *)(buffer->ptr + 2 * self->page_size); in TEST_F()
1034 val = *ptr + 3; in TEST_F()
1038 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1041 ptr = (int *)(buffer->ptr + 3 * self->page_size); in TEST_F()
1042 *ptr = val; in TEST_F()
1043 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1048 ret = mprotect(buffer->ptr + 4 * self->page_size, 2 * self->page_size, in TEST_F()
1051 ptr = (int *)(buffer->ptr + 4 * self->page_size); in TEST_F()
1052 *ptr = val; in TEST_F()
1053 ptr = (int *)(buffer->ptr + 5 * self->page_size); in TEST_F()
1054 *ptr = val; in TEST_F()
1057 buffer->ptr = p + 2 * self->page_size; in TEST_F()
1063 buffer->ptr = p + 5 * self->page_size; in TEST_F()
1066 buffer->ptr = p; in TEST_F()
1068 buffer->ptr = p; in TEST_F()
1083 int *ptr; in TEST_F() local
1099 buffer->ptr = mmap(NULL, size, in TEST_F()
1103 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1106 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1107 ptr[i] = i; in TEST_F()
1116 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1117 ASSERT_EQ(ptr[i], i); in TEST_F()
1120 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1121 ASSERT_EQ(ptr[i], i); in TEST_F()
1137 int *ptr; in TEST_F() local
1153 buffer->ptr = mmap(NULL, size, in TEST_F()
1157 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1160 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1161 ptr[i] = i + c; in TEST_F()
1171 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1172 ASSERT_EQ(ptr[i], i + c); in TEST_F()
1184 munmap(buffer->ptr + buffer->size / 2, buffer->size / 2); in unmap_buffer()
1185 buffer->ptr = NULL; in unmap_buffer()
1208 int *ptr; in TEST_F() local
1219 buffer->ptr = mmap(NULL, size, in TEST_F()
1223 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1226 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1227 ptr[i] = i + c; in TEST_F()
1240 for (i = 0, ptr = buffer->mirror; in TEST_F()
1241 i < size / sizeof(*ptr); in TEST_F()
1243 ASSERT_EQ(ptr[i], i + c); in TEST_F()
1275 buffer->ptr = mmap(NULL, size, in TEST_F()
1279 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1301 int *ptr; in TEST_F() local
1319 buffer->ptr = mmap(NULL, size, in TEST_F()
1323 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1324 p = buffer->ptr; in TEST_F()
1327 ret = munmap(buffer->ptr + self->page_size, self->page_size); in TEST_F()
1331 ret = mprotect(buffer->ptr + 2 * self->page_size, self->page_size, in TEST_F()
1334 ptr = (int *)(buffer->ptr + 2 * self->page_size); in TEST_F()
1335 val = *ptr + 3; in TEST_F()
1339 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1342 ptr = (int *)(buffer->ptr + 3 * self->page_size); in TEST_F()
1343 *ptr = val; in TEST_F()
1344 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1349 ret = mprotect(buffer->ptr + 4 * self->page_size, 3 * self->page_size, in TEST_F()
1352 ptr = (int *)(buffer->ptr + 4 * self->page_size); in TEST_F()
1353 *ptr = val; in TEST_F()
1356 buffer->ptr = p + 5 * self->page_size; in TEST_F()
1362 buffer->ptr = p + 6 * self->page_size; in TEST_F()
1368 buffer->ptr = p; in TEST_F()
1397 int *ptr; in TEST_F() local
1419 buffer->ptr = get_hugepage_region(size, GHR_STRICT); in TEST_F()
1420 if (buffer->ptr == NULL) { in TEST_F()
1430 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1431 ptr[i] = i; in TEST_F()
1445 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
1459 free_hugepage_region(buffer->ptr); in TEST_F()
1460 buffer->ptr = NULL; in TEST_F()
1474 int *ptr; in TEST_F() local
1489 buffer->ptr = mmap(NULL, size, in TEST_F()
1493 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1496 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1497 ptr[i] = i; in TEST_F()
1500 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
1510 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1511 ASSERT_EQ(ptr[i], i); in TEST_F()
1520 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1521 ASSERT_EQ(ptr[i], i); in TEST_F()
1524 ret = munmap(buffer->ptr + self->page_size, self->page_size); in TEST_F()
1539 int *ptr; in TEST_F() local
1554 buffer->ptr = mmap(NULL, size, in TEST_F()
1558 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1561 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1562 ptr[i] = i; in TEST_F()
1570 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1571 ASSERT_EQ(ptr[i], i); in TEST_F()
1574 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1575 ASSERT_EQ(ptr[i]++, i); in TEST_F()
1577 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1578 ASSERT_EQ(ptr[i], i+1); in TEST_F()
1593 int *ptr; in TEST_F() local
1608 buffer->ptr = mmap(NULL, size, in TEST_F()
1612 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1615 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1616 ptr[i] = i; in TEST_F()
1624 for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i) in TEST_F()
1625 ASSERT_EQ(ptr[i], i); in TEST_F()
1627 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
1646 int *ptr; in TEST_F() local
1661 buffer->ptr = mmap(NULL, size, in TEST_F()
1665 ASSERT_NE(buffer->ptr, MAP_FAILED); in TEST_F()
1668 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1669 ptr[i] = i; in TEST_F()
1679 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1680 ASSERT_EQ(ptr[i]++, i); in TEST_F()
1682 for (i = 0, ptr = buffer->ptr; i < size / sizeof(*ptr); ++i) in TEST_F()
1683 ASSERT_EQ(ptr[i], i+1); in TEST_F()