summaryrefslogtreecommitdiff
path: root/src/kernel.c
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-06-11 11:14:40 -0500
committerNathan Lee <me@nwlee.tech>2026-06-11 11:14:40 -0500
commit4d843a5e03c91867614c94829c5255bc067a90c6 (patch)
tree9618e91da3053a51d1fefd8cf69cebddad3df435 /src/kernel.c
initial commit
Diffstat (limited to 'src/kernel.c')
-rw-r--r--src/kernel.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/kernel.c b/src/kernel.c
new file mode 100644
index 0000000..753f4a5
--- /dev/null
+++ b/src/kernel.c
@@ -0,0 +1,20 @@
+#define UART_BASE 0x10000000 // Example UART address
+
+static inline void putchar(char c) {
+ volatile char *uart = (volatile char *)UART_BASE;
+ *uart = c;
+}
+
+static void print_string(const char *str) {
+ while (*str) {
+ putchar(*str++);
+ }
+}
+
+void kernel_main(void) {
+ print_string("Hello from RISC-V kernel!\n");
+
+ while (1) {
+ // Wait
+ }
+}