summaryrefslogtreecommitdiff
path: root/bootle/src
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-03-06 16:53:18 +0100
committerandromeda <andromeda@lenovo>2026-03-06 16:53:18 +0100
commitd35463e1959cb64828c3166527b06e4a79cbea5e (patch)
tree65017b84447f63eaaac8326c6d18f5c5e34e6bac /bootle/src
parentfdf5bb9daf8574b7f993e2e38e400c35aedc3b96 (diff)
reorganise
Diffstat (limited to 'bootle/src')
-rw-r--r--bootle/src/lib.rs55
-rw-r--r--bootle/src/linker.ld8
2 files changed, 63 insertions, 0 deletions
diff --git a/bootle/src/lib.rs b/bootle/src/lib.rs
new file mode 100644
index 0000000..adc1aab
--- /dev/null
+++ b/bootle/src/lib.rs
@@ -0,0 +1,55 @@
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[unsafe(no_mangle)]
+pub extern "C" fn _start() -> ! {
+ welcome_serial();
+ halt()
+}
+
+fn print_serial(s: &str) {
+ let mut bytes = s.bytes();
+ while let Some(b) = bytes.next() {
+ unsafe {
+ core::arch::asm!(
+ "out dx, al"
+ , in("al") b
+ )
+ };
+ }
+}
+
+fn println_serial(s: &str) {
+ print_serial(s);
+ print_serial("\n");
+}
+
+fn welcome_serial() {
+ print_serial(ANSI_PINK);
+ println_serial("\nWelcome to Bootle OS");
+ println_serial("All code GPL licensed and freely available on git.mtgmonkey.net");
+ print_serial("Enjoy your time! Press ");
+ print_serial(ANSI_RED);
+ print_serial("ctrl+a x");
+ print_serial(ANSI_PINK);
+ println_serial(" to escape Qemu");
+ print_serial(ANSI_CLEAR);
+}
+
+#[panic_handler]
+fn panic(_: &PanicInfo) -> ! {
+ print_serial("panicked");
+ halt()
+}
+
+fn halt() -> ! {
+ unsafe { core::arch::asm!("hlt") };
+ halt()
+}
+
+const ANSI_CLEAR: &str = "\x1b[0m";
+const ANSI_RED: &str = "\x1b[31m";
+const ANSI_PINK: &str = "\x1b[35m";
+const ANSI_GREEN: &str = "\x1b[32m";
diff --git a/bootle/src/linker.ld b/bootle/src/linker.ld
new file mode 100644
index 0000000..b523bc5
--- /dev/null
+++ b/bootle/src/linker.ld
@@ -0,0 +1,8 @@
+SECTIONS
+{
+ . = 0x00010000;
+ .text : {
+ *(.text._start)
+ *(.text*)
+ }
+}