From b9db05978f6c7d5f3df98c661caba534c9e59c59 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Thu, 2 Dec 2021 08:56:10 +0100 Subject: [PATCH] BREAKING: bootloader refacto and loading star Signed-off-by: Julien CLEMENT --- Makefile | 2 +- src/{ => boot}/boot.asm | 0 src/{ => boot}/multiboot.asm | 0 src/lib.rs | 16 +++++++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) rename src/{ => boot}/boot.asm (100%) rename src/{ => boot}/multiboot.asm (100%) diff --git a/Makefile b/Makefile index 80f7cab..337f6f3 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ INSTALL_ROOT = iso ABS_INSTALL = $(abspath $(INSTALL_ROOT)) LINKER_SCRIPT = src/linker.ld -BOOT_OBJS = src/multiboot.o src/boot.o +BOOT_OBJS = src/boot/multiboot.o src/boot/boot.o LIB_JULIOS = target/x86_64-julios/debug/libjulios.a GRUB_CFG = grub/grub.cfg diff --git a/src/boot.asm b/src/boot/boot.asm similarity index 100% rename from src/boot.asm rename to src/boot/boot.asm diff --git a/src/multiboot.asm b/src/boot/multiboot.asm similarity index 100% rename from src/multiboot.asm rename to src/boot/multiboot.asm diff --git a/src/lib.rs b/src/lib.rs index 4a4742d..2eb77d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,11 +9,14 @@ fn panic(_info: &core::panic::PanicInfo) -> ! static HELLO: &[u8] = b"Welcome to the JuliOS"; +static STAR: &[u8] = b"|/-\\"; + #[no_mangle] pub extern "C" fn julios_main() -> ! { let vga_buffer: *mut u8 = 0xb8000 as *mut u8; + let mut k: usize = 0; for (i, &byte) in HELLO.iter().enumerate() { unsafe @@ -21,7 +24,18 @@ pub extern "C" fn julios_main() -> ! *vga_buffer.offset(i as isize * 2) = byte; *vga_buffer.offset(i as isize * 2 + 1) = 0xb; } + k = i * 2 + 2; } - loop {} + let mut j: usize = 0; + loop + { + unsafe + { + *vga_buffer.offset(k as isize) = STAR[j]; + *vga_buffer.offset(k as isize + 1) = 0xb; + j += 1; + j %= 4; + } + } }