diff options
-rw-r--r-- | demo_functionality.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/demo_functionality.c b/demo_functionality.c index 2db40f8..051ffd6 100644 --- a/demo_functionality.c +++ b/demo_functionality.c @@ -3,6 +3,7 @@ #include "memory.h" #include "translation_table_descriptors.h" #include "ramfs.h" +#include "strings.h" void demo_paging_support(void) { @@ -97,17 +98,14 @@ void demo_setup_PL0(void) // check that translation works... by copying a string using one // mapping and reading it using other :D char message[] = "mapped sections for PL0 code"; - - unsigned int i; - for (i = 0; i < sizeof(message); i++) - ((volatile char*) UNPRIVILEGED_MEMORY_START)[i] = message[i]; + + memcpy((void*) UNPRIVILEGED_MEMORY_START, message, sizeof(message)); puts((char*) VIRTUAL_PL0_MEMORY_START); // now paste a userspace program to that section - for (uint32_t i = 0; i < PL_0_test_img.file_size; i++) - ((volatile char*) VIRTUAL_PL0_MEMORY_START)[i] = - PL_0_test_img.file_contents[i]; + memcpy((void*) VIRTUAL_PL0_MEMORY_START, + PL_0_test_img.file_contents, PL_0_test_img.file_size); puts("copied PL0 code to it's section"); } |