it now boots and prints hello world

This commit is contained in:
clizia 2025-08-25 01:47:42 +02:00
parent ff4bbdd263
commit 2f8efad24a
4 changed files with 38 additions and 1 deletions

9
.cargo/config.toml Normal file
View file

@ -0,0 +1,9 @@
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]
[build]
target = "x86_64-totos.json"
[target.'cfg(target_os = "none")']
runner = "bootimage runner"

View file

@ -15,3 +15,4 @@ panic = "abort" # disable stack unwinding on panic
panic = "abort" # disable stack unwinding on panic
[dependencies]
bootloader = "0.9"

View file

@ -3,11 +3,22 @@
use core::panic::PanicInfo;
static HELLO: &[u8] = b"Hello toto :3";
// this function is the entry point since the linker
// looks for a function named `_start` by default
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
loop{}
let vga_buffer = 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 {}
}
// called on panic

16
x86_64-totos.json Normal file
View file

@ -0,0 +1,16 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-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",
"rustc-abi": "x86-softfloat"
}