summaryrefslogtreecommitdiff
path: root/kernel/src
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src')
-rw-r--r--kernel/src/lib.rs16
-rw-r--r--kernel/src/panic.rs12
2 files changed, 28 insertions, 0 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs
new file mode 100644
index 0000000..bd5a19f
--- /dev/null
+++ b/kernel/src/lib.rs
@@ -0,0 +1,16 @@
+#![no_std]
+
+mod panic;
+
+/// The entrypoint to the kernel. This should be executed by hart0 alone. It performs some early
+/// boot tasks, then wakes up any other harts.
+#[no_mangle]
+pub extern "C" fn hart0_boot() {
+ for byte in "Hello, world!\n".bytes() {
+ unsafe {
+ core::ptr::write_volatile(0x10000000 as *mut u8, byte);
+ }
+ }
+
+ todo!()
+}
diff --git a/kernel/src/panic.rs b/kernel/src/panic.rs
new file mode 100644
index 0000000..ed6e5d4
--- /dev/null
+++ b/kernel/src/panic.rs
@@ -0,0 +1,12 @@
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(_info: &PanicInfo) -> ! {
+ loop {
+ for byte in "panic\n".bytes() {
+ unsafe {
+ core::ptr::write_volatile(0x10000000 as *mut u8, byte);
+ }
+ }
+ }
+}