Rev 1767 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1767 | Rev 1780 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #define MAX_FRAMES 1024 |
38 | #define MAX_FRAMES 1024 |
| 39 | #define MAX_ORDER 8 |
39 | #define MAX_ORDER 8 |
| 40 | #define TEST_RUNS 2 |
40 | #define TEST_RUNS 2 |
| 41 | 41 | ||
| 42 | void test(void) { |
42 | void test(void) { |
| 43 | __address * frames = (__address *) malloc(MAX_FRAMES*sizeof(__address), 0); |
43 | uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES*sizeof(uintptr_t), 0); |
| 44 | int results[MAX_ORDER+1]; |
44 | int results[MAX_ORDER+1]; |
| 45 | 45 | ||
| 46 | int i, order, run; |
46 | int i, order, run; |
| 47 | int allocated; |
47 | int allocated; |
| 48 | 48 | ||
| Line 52... | Line 52... | ||
| 52 | for (run = 0; run < TEST_RUNS; run++) { |
52 | for (run = 0; run < TEST_RUNS; run++) { |
| 53 | for (order = 0; order <= MAX_ORDER; order++) { |
53 | for (order = 0; order <= MAX_ORDER; order++) { |
| 54 | printf("Allocating %d frames blocks ... ", 1 << order); |
54 | printf("Allocating %d frames blocks ... ", 1 << order); |
| 55 | allocated = 0; |
55 | allocated = 0; |
| 56 | for (i = 0; i < MAX_FRAMES >> order; i++) { |
56 | for (i = 0; i < MAX_FRAMES >> order; i++) { |
| 57 | frames[allocated] = (__address) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
57 | frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
| 58 | 58 | ||
| 59 | if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
59 | if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
| 60 | panic("Test failed. Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
60 | panic("Test failed. Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
| 61 | } |
61 | } |
| 62 | 62 | ||