basic x86_64 gamarjoba munde

Writes "Gamarjoba, munde!" to the VGA text buffer
This commit is contained in:
Greg Shuflin
2022-02-09 23:38:25 -08:00
parent d504aa2a6d
commit 95c8480aac
5 changed files with 49 additions and 6 deletions

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,22 @@ fn panic(_info: &PanicInfo) -> ! {
loop {}
}
static GAMARJOBA: &[u8] = b"Gamarjoba, munde!";
#[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) = 0xb;
}
}
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"
}