aboutsummaryrefslogtreecommitdiff
path: root/demo_functionality.c
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-31 11:05:46 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-31 11:05:46 +0100
commit455408524009bf6f62867b00bd5d6580bf79f3f0 (patch)
tree38c2e6b8b1bd0a07cd0c43f378a8fa65cdb1d0f9 /demo_functionality.c
parent8025e6b92a09fcf584c13fea3f04f2a0be9cbe64 (diff)
downloadrpi-MMU-example-455408524009bf6f62867b00bd5d6580bf79f3f0.tar.gz
rpi-MMU-example-455408524009bf6f62867b00bd5d6580bf79f3f0.zip
use memcpy()
Diffstat (limited to 'demo_functionality.c')
-rw-r--r--demo_functionality.c12
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");
}