Changeset 7f1c620 in mainline for test


Ignore:
Timestamp:
2006-07-04T17:17:56Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0ffa3ef5
Parents:
991779c5
Message:

Replace old u?? types with respective C99 variants (e.g. uint32_t, int64_t, uintptr_t etc.).

Location:
test
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • test/fpu/fpu1/test.c

    r991779c5 r7f1c620  
    9696
    9797                if((int)(100000000*e)!=E_10e8)
    98                         panic("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8);
     98                        panic("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000*e),(unative_t) E_10e8);
    9999        }
    100100
    101         printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8);
     101        printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000*e),(unative_t) E_10e8);
    102102        atomic_inc(&threads_ok);
    103103}
     
    137137#ifdef __ia64_ARCH_H__
    138138                if((int)(1000000*pi)!=PI_10e8)
    139                         panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (1000000*pi),(__native) (PI_10e8/100));
     139                        panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000*pi),(unative_t) (PI_10e8/100));
    140140#else
    141141                if((int)(100000000*pi)!=PI_10e8)
    142                         panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);
     142                        panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000*pi),(unative_t) PI_10e8);
    143143#endif
    144144
    145145        }
    146146
    147         printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);
     147        printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000*pi),(unative_t) PI_10e8);
    148148        atomic_inc(&threads_ok);
    149149}
  • test/fpu/mips1/test.c

    r991779c5 r7f1c620  
    4848{
    4949        int i;
    50         int arg __attribute__((aligned(16))) = (int)((__native) data);
     50        int arg __attribute__((aligned(16))) = (int)((unative_t) data);
    5151        int after_arg __attribute__((aligned(16)));
    5252
     
    7878{
    7979        int i;
    80         int arg __attribute__((aligned(16))) = (int)((__native) data);
     80        int arg __attribute__((aligned(16))) = (int)((unative_t) data);
    8181        int after_arg __attribute__((aligned(16)));
    8282
     
    117117
    118118        for (i=0; i<THREADS/2; i++) { 
    119                 if (!(t = thread_create(testit1, (void *)((__native)i*2), TASK, 0, "testit1")))
     119                if (!(t = thread_create(testit1, (void *)((unative_t)i*2), TASK, 0, "testit1")))
    120120                        panic("could not create thread\n");
    121121                thread_ready(t);
    122                 if (!(t = thread_create(testit2, (void *)((__native)i*2+1), TASK, 0, "testit2")))
     122                if (!(t = thread_create(testit2, (void *)((unative_t)i*2+1), TASK, 0, "testit2")))
    123123                        panic("could not create thread\n");
    124124                thread_ready(t);
  • test/fpu/sse1/test.c

    r991779c5 r7f1c620  
    4848{
    4949        int i;
    50         int arg __attribute__((aligned(16))) = (int)((__native) data);
     50        int arg __attribute__((aligned(16))) = (int)((unative_t) data);
    5151        int after_arg __attribute__((aligned(16)));
    5252
     
    7878{
    7979        int i;
    80         int arg __attribute__((aligned(16))) = (int)((__native) data);
     80        int arg __attribute__((aligned(16))) = (int)((unative_t) data);
    8181        int after_arg __attribute__((aligned(16)));
    8282
     
    117117
    118118        for (i=0; i<THREADS/2; i++) { 
    119                 if (!(t = thread_create(testit1, (void *)((__native)i*2), TASK, 0, "testit1")))
     119                if (!(t = thread_create(testit1, (void *)((unative_t)i*2), TASK, 0, "testit1")))
    120120                        panic("could not create thread\n");
    121121                thread_ready(t);
    122                 if (!(t = thread_create(testit2, (void *)((__native)i*2+1), TASK, 0, "testit2")))
     122                if (!(t = thread_create(testit2, (void *)((unative_t)i*2+1), TASK, 0, "testit2")))
    123123                        panic("could not create thread\n");
    124124                thread_ready(t);
  • test/mm/falloc1/test.c

    r991779c5 r7f1c620  
    4141
    4242void 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);
    4444        int results[MAX_ORDER+1];
    4545       
     
    5555                        allocated = 0;
    5656                        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);
    5858                               
    5959                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
  • test/mm/falloc2/test.c

    r991779c5 r7f1c620  
    5353{
    5454        int order, run, allocated, i;
    55         __u8 val = THREAD->tid % THREADS;
     55        uint8_t val = THREAD->tid % THREADS;
    5656        index_t k;
    5757       
    58         __address * frames =  (__address *) malloc(MAX_FRAMES * sizeof(__address), FRAME_ATOMIC);
     58        uintptr_t * frames =  (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
    5959        ASSERT(frames != NULL);
    6060       
     
    6666                        allocated = 0;
    6767                        for (i = 0; i < (MAX_FRAMES >> order); i++) {
    68                                 frames[allocated] = (__address)frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
     68                                frames[allocated] = (uintptr_t)frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
    6969                                if (frames[allocated]) {
    7070                                        memsetb(frames[allocated], FRAME_SIZE << order, val);
     
    7979                        for (i = 0; i < allocated; i++) {
    8080                                for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) {
    81                                         if (((__u8 *) frames[i])[k] != val) {
     81                                        if (((uint8_t *) frames[i])[k] != val) {
    8282                                                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);
    8383                                                failed();
  • test/mm/mapping1/test.c

    r991779c5 r7f1c620  
    4343void test(void)
    4444{
    45         __address frame0, frame1;
    46         __u32 v0, v1;
     45        uintptr_t frame0, frame1;
     46        uint32_t v0, v1;
    4747
    4848        printf("Memory management test mapping #1\n");
     
    5252
    5353        printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
    54         *((__u32 *) frame0) = VALUE0;
     54        *((uint32_t *) frame0) = VALUE0;
    5555        printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
    56         *((__u32 *) frame1) = VALUE1;
     56        *((uint32_t *) frame1) = VALUE1;
    5757       
    5858        printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
     
    6161        page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
    6262       
    63         printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((__u32 *) PAGE0));
    64         printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((__u32 *) PAGE1));
     63        printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((uint32_t *) PAGE0));
     64        printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((uint32_t *) PAGE1));
    6565       
    6666        ASSERT(v0 == VALUE0);
     
    6868
    6969        printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
    70         *((__u32 *) PAGE0) = 0;
     70        *((uint32_t *) PAGE0) = 0;
    7171        printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
    72         *((__u32 *) PAGE1) = 0;
     72        *((uint32_t *) PAGE1) = 0;     
    7373
    74         v0 = *((__u32 *) PAGE0);
    75         v1 = *((__u32 *) PAGE1);
     74        v0 = *((uint32_t *) PAGE0);
     75        v1 = *((uint32_t *) PAGE1);
    7676       
    77         printf("Value at virtual address %p is %#x.\n", PAGE0, *((__u32 *) PAGE0));     
    78         printf("Value at virtual address %p is %#x.\n", PAGE1, *((__u32 *) PAGE1));
     77        printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); 
     78        printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
    7979
    8080        ASSERT(v0 == 0);
  • test/mm/purge1/test.c

    r991779c5 r7f1c620  
    3838
    3939extern void tlb_invalidate_all(void);
    40 extern void tlb_invalidate_pages(asid_t asid, __address va, count_t cnt);
     40extern void tlb_invalidate_pages(asid_t asid, uintptr_t va, count_t cnt);
    4141void test(void)
    4242{
  • test/mm/slab1/test.c

    r991779c5 r7f1c620  
    5050        for (i=0; i < count; i++) {
    5151                data[i] = slab_alloc(cache, 0);
    52                 memsetb((__address)data[i], size, 0);
     52                memsetb((uintptr_t)data[i], size, 0);
    5353        }
    5454        printf("done.\n");
     
    6262        for (i=0; i < count; i++) {
    6363                data[i] = slab_alloc(cache, 0);
    64                 memsetb((__address)data[i], size, 0);
     64                memsetb((uintptr_t)data[i], size, 0);
    6565        }
    6666        printf("done.\n");
     
    7575        for (i=count/2; i < count; i++) {
    7676                data[i] = slab_alloc(cache, 0);
    77                 memsetb((__address)data[i], size, 0);
     77                memsetb((uintptr_t)data[i], size, 0);
    7878        }
    7979        printf("done.\n");
     
    111111static void slabtest(void *data)
    112112{
    113         int offs = (int)(__native) data;
     113        int offs = (int)(unative_t) data;
    114114        int i,j;
    115115       
     
    141141        semaphore_initialize(&thr_sem,0);
    142142        for (i=0; i<THREADS; i++) { 
    143                 if (!(t = thread_create(slabtest, (void *)(__native)i, TASK, 0, "slabtest")))
     143                if (!(t = thread_create(slabtest, (void *)(unative_t)i, TASK, 0, "slabtest")))
    144144                        panic("could not create thread\n");
    145145                thread_ready(t);
  • test/mm/slab2/test.c

    r991779c5 r7f1c620  
    6868                        break;
    6969                }
    70                 memsetb((__address)data1, ITEM_SIZE, 0);
    71                 memsetb((__address)data2, ITEM_SIZE, 0);
     70                memsetb((uintptr_t)data1, ITEM_SIZE, 0);
     71                memsetb((uintptr_t)data2, ITEM_SIZE, 0);
    7272                *((void **)data1) = olddata1;
    7373                *((void **)data2) = olddata2;
     
    9191                        panic("Incorrect memory size - use another test.");
    9292                }
    93                 memsetb((__address)data1, ITEM_SIZE, 0);
     93                memsetb((uintptr_t)data1, ITEM_SIZE, 0);
    9494                *((void **)data1) = olddata1;
    9595                olddata1 = data1;
     
    100100                        break;
    101101                }
    102                 memsetb((__address)data1, ITEM_SIZE, 0);
     102                memsetb((uintptr_t)data1, ITEM_SIZE, 0);
    103103                *((void **)data1) = olddata1;
    104104                olddata1 = data1;
  • test/print/print1/test.c

    r991779c5 r7f1c620  
    3434{
    3535        int retval;
    36         __native nat = 0x12345678u;
     36        unative_t nat = 0x12345678u;
    3737       
    3838        char buffer[BUFFER_SIZE];
     
    5050        printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 );
    5151
    52         printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zx'. '%#llx' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" );
     52        printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, unative_t '%#zx'. '%#llx' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" );
    5353       
    5454        printf(" Print to NULL '%s'\n",NULL);
  • test/synch/rwlock4/test.c

    r991779c5 r7f1c620  
    5151static waitq_t can_start;
    5252
    53 __u32 seed = 0xdeadbeef;
     53uint32_t seed = 0xdeadbeef;
    5454
    55 static __u32 random(__u32 max);
     55static uint32_t random(uint32_t max);
    5656
    5757static void writer(void *arg);
     
    5959static void failed(void);
    6060
    61 __u32 random(__u32 max)
     61uint32_t random(uint32_t max)
    6262{
    63         __u32 rc;
     63        uint32_t rc;
    6464
    6565        spinlock_lock(&lock);   
     
    122122{
    123123        context_t ctx;
    124         __u32 i, k;
     124        uint32_t i, k;
    125125       
    126126        printf("Read/write locks test #4\n");
  • test/synch/semaphore2/test.c

    r991779c5 r7f1c620  
    4646static waitq_t can_start;
    4747
    48 __u32 seed = 0xdeadbeef;
     48uint32_t seed = 0xdeadbeef;
    4949
    50 static __u32 random(__u32 max);
     50static uint32_t random(uint32_t max);
    5151
    5252static void consumer(void *arg);
    5353static void failed(void);
    5454
    55 __u32 random(__u32 max)
     55uint32_t random(uint32_t max)
    5656{
    57         __u32 rc;
     57        uint32_t rc;
    5858
    5959        spinlock_lock(&lock);   
     
    9696void test(void)
    9797{
    98         __u32 i, k;
     98        uint32_t i, k;
    9999       
    100100        printf("Semaphore test #2\n");
  • test/sysinfo/test.c

    r991779c5 r7f1c620  
    3434#include <sysinfo/sysinfo.h>
    3535/*
    36 static __native counter(sysinfo_item_t *root)
     36static unative_t counter(sysinfo_item_t *root)
    3737{
    38         static __native i=0;
     38        static unative_t i=0;
    3939        return i++;
    4040}*/
Note: See TracChangeset for help on using the changeset viewer.