Changeset dd0c8a0 in mainline for kernel/test/mm/mapping1.c
- Timestamp:
- 2013-09-29T06:56:33Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9bd960d
- Parents:
- 3deb0155 (diff), 13be2583 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/mapping1.c
r3deb0155 rdd0c8a0 41 41 const char *test_mapping1(void) 42 42 { 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); 47 44 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, 51 46 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 52 47 TPRINTF("Virtual address %p mapped to physical address %p.\n", 53 48 (void *) page0, (void *) frame); 54 page1 = km_map(frame, FRAME_SIZE, 49 50 uintptr_t page1 = km_map(frame, FRAME_SIZE, 55 51 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 56 52 TPRINTF("Virtual address %p mapped to physical address %p.\n", 57 53 (void *) page1, (void *) frame); 58 54 59 for ( i = 0; i < 2; i++) {55 for (unsigned int i = 0; i < 2; i++) { 60 56 TPRINTF("Writing magic using the first virtual address.\n"); 61 57 62 58 *((uint32_t *) page0) = TEST_MAGIC; 63 59 64 60 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 68 64 if (v != TEST_MAGIC) { 69 65 km_unmap(page0, PAGE_SIZE); 70 66 km_unmap(page1, PAGE_SIZE); 71 frame_free(frame );67 frame_free(frame, 1); 72 68 return "Criss-cross read does not match the value written."; 73 69 } 74 70 75 71 TPRINTF("Writing zero using the second virtual address.\n"); 76 72 77 73 *((uint32_t *) page1) = 0; 78 74 79 75 TPRINTF("Reading zero using the first virtual address.\n"); 80 76 81 77 v = *((uint32_t *) page0); 82 78 83 79 if (v != 0) { 84 80 km_unmap(page0, PAGE_SIZE); 85 81 km_unmap(page1, PAGE_SIZE); 86 frame_free(frame );82 frame_free(frame, 1); 87 83 return "Criss-cross read does not match the value written."; 88 84 } 89 85 } 90 86 91 87 km_unmap(page0, PAGE_SIZE); 92 88 km_unmap(page1, PAGE_SIZE); 93 frame_free(frame );89 frame_free(frame, 1); 94 90 95 91 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.