Rev 724 | Rev 745 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 724 | Rev 735 | ||
|---|---|---|---|
| Line 27... | Line 27... | ||
| 27 | */ |
27 | */ |
| 28 | #include <print.h> |
28 | #include <print.h> |
| 29 | #include <test.h> |
29 | #include <test.h> |
| 30 | #include <mm/page.h> |
30 | #include <mm/page.h> |
| 31 | #include <mm/frame.h> |
31 | #include <mm/frame.h> |
| - | 32 | #include <mm/heap.h> |
|
| 32 | #include <arch/mm/page.h> |
33 | #include <arch/mm/page.h> |
| 33 | #include <arch/types.h> |
34 | #include <arch/types.h> |
| 34 | #include <debug.h> |
35 | #include <debug.h> |
| 35 | 36 | ||
| 36 | #define MAX_FRAMES 2048 |
37 | #define MAX_FRAMES 1024 |
| 37 | #define MAX_ORDER 8 |
38 | #define MAX_ORDER 8 |
| 38 | #define TEST_RUNS 4 |
39 | #define TEST_RUNS 2 |
| 39 | 40 | ||
| 40 | void test(void) { |
41 | void test(void) { |
| 41 | __address frames[MAX_FRAMES]; |
42 | __address * frames = (__address *) malloc(MAX_FRAMES*sizeof(__address)); |
| 42 | int results[MAX_ORDER+1]; |
43 | int results[MAX_ORDER+1]; |
| 43 | 44 | ||
| 44 | int i, order, run; |
45 | int i, order, run; |
| 45 | int allocated; |
46 | int allocated; |
| 46 | int status; |
47 | int status; |
| Line 50... | Line 51... | ||
| 50 | for (run=0;run<=TEST_RUNS;run++) { |
51 | for (run=0;run<=TEST_RUNS;run++) { |
| 51 | for (order=0;order<=MAX_ORDER;order++) { |
52 | for (order=0;order<=MAX_ORDER;order++) { |
| 52 | printf("Allocating %d frames blocks ... ", 1<<order); |
53 | printf("Allocating %d frames blocks ... ", 1<<order); |
| 53 | allocated = 0; |
54 | allocated = 0; |
| 54 | for (i=0;i<MAX_FRAMES>>order;i++) { |
55 | for (i=0;i<MAX_FRAMES>>order;i++) { |
| 55 | frames[allocated] = frame_alloc(FRAME_NON_BLOCKING, order, &status); |
56 | frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status); |
| 56 | 57 | ||
| 57 | if (frames[allocated] % (FRAME_SIZE << order) != 0) { |
58 | if (frames[allocated] % (FRAME_SIZE << order) != 0) { |
| 58 | panic("Test failed. Block at address %X (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
59 | panic("Test failed. Block at address %X (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
| 59 | } |
60 | } |
| 60 | 61 | ||
| Line 80... | Line 81... | ||
| 80 | } |
81 | } |
| 81 | printf("done.\n"); |
82 | printf("done.\n"); |
| 82 | } |
83 | } |
| 83 | } |
84 | } |
| 84 | 85 | ||
| 85 | 86 | free(frames); |
|
| 86 | 87 | ||
| 87 | printf("Test passed\n"); |
88 | printf("Test passed\n"); |
| 88 | } |
89 | } |
| 89 | 90 | ||