Initial commit

This commit is contained in:
Quinten Kock 2020-07-19 04:08:10 +02:00
commit a583fa241d
6 changed files with 68 additions and 0 deletions

5
.cargo/config Normal file
View File

@ -0,0 +1,5 @@
[build]
target = "x86_64-fefos.json"
[target.'cfg(target_os = "none")']
runner = "bootimage runner"

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

14
Cargo.lock generated Normal file
View File

@ -0,0 +1,14 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "bootloader"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7239572eacd7c74ac0d6c75eb87a615058d6497a667728694e0d32b7bd5a20"
[[package]]
name = "fefos"
version = "0.1.0"
dependencies = [
"bootloader",
]

10
Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
name = "fefos"
version = "0.1.0"
authors = ["Quinten Kock <quinten@quinten.space>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bootloader = "0.9.3"

23
src/main.rs Normal file
View File

@ -0,0 +1,23 @@
#![no_std]
#![no_main]
static HELLO: &[u8] = b"Hello Rust!";
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
#[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 {}
}

15
x86_64-fefos.json Normal file
View File

@ -0,0 +1,15 @@
{
"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"
}