Changeset 99c2c69e in mainline for kernel/test/mm/falloc2.c
- Timestamp:
- 2013-09-13T00:36:30Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67fbd5e
- Parents:
- 7f84430 (diff), 11d41be5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc2.c
r7f84430 r99c2c69e 40 40 #include <arch.h> 41 41 42 #define MAX_FRAMES 256U 43 #define MAX_ORDER 8 42 #define MAX_FRAMES 256 44 43 45 44 #define THREAD_RUNS 1 … … 53 52 uint8_t val = THREAD->tid % THREADS; 54 53 55 void **frames = (void **)56 malloc(MAX_FRAMES * sizeof( void *), FRAME_ATOMIC);54 uintptr_t *frames = (uintptr_t *) 55 malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC); 57 56 if (frames == NULL) { 58 57 TPRINTF("Thread #%" PRIu64 " (cpu%u): " … … 66 65 67 66 for (unsigned int run = 0; run < THREAD_RUNS; run++) { 68 for (unsigned int order = 0; order <= MAX_ORDER; order++) { 67 for (size_t count = 1; count <= MAX_FRAMES; count++) { 68 size_t bytes = FRAMES2SIZE(count); 69 69 70 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 70 "Allocating % u frames blocks... \n", THREAD->tid,71 CPU->id, 1 << order);71 "Allocating %zu frames blocks (%zu bytes) ... \n", THREAD->tid, 72 CPU->id, count, bytes); 72 73 73 74 unsigned int allocated = 0; 74 for (unsigned int i = 0; i < (MAX_FRAMES >> order); i++) { 75 frames[allocated] = 76 frame_alloc(order, FRAME_ATOMIC | FRAME_KA); 75 for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) { 76 frames[allocated] = frame_alloc(count, FRAME_ATOMIC, 0); 77 77 if (frames[allocated]) { 78 memsetb( frames[allocated], FRAME_SIZE << order, val);78 memsetb((void *) PA2KA(frames[allocated]), bytes, val); 79 79 allocated++; 80 80 } else … … 89 89 90 90 for (unsigned int i = 0; i < allocated; i++) { 91 for (size_t k = 0; k <= (((size_t) FRAME_SIZE << order) - 1); 92 k++) { 93 if (((uint8_t *) frames[i])[k] != val) { 91 for (size_t k = 0; k < bytes; k++) { 92 if (((uint8_t *) PA2KA(frames[i]))[k] != val) { 94 93 TPRINTF("Thread #%" PRIu64 " (cpu%u): " 95 "Unexpected data (%c) in block % poffset %zu\n",96 THREAD->tid, CPU->id, ((char *) frames[i])[k],94 "Unexpected data (%c) in block %zu offset %zu\n", 95 THREAD->tid, CPU->id, ((char *) PA2KA(frames[i]))[k], 97 96 frames[i], k); 98 97 atomic_inc(&thread_fail); … … 100 99 } 101 100 } 102 frame_free( KA2PA(frames[i]));101 frame_free(frames[i], count); 103 102 } 104 103
Note:
See TracChangeset
for help on using the changeset viewer.