Changeset 0c2d9bb in mainline for kernel/test/mm/mapping1.c


Ignore:
Timestamp:
2013-12-25T22:54:29Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b51cf2c
Parents:
f7a33de (diff), ac36aed (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.
Message:

merge mainline changes

File:
1 edited

Legend:

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

    rf7a33de r0c2d9bb  
    4141const char *test_mapping1(void)
    4242{
    43         uintptr_t page0, page1;
    44         uintptr_t frame;
    45         uint32_t v;
    46         int i;
     43        uintptr_t frame = frame_alloc(1, FRAME_NONE, 0);
    4744       
    48         frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_NONE);
    49 
    50         page0 = km_map(frame, FRAME_SIZE,
     45        uintptr_t page0 = km_map(frame, FRAME_SIZE,
    5146            PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
    5247        TPRINTF("Virtual address %p mapped to physical address %p.\n",
    5348            (void *) page0, (void *) frame);
    54         page1 = km_map(frame, FRAME_SIZE,
     49       
     50        uintptr_t page1 = km_map(frame, FRAME_SIZE,
    5551            PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
    5652        TPRINTF("Virtual address %p mapped to physical address %p.\n",
    5753            (void *) page1, (void *) frame);
    5854       
    59         for (i = 0; i < 2; i++) {
     55        for (unsigned int i = 0; i < 2; i++) {
    6056                TPRINTF("Writing magic using the first virtual address.\n");
    61 
     57               
    6258                *((uint32_t *) page0) = TEST_MAGIC;
    63 
     59               
    6460                TPRINTF("Reading magic using the second virtual address.\n");
    65 
    66                 v = *((uint32_t *) page1);
    67        
     61               
     62                uint32_t v = *((uint32_t *) page1);
     63               
    6864                if (v != TEST_MAGIC) {
    6965                        km_unmap(page0, PAGE_SIZE);
    7066                        km_unmap(page1, PAGE_SIZE);
    71                         frame_free(frame);
     67                        frame_free(frame, 1);
    7268                        return "Criss-cross read does not match the value written.";
    7369                }
    74 
     70               
    7571                TPRINTF("Writing zero using the second virtual address.\n");
    76        
     72               
    7773                *((uint32_t *) page1) = 0;
    78 
     74               
    7975                TPRINTF("Reading zero using the first virtual address.\n");
    80        
     76               
    8177                v = *((uint32_t *) page0);
    82        
     78               
    8379                if (v != 0) {
    8480                        km_unmap(page0, PAGE_SIZE);
    8581                        km_unmap(page1, PAGE_SIZE);
    86                         frame_free(frame);
     82                        frame_free(frame, 1);
    8783                        return "Criss-cross read does not match the value written.";
    8884                }
    8985        }
    90 
     86       
    9187        km_unmap(page0, PAGE_SIZE);
    9288        km_unmap(page1, PAGE_SIZE);
    93         frame_free(frame);
     89        frame_free(frame, 1);
    9490       
    9591        return NULL;
Note: See TracChangeset for help on using the changeset viewer.