Rev 2050 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2050 | Rev 2053 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | if (frames == NULL) |
53 | if (frames == NULL) |
54 | return "Unable to allocate frames"; |
54 | return "Unable to allocate frames"; |
55 | 55 | ||
56 | for (run = 0; run < TEST_RUNS; run++) { |
56 | for (run = 0; run < TEST_RUNS; run++) { |
57 | for (order = 0; order <= MAX_ORDER; order++) { |
57 | for (order = 0; order <= MAX_ORDER; order++) { |
- | 58 | if (!quiet) |
|
58 | printf("Allocating %d frames blocks ... ", 1 << order); |
59 | printf("Allocating %d frames blocks ... ", 1 << order); |
- | 60 | ||
59 | allocated = 0; |
61 | allocated = 0; |
60 | for (i = 0; i < MAX_FRAMES >> order; i++) { |
62 | for (i = 0; i < MAX_FRAMES >> order; i++) { |
61 | frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
63 | frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
62 | 64 | ||
63 | if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
65 | if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
- | 66 | if (!quiet) |
|
64 | printf("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
67 | printf("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
65 | return "Test failed"; |
68 | return "Test failed"; |
66 | } |
69 | } |
67 | 70 | ||
68 | if (frames[allocated]) |
71 | if (frames[allocated]) |
69 | allocated++; |
72 | allocated++; |
70 | else { |
73 | else { |
- | 74 | if (!quiet) |
|
71 | printf("done. "); |
75 | printf("done. "); |
72 | break; |
76 | break; |
73 | } |
77 | } |
74 | } |
78 | } |
75 | 79 | ||
- | 80 | if (!quiet) |
|
76 | printf("%d blocks allocated.\n", allocated); |
81 | printf("%d blocks allocated.\n", allocated); |
77 | 82 | ||
78 | if (run) { |
83 | if (run) { |
79 | if (results[order] != allocated) |
84 | if (results[order] != allocated) |
80 | return "Possible frame leak"; |
85 | return "Possible frame leak"; |
81 | } else |
86 | } else |
82 | results[order] = allocated; |
87 | results[order] = allocated; |
83 | 88 | ||
- | 89 | if (!quiet) |
|
84 | printf("Deallocating ... "); |
90 | printf("Deallocating ... "); |
- | 91 | ||
85 | for (i = 0; i < allocated; i++) |
92 | for (i = 0; i < allocated; i++) |
86 | frame_free(KA2PA(frames[i])); |
93 | frame_free(KA2PA(frames[i])); |
- | 94 | ||
- | 95 | if (!quiet) |
|
87 | printf("done.\n"); |
96 | printf("done.\n"); |
88 | } |
97 | } |
89 | } |
98 | } |
90 | 99 | ||
91 | free(frames); |
100 | free(frames); |
92 | 101 |