/kernel/trunk/test/mm/falloc1/test.c |
---|
40,7 → 40,7 |
#define TEST_RUNS 2 |
void test(void) { |
uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES*sizeof(uintptr_t), 0); |
__address * frames = (__address *) malloc(MAX_FRAMES*sizeof(__address), 0); |
int results[MAX_ORDER+1]; |
int i, order, run; |
54,7 → 54,7 |
printf("Allocating %d frames blocks ... ", 1 << order); |
allocated = 0; |
for (i = 0; i < MAX_FRAMES >> order; i++) { |
frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
frames[allocated] = (__address) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
panic("Test failed. Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
/kernel/trunk/test/mm/falloc2/test.c |
---|
52,10 → 52,10 |
void falloc(void * arg) |
{ |
int order, run, allocated, i; |
uint8_t val = THREAD->tid % THREADS; |
__u8 val = THREAD->tid % THREADS; |
index_t k; |
uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC); |
__address * frames = (__address *) malloc(MAX_FRAMES * sizeof(__address), FRAME_ATOMIC); |
ASSERT(frames != NULL); |
thread_detach(THREAD); |
65,7 → 65,7 |
printf("Thread #%d (cpu%d): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order); |
allocated = 0; |
for (i = 0; i < (MAX_FRAMES >> order); i++) { |
frames[allocated] = (uintptr_t)frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
frames[allocated] = (__address)frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
if (frames[allocated]) { |
memsetb(frames[allocated], FRAME_SIZE << order, val); |
allocated++; |
78,7 → 78,7 |
printf("Thread #%d (cpu%d): Deallocating ... \n", THREAD->tid, CPU->id); |
for (i = 0; i < allocated; i++) { |
for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { |
if (((uint8_t *) frames[i])[k] != val) { |
if (((__u8 *) frames[i])[k] != val) { |
printf("Thread #%d (cpu%d): Unexpected data (%d) in block %p offset %#zx\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); |
failed(); |
} |
/kernel/trunk/test/mm/mapping1/test.c |
---|
42,8 → 42,8 |
void test(void) |
{ |
uintptr_t frame0, frame1; |
uint32_t v0, v1; |
__address frame0, frame1; |
__u32 v0, v1; |
printf("Memory management test mapping #1\n"); |
51,9 → 51,9 |
frame1 = frame_alloc(ONE_FRAME, FRAME_KA); |
printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0)); |
*((uint32_t *) frame0) = VALUE0; |
*((__u32 *) frame0) = VALUE0; |
printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1)); |
*((uint32_t *) frame1) = VALUE1; |
*((__u32 *) frame1) = VALUE1; |
printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0)); |
page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE); |
60,22 → 60,22 |
printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1)); |
page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE); |
printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((uint32_t *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((uint32_t *) PAGE1)); |
printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((__u32 *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((__u32 *) PAGE1)); |
ASSERT(v0 == VALUE0); |
ASSERT(v1 == VALUE1); |
printf("Writing %#x to virtual address %p.\n", 0, PAGE0); |
*((uint32_t *) PAGE0) = 0; |
*((__u32 *) PAGE0) = 0; |
printf("Writing %#x to virtual address %p.\n", 0, PAGE1); |
*((uint32_t *) PAGE1) = 0; |
*((__u32 *) PAGE1) = 0; |
v0 = *((uint32_t *) PAGE0); |
v1 = *((uint32_t *) PAGE1); |
v0 = *((__u32 *) PAGE0); |
v1 = *((__u32 *) PAGE1); |
printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1)); |
printf("Value at virtual address %p is %#x.\n", PAGE0, *((__u32 *) PAGE0)); |
printf("Value at virtual address %p is %#x.\n", PAGE1, *((__u32 *) PAGE1)); |
ASSERT(v0 == 0); |
ASSERT(v1 == 0); |
/kernel/trunk/test/mm/slab2/test.c |
---|
67,8 → 67,8 |
slab_free(cache2,data2); |
break; |
} |
memsetb((uintptr_t)data1, ITEM_SIZE, 0); |
memsetb((uintptr_t)data2, ITEM_SIZE, 0); |
memsetb((__address)data1, ITEM_SIZE, 0); |
memsetb((__address)data2, ITEM_SIZE, 0); |
*((void **)data1) = olddata1; |
*((void **)data2) = olddata2; |
olddata1 = data1; |
90,7 → 90,7 |
if (!data1) { |
panic("Incorrect memory size - use another test."); |
} |
memsetb((uintptr_t)data1, ITEM_SIZE, 0); |
memsetb((__address)data1, ITEM_SIZE, 0); |
*((void **)data1) = olddata1; |
olddata1 = data1; |
} |
99,7 → 99,7 |
if (!data1) { |
break; |
} |
memsetb((uintptr_t)data1, ITEM_SIZE, 0); |
memsetb((__address)data1, ITEM_SIZE, 0); |
*((void **)data1) = olddata1; |
olddata1 = data1; |
} |
/kernel/trunk/test/mm/slab1/test.c |
---|
49,7 → 49,7 |
printf("Allocating %d items...", count); |
for (i=0; i < count; i++) { |
data[i] = slab_alloc(cache, 0); |
memsetb((uintptr_t)data[i], size, 0); |
memsetb((__address)data[i], size, 0); |
} |
printf("done.\n"); |
printf("Freeing %d items...", count); |
61,7 → 61,7 |
printf("Allocating %d items...", count); |
for (i=0; i < count; i++) { |
data[i] = slab_alloc(cache, 0); |
memsetb((uintptr_t)data[i], size, 0); |
memsetb((__address)data[i], size, 0); |
} |
printf("done.\n"); |
74,7 → 74,7 |
printf("Allocating %d items...", count/2); |
for (i=count/2; i < count; i++) { |
data[i] = slab_alloc(cache, 0); |
memsetb((uintptr_t)data[i], size, 0); |
memsetb((__address)data[i], size, 0); |
} |
printf("done.\n"); |
printf("Freeing %d items...", count); |
110,7 → 110,7 |
static void slabtest(void *data) |
{ |
int offs = (int)(unative_t) data; |
int offs = (int)(__native) data; |
int i,j; |
thread_detach(THREAD); |
140,7 → 140,7 |
SLAB_CACHE_NOMAGAZINE); |
semaphore_initialize(&thr_sem,0); |
for (i=0; i<THREADS; i++) { |
if (!(t = thread_create(slabtest, (void *)(unative_t)i, TASK, 0, "slabtest"))) |
if (!(t = thread_create(slabtest, (void *)(__native)i, TASK, 0, "slabtest"))) |
panic("could not create thread\n"); |
thread_ready(t); |
} |
/kernel/trunk/test/mm/purge1/test.c |
---|
37,7 → 37,7 |
extern void tlb_invalidate_all(void); |
extern void tlb_invalidate_pages(asid_t asid, uintptr_t va, count_t cnt); |
extern void tlb_invalidate_pages(asid_t asid, __address va, count_t cnt); |
void test(void) |
{ |
tlb_entry_t entryi; |