aboutsummaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-24 23:38:38 -0700
committerChristian Cunningham <cc@localhost>2022-02-24 23:38:38 -0700
commit9169796632fcdeb5e8e74ed60c6cbe31081e51f2 (patch)
treef9076beb2cbdd4f8cb2677b9be64fa145b0fc3d1 /src/sys
parenta9e89946ad7f6918b954d7416c755a90c0eace9d (diff)
MMU and working on hardware
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/core.c6
-rw-r--r--src/sys/kernel.S16
-rw-r--r--src/sys/timer.c17
3 files changed, 17 insertions, 22 deletions
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 <graphics/drawer.h>
#include <graphics/lfb.h>
#include <lib/kmem.h>
+#include <lib/mmu.h>
#include <lib/strings.h>
#include <symbols.h>
#include <sys/core.h>
#include <sys/power.h>
#include <sys/schedule.h>
-#include <sys/timer.h>
#include <util/mutex.h>
#include <util/time.h>
@@ -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 <drivers/uart.h>
-#include <globals.h>
-#include <graphics/drawer.h>
-#include <sys/core.h>
-#include <sys/timer.h>
-#include <util/mutex.h>
-#include <util/status.h>
-#include <util/time.h>
-#include <symbols.h>
-
-void c_timer(void)
-{
- // Reset the counter
- write_cntv_tval(cntfrq/CPS);
-
- status();
-}