Subversion Repositories HelenOS

Rev

Rev 2050 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2050 Rev 2053
Line 46... Line 46...
46
    uintptr_t frame0, frame1;
46
    uintptr_t frame0, frame1;
47
    uint32_t v0, v1;
47
    uint32_t v0, v1;
48
 
48
 
49
    frame0 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
49
    frame0 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
50
    frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
50
    frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
51
 
51
   
-
 
52
    if (!quiet)
52
    printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
53
        printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
53
    *((uint32_t *) frame0) = VALUE0;
54
    *((uint32_t *) frame0) = VALUE0;
-
 
55
    if (!quiet)
54
    printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
56
        printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
55
    *((uint32_t *) frame1) = VALUE1;
57
    *((uint32_t *) frame1) = VALUE1;
56
   
58
   
-
 
59
    if (!quiet)
57
    printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
60
        printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
58
    page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
61
    page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
-
 
62
    if (!quiet)
59
    printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));  
63
        printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));  
60
    page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
64
    page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
61
   
65
   
-
 
66
    v0 = *((uint32_t *) PAGE0);
-
 
67
    v1 = *((uint32_t *) PAGE1);
-
 
68
    if (!quiet) {
62
    printf("Value at virtual address %p is %#x.\n", PAGE0, v0 = *((uint32_t *) PAGE0));
69
        printf("Value at virtual address %p is %#x.\n", PAGE0, v0);
63
    printf("Value at virtual address %p is %#x.\n", PAGE1, v1 = *((uint32_t *) PAGE1));
70
        printf("Value at virtual address %p is %#x.\n", PAGE1, v1);
-
 
71
    }
64
   
72
   
65
    if (v0 != VALUE0)
73
    if (v0 != VALUE0)
66
        return "Value at v0 not equal to VALUE0";
74
        return "Value at v0 not equal to VALUE0";
67
    if (v1 != VALUE1)
75
    if (v1 != VALUE1)
68
        return "Value at v1 not equal to VALUE1";
76
        return "Value at v1 not equal to VALUE1";
69
 
77
   
-
 
78
    if (!quiet)
70
    printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
79
        printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
71
    *((uint32_t *) PAGE0) = 0;
80
    *((uint32_t *) PAGE0) = 0;
-
 
81
    if (!quiet)
72
    printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
82
        printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
73
    *((uint32_t *) PAGE1) = 0; 
83
    *((uint32_t *) PAGE1) = 0; 
74
 
84
 
75
    v0 = *((uint32_t *) PAGE0);
85
    v0 = *((uint32_t *) PAGE0);
76
    v1 = *((uint32_t *) PAGE1);
86
    v1 = *((uint32_t *) PAGE1);
77
   
87
   
-
 
88
    if (!quiet) {
78
    printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); 
89
        printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); 
79
    printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
90
        printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
-
 
91
    }
80
 
92
 
81
    if (v0 != 0)
93
    if (v0 != 0)
82
        return "Value at v0 not equal to 0";
94
        return "Value at v0 not equal to 0";
83
    if (v1 != 0)
95
    if (v1 != 0)
84
        return "Value at v1 not equal to 0";
96
        return "Value at v1 not equal to 0";