Changeset cb01e1e in mainline for kernel/test/mm/mapping1.c


Ignore:
Timestamp:
2009-04-04T00:26:27Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a85aebd
Parents:
171f9a1
Message:

use global variable and a macro for silencing tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/mm/mapping1.c

    r171f9a1 rcb01e1e  
    3636#include <debug.h>
    3737
    38 #define PAGE0   0x10000000
    39 #define PAGE1   (PAGE0+PAGE_SIZE)
     38#define PAGE0  0x10000000
     39#define PAGE1  (PAGE0 + PAGE_SIZE)
    4040
    41 #define VALUE0  0x01234567
    42 #define VALUE1  0x89abcdef
     41#define VALUE0  0x01234567
     42#define VALUE1  0x89abcdef
    4343
    44 char * test_mapping1(bool quiet)
     44char *test_mapping1(void)
    4545{
    4646        uintptr_t frame0, frame1;
    4747        uint32_t v0, v1;
    48 
     48       
    4949        frame0 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
    5050        frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
    5151       
    52         if (!quiet)
    53                 printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
     52        TPRINTF("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
    5453        *((uint32_t *) frame0) = VALUE0;
    55         if (!quiet)
    56                 printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
     54       
     55        TPRINTF("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
    5756        *((uint32_t *) frame1) = VALUE1;
    5857       
    59         if (!quiet)
    60                 printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
     58        TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
    6159        page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
    62         if (!quiet)
    63                 printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));   
     60       
     61        TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));
    6462        page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
    6563       
    6664        v0 = *((uint32_t *) PAGE0);
    6765        v1 = *((uint32_t *) PAGE1);
    68         if (!quiet) {
    69                 printf("Value at virtual address %p is %#x.\n", PAGE0, v0);
    70                 printf("Value at virtual address %p is %#x.\n", PAGE1, v1);
    71         }
     66        TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, v0);
     67        TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, v1);
    7268       
    7369        if (v0 != VALUE0)
     
    7672                return "Value at v1 not equal to VALUE1";
    7773       
    78         if (!quiet)
    79                 printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
     74        TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE0);
    8075        *((uint32_t *) PAGE0) = 0;
    81         if (!quiet)
    82                 printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
    83         *((uint32_t *) PAGE1) = 0;     
    84 
     76       
     77        TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE1);
     78        *((uint32_t *) PAGE1) = 0;
     79       
    8580        v0 = *((uint32_t *) PAGE0);
    8681        v1 = *((uint32_t *) PAGE1);
    8782       
    88         if (!quiet) {
    89                 printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); 
    90                 printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
    91         }
    92 
     83        TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0));
     84        TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
     85       
    9386        if (v0 != 0)
    9487                return "Value at v0 not equal to 0";
     
    9689                return "Value at v1 not equal to 0";
    9790       
    98         return NULL;   
     91        return NULL;
    9992}
Note: See TracChangeset for help on using the changeset viewer.