vm-data1.c 547 B

123456789101112131415161718192021222324252627282930313233
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define PAGE_SIZE (4096)
  4. #define PAGES (128)
  5. #define SIZE (PAGE_SIZE * PAGES / sizeof(int))
  6. #define NUM_REFS (5)
  7. // unsigned int array[SIZE] = {0};
  8. unsigned int array[SIZE];
  9. int
  10. main()
  11. {
  12. unsigned int i = 0;
  13. unsigned int refs = 0;
  14. for (refs = 0; refs < NUM_REFS-1; refs++) {
  15. for (i=0; i<SIZE; i++) {
  16. array[i] = i;
  17. }
  18. }
  19. for (i=0; i<SIZE; i++) {
  20. if (array[i] != i) {
  21. printf("FAILED array[%d] = %u != %d\n", i, array[i], i);
  22. exit(1);
  23. }
  24. }
  25. printf("SUCCEEDED\n");
  26. exit(0);
  27. }