Rev 762 | Rev 814 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 762 | Rev 786 | ||
|---|---|---|---|
| Line 58... | Line 58... | ||
| 58 | __address * frames = (__address *) malloc(MAX_FRAMES * sizeof(__address)); |
58 | __address * frames = (__address *) malloc(MAX_FRAMES * sizeof(__address)); |
| 59 | ASSERT(frames != NULL); |
59 | ASSERT(frames != NULL); |
| 60 | 60 | ||
| 61 | for (run = 0; run < THREAD_RUNS; run++) { |
61 | for (run = 0; run < THREAD_RUNS; run++) { |
| 62 | for (order = 0; order <= MAX_ORDER; order++) { |
62 | for (order = 0; order <= MAX_ORDER; order++) { |
| 63 | printf("Thread #%d: Allocating %d frames blocks ... \n", THREAD->tid, 1 << order); |
63 | printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order); |
| 64 | allocated = 0; |
64 | allocated = 0; |
| 65 | for (i = 0; i < (MAX_FRAMES >> order); i++) { |
65 | for (i = 0; i < (MAX_FRAMES >> order); i++) { |
| 66 | frames[allocated] = frame_alloc(FRAME_ATOMIC | FRAME_KA, order, &status, NULL); |
66 | frames[allocated] = frame_alloc_rc(order, FRAME_ATOMIC | FRAME_KA, &status); |
| 67 | if (status == 0) { |
67 | if (status == 0) { |
| 68 | memsetb(frames[allocated], FRAME_SIZE << order, val); |
68 | memsetb(frames[allocated], FRAME_SIZE << order, val); |
| 69 | allocated++; |
69 | allocated++; |
| 70 | } else { |
70 | } else { |
| 71 | break; |
71 | break; |
| 72 | } |
72 | } |
| 73 | } |
73 | } |
| 74 | printf("Thread #%d: %d blocks allocated.\n", THREAD->tid, allocated); |
74 | printf("Thread #%d (cpu%d): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated); |
| 75 | 75 | ||
| 76 | printf("Thread #%d: Deallocating ... \n", THREAD->tid); |
76 | printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id); |
| 77 | for (i = 0; i < allocated; i++) { |
77 | for (i = 0; i < allocated; i++) { |
| 78 | for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { |
78 | for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { |
| 79 | if (((__u8 *) frames[i])[k] != val) { |
79 | if (((__u8 *) frames[i])[k] != val) { |
| 80 | printf("Thread #%d: Unexpected data (%d) in block %P offset %X\n", THREAD->tid, ((char *) frames[i])[k], frames[i], k); |
80 | printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset %X\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); |
| 81 | failed(); |
81 | failed(); |
| 82 | } |
82 | } |
| 83 | } |
83 | } |
| 84 | frame_free(frames[i]); |
84 | frame_free(frames[i]); |
| 85 | } |
85 | } |
| 86 | printf("Thread #%d: Finished run.\n", val); |
86 | printf("Thread #%d (cpu%d): Finished run.\n", THREAD->tid, CPU->id); |
| 87 | } |
87 | } |
| 88 | } |
88 | } |
| 89 | 89 | ||
| 90 | free(frames); |
90 | free(frames); |
| 91 | - | ||
| - | 91 | printf("Thread #%d (cpu%d): Exiting\n", THREAD->tid, CPU->id); |
|
| 92 | atomic_dec(&thread_count); |
92 | atomic_dec(&thread_count); |
| 93 | } |
93 | } |
| 94 | 94 | ||
| 95 | 95 | ||
| 96 | void failed(void) |
96 | void failed(void) |