summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-03-03 22:01:49 +0100
committerandromeda <andromeda@lenovo>2026-03-03 22:01:49 +0100
commit1b6f76488dcc01c8e6c0efbe07751ebeea18c33b (patch)
treeb1a0c6fb6c60a1716d41cb42670605f24d1f0f17 /src
parentd879df630f68bb56f291ac285f951ca2ba6764e7 (diff)
add rust kernel stub
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs20
-rw-r--r--src/linker.ld8
2 files changed, 28 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..c6cb39e
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,20 @@
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[unsafe(no_mangle)]
+pub extern "C" fn _start() -> ! {
+ // 'k'
+ loop{unsafe {core::arch::asm!(
+ "out dx, al", in("al") 0x6Bu8
+ )}}
+}
+
+#[panic_handler]
+fn panic(_: &PanicInfo) -> ! {
+ // 'p'
+ loop{unsafe {core::arch::asm!(
+ "out dx, al", in("al") 0x70u8
+ )}}
+}
diff --git a/src/linker.ld b/src/linker.ld
new file mode 100644
index 0000000..b523bc5
--- /dev/null
+++ b/src/linker.ld
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ . = 0x00010000;
+ .text : {
+ *(.text._start)
+ *(.text*)
+ }
+}