diff --git a/.cargo/config.toml b/.cargo/config.toml index b9bb421..c24a154 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,9 @@ -[target.'cfg(target_os = "linux")'] -rustflags = ["-C", "link-arg=-nostartfiles"] +[build] +target = "x86_64-julios.json" [unstable] +build-std-features = ["compiler-builtins-mem"] build-std = ["core", "compiler_builtins"] + +[target.'cfg(target_os = "none")'] +runner = "bootimage runner" diff --git a/Cargo.lock b/Cargo.lock index 10a21f1..b6a65b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "bootloader" +version = "0.9.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c452074efc3c0bfb241fb7bc87df04741c7c85e926f6a07c05f8fbd6008240" + [[package]] name = "julios" version = "0.1.0" +dependencies = [ + "bootloader", +] diff --git a/Cargo.toml b/Cargo.toml index 063355c..a889f07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] - +bootloader = "0.9.8" diff --git a/src/main.rs b/src/main.rs index e6c8a6c..ef6fd42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,21 @@ fn panic(_info: &core::panic::PanicInfo) -> ! loop {} } +static HELLO: &[u8] = b"Welcome to the JuliOS"; + #[no_mangle] pub extern "C" fn _start() -> ! { + let vga_buffer: *mut u8 = 0xb8000 as *mut u8; + + for (i, &byte) in HELLO.iter().enumerate() + { + unsafe + { + *vga_buffer.offset(i as isize * 2) = byte; + *vga_buffer.offset(i as isize * 2 + 1) = 0xb; + } + } + loop {} }