aboutsummaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-28 21:54:42 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-28 21:54:42 +0100
commit700f4c412d42c9b9811269045c0e363a0331bba9 (patch)
tree260feed1ca657843d993c1ae73e93f25a17cede1 /setup.c
parent80c9af17330ac442a4c3d6d55b4041cbe923e9b4 (diff)
downloadrpi-MMU-example-700f4c412d42c9b9811269045c0e363a0331bba9.tar.gz
rpi-MMU-example-700f4c412d42c9b9811269045c0e363a0331bba9.zip
split kernel into 2 stages; second stage gets copied to 0x0 and runs from there
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/setup.c b/setup.c
new file mode 100644
index 0000000..48df825
--- /dev/null
+++ b/setup.c
@@ -0,0 +1,41 @@
+#include "uart.h"
+#include "demo_functionality.h"
+#include "paging.h"
+
+void setup(void)
+{
+ uart_init();
+
+ // When we attach screen session after loading kernel with socat
+ // we miss kernel's greeting... So we'll make the kernel wait for
+ // one char we're going to send from within screen
+ uart_getc();
+
+ uart_puts("Hello, kernel World!\r\n");
+
+ // prints some info
+ demo_paging_support();
+
+ // prints some info
+ demo_current_mode();
+
+ // prints some info and sets upp translation table, turns on MMU
+ setup_flat_map();
+
+ // prints some info and sets up a section for PL0 code,
+ // loads a blob there
+ demo_setup_PL0();
+
+ // jumps to unprivileged code... never, ever, ever returns
+ demo_go_unprivileged();
+
+ while (1)
+ {
+ char c = uart_getc();
+
+ uart_putc(c);
+
+ if (c == '\r')
+ uart_putc('\n');
+ }
+}