first successful boot!
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
[unstable]
|
||||
json-target-spec = true
|
||||
build-std-features = ["compiler-builtins-mem"]
|
||||
build-std = ["core", "compiler_builtins"]
|
||||
|
||||
[build]
|
||||
target = "x86_64-rusty_os.json"
|
||||
|
||||
[target.'cfg(target_os = "none")']
|
||||
runner = "bootimage runner"
|
||||
Generated
+9
@@ -2,6 +2,15 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "bootloader"
|
||||
version = "0.9.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13f6a8a495d2f93fe3d6eb3a224f9aa749a63cfd746ed03eb5ddcbd00ade7d8f"
|
||||
|
||||
[[package]]
|
||||
name = "rust-os-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bootloader",
|
||||
]
|
||||
|
||||
@@ -15,3 +15,4 @@ test=false
|
||||
bench=false
|
||||
|
||||
[dependencies]
|
||||
bootloader = "0.9"
|
||||
|
||||
+11
-2
@@ -3,10 +3,19 @@
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
static HELLO: &[u8] = b"Hello World";
|
||||
|
||||
#[unsafe(no_mangle)] // dont mangle name of this function, keep as-is
|
||||
pub extern "C" fn _start() -> ! {
|
||||
// this is entrypoint function
|
||||
// linker looks for function named _start by default
|
||||
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 {}
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user