vm-stack1.c 413 B

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