Skip to content
Snippets Groups Projects
Commit a7ef6491 authored by Paul Weiß (Poohl)'s avatar Paul Weiß (Poohl)
Browse files

Not 1:1 mapping

parent a03a7ffd
Branches
No related tags found
No related merge requests found
...@@ -13,10 +13,13 @@ char intro[] = ...@@ -13,10 +13,13 @@ char intro[] =
"3: Execute Kernel code\r\n" "3: Execute Kernel code\r\n"
"4: Write own code\r\n" "4: Write own code\r\n"
"5: Stackoverflow\r\n" "5: Stackoverflow\r\n"
"6: read undefined memeory\r\n"; "6: read undefined memeory\r\n"
"7: Access Sram that was mapped to undef (abort)\r\n"
"8: Access Undef (abort) that was mapped to sram\r\n";
__attribute__ ((section (".usertext"))) int brick_it() { __attribute__ ((section (".usertext"))) int brick_it() {
for (int i = 0; i < 190; ++i) while (1) {
for (int i = 0; i < 287; ++i)
sys_debug_put_char(intro[i]); sys_debug_put_char(intro[i]);
volatile u32 test; volatile u32 test;
switch (sys_debug_get_char()) { switch (sys_debug_get_char()) {
...@@ -56,7 +59,14 @@ __attribute__ ((section (".usertext"))) int brick_it() { ...@@ -56,7 +59,14 @@ __attribute__ ((section (".usertext"))) int brick_it() {
); );
break; break;
case '6': case '6':
test = *((u32*) UNDEF_MEMORY1 + 200); test = *((u32*) (UNDEF_MEMORY1 + MEGABYTE + 200));
break; break;
case '7':
test = *((u32*) (EXTERNAL_SRAM + 17*MEGABYTE));
break;
case '8':
test = *((u32*) (UNDEF_MEMORY1));
break;
}
} }
} }
\ No newline at end of file
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#define INTERNAL_SRAM 0x200000 #define INTERNAL_SRAM 0x200000
#define MEGABYTE 0x100000
#define EXTERNAL_SRAM 0x20000000 #define EXTERNAL_SRAM 0x20000000
#define PROCESS_STACKS 0x20200000 #define PROCESS_STACKS 0x20200000
#define UNDEF_MEMORY1 0x90000000 #define UNDEF_MEMORY1 0x90000000
......
...@@ -21,6 +21,8 @@ void init_first_level_pagetable() { ...@@ -21,6 +21,8 @@ void init_first_level_pagetable() {
for (uint i = 0; i < 63; ++i) { for (uint i = 0; i < 63; ++i) {
l1table.desc[userland_desc + 1 + i] |= (AP_RW_RW << 10); l1table.desc[userland_desc + 1 + i] |= (AP_RW_RW << 10);
} }
l1table.desc[(EXTERNAL_SRAM + 17*MEGABYTE) >> 20] = (UNDEF_MEMORY1) | (AP_RW_RW << 10) | 0b10;
l1table.desc[(UNDEF_MEMORY1) >> 20] = (EXTERNAL_SRAM + 17*MEGABYTE) | (AP_RW_RW << 10) | 0b10;
} }
void init_mmu() { void init_mmu() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment