aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-17 21:49:10 -0700
committerChristian Cunningham <cc@localhost>2022-03-17 21:49:10 -0700
commit15205711b35db0d8ac5516f84ba73fa3550ccc62 (patch)
treee160ef7caaad605b8641548f9569cdc3409ec8b4 /src
parent7943bed3d5e6a803aa022bd237dd365471bb78bc (diff)
Initialize all BSS sections in MMU
Diffstat (limited to 'src')
-rw-r--r--src/lib/mmu.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/mmu.c b/src/lib/mmu.c
index 6a947c5..0a2f892 100644
--- a/src/lib/mmu.c
+++ b/src/lib/mmu.c
@@ -15,11 +15,15 @@ void mmu_section(unsigned long virtual, unsigned long physical, unsigned long fl
*entry = physval;
}
+extern unsigned long __bss_end;
void mmu_init(void)
{
- mmu_section(0x00000000, 0x00000000, CACHABLE | BUFFERABLE);
- for (unsigned long addr = 0x00100000;; addr += 0x00100000) {
- mmu_section(addr, addr, NO_PERMISSIONS_REQUIRED);
+ for (unsigned long addr = 0x00000000;; addr += 0x00100000) {
+ if (addr < (unsigned long)&__bss_end) {
+ mmu_section(addr, addr, CACHABLE | BUFFERABLE);
+ } else {
+ mmu_section(addr, addr, NO_PERMISSIONS_REQUIRED);
+ }
if (addr == 0x02000000)
mmu_section(addr, addr, CACHABLE | BUFFERABLE | NO_PERMISSIONS_REQUIRED);
//else if (addr == 0x3F000000)