From 9169796632fcdeb5e8e74ed60c6cbe31081e51f2 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 24 Feb 2022 23:38:38 -0700 Subject: MMU and working on hardware --- src/sys/core.c | 6 ++++-- src/sys/kernel.S | 16 +++++++++++++--- src/sys/timer.c | 17 ----------------- 3 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 src/sys/timer.c (limited to 'src/sys') diff --git a/src/sys/core.c b/src/sys/core.c index 1ee898c..99c08ae 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -5,12 +5,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include @@ -35,7 +35,7 @@ void sysinit(void) // Get the frequency cntfrq = read_cntfrq(); // Clear cntv interrupt and set next 1 second timer - write_cntv_tval(cntfrq); + write_cntv_tval(cntfrq/100); // Route timer to core0 fiq routing_core0cntv_to_core0fiq(); // Enable timer @@ -47,6 +47,8 @@ void sysinit(void) lfb_init(); lfb_showpicture(); + mmu_init(); + // Start Scheduler init_scheduler(); } diff --git a/src/sys/kernel.S b/src/sys/kernel.S index 654a9a7..23bf6a7 100644 --- a/src/sys/kernel.S +++ b/src/sys/kernel.S @@ -6,13 +6,23 @@ kernel_main: ///https://wiki.osdev.org/ARM_Paging // Query the ID_MMFR0 register - mrc p15, 0, r0, c0, c1, 4 + //mrc p15, 0, r0, c0, c1, 4 bl sysinit + bl status + ldr r2, =ttbr_msg + mov r0, #0 + mov r1, #0 + mov r3, #0xFF00 + bl draw_cstring // Intentional undefined instruction // .word 0xf7f0a000 cpsie aif, #0x10 svc #2 // Start scheduling! -1: +2: wfe - b 1b + b 2b + +.section .data +ttbr_msg: + .asciz "MMU Initialized!" diff --git a/src/sys/timer.c b/src/sys/timer.c deleted file mode 100644 index c8f9922..0000000 --- a/src/sys/timer.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void c_timer(void) -{ - // Reset the counter - write_cntv_tval(cntfrq/CPS); - - status(); -} -- cgit v1.2.1