Compare commits

...

2 Commits

Author SHA1 Message Date
Greg Shuflin
3ef8cbbf8c Add os runner to justfile 2022-02-09 23:41:17 -08:00
Greg Shuflin
95c8480aac basic x86_64 gamarjoba munde
Writes "Gamarjoba, munde!" to the VGA text buffer
2022-02-09 23:38:25 -08:00
6 changed files with 56 additions and 6 deletions

View File

@@ -1,6 +1,12 @@
default:
just --list
execute_rust_os:
#!/usr/bin/env bash
cd os-in-rust
cargo bootimage
qemu-system-x86_64 -drive format=raw,file=target/x86_64_target/debug/bootimage-os-in-rust.bin
run_gamarjoba: build_gamarjoba
./gamarjoba_munde/gamarjoba

View File

@@ -0,0 +1,6 @@
[unstable]
build-std = ["core", "compiler_builtins"]
build-std-features = ["compiler-builtins-mem"]
[build]
target = "x86_64_target.json"

9
os-in-rust/Cargo.lock generated
View File

@@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "bootloader"
version = "0.9.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62c8f6168cd106687ee36a2b71a46c4144d73399f72814104d33094b8092fd2"
[[package]]
name = "os-in-rust"
version = "0.1.0"
dependencies = [
"bootloader",
]

View File

@@ -5,10 +5,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
[dependencies]
#bootloader = "0.10.12"
bootloader = "0.9.8"

View File

@@ -8,8 +8,23 @@ fn panic(_info: &PanicInfo) -> ! {
loop {}
}
static GAMARJOBA: &[u8] = b"Gamarjoba, MVNDE!";
#[no_mangle]
pub extern "C" fn _start() -> ! {
let vga_buffer = 0xb8000 as *mut u8;
for (i, &byte) in GAMARJOBA.iter().enumerate() {
let i = i as isize;
unsafe {
*vga_buffer.offset(i * 2) = byte;
*vga_buffer.offset(i * 2 + 1) = 0xd;
}
}
loop {}
}

View File

@@ -0,0 +1,18 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}