Compare commits
2 Commits
9366d6c90e
...
b2f0b35307
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2f0b35307 | ||
|
|
a0b3d273b2 |
9
.cargo/config.toml
Normal file
9
.cargo/config.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[build]
|
||||||
|
target = "x86_64-simpleos.json"
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
build-std-features = ["compiler-builtins-mem"]
|
||||||
|
build-std = ["core", "compiler_builtins"]
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "none")']
|
||||||
|
runner = "bootimage runner"
|
||||||
@@ -4,3 +4,4 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bootloader = "0.9"
|
||||||
|
|||||||
26
src/main.rs
26
src/main.rs
@@ -1,3 +1,25 @@
|
|||||||
fn main() {
|
#![no_std]
|
||||||
println!("Hello, world!");
|
#![no_main]
|
||||||
|
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
|
static HELLO: &[u8] = b"Hello World!";
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn _start() -> ! {
|
||||||
|
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 {}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(_info: &PanicInfo) -> ! {
|
||||||
|
loop {}
|
||||||
}
|
}
|
||||||
|
|||||||
15
x86_64-simpleos.json
Normal file
15
x86_64-simpleos.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user