initial commit uwu

This commit is contained in:
anna 2023-05-19 07:24:18 +02:00
commit ed4c57a773
Signed by: fef
GPG key ID: 2585C2DC6D79B485
8 changed files with 106 additions and 0 deletions

6
.cargo/config.toml Normal file
View file

@ -0,0 +1,6 @@
[build]
target = "config/x86-pc-none.json"
[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins"]

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/.idea
/.vscode
/target
# raw disk files used for development
/*.img

7
Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bussy"
version = "0.1.0"

10
Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "bussy"
version = "0.1.0"
edition = "2021"
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"

28
config/stage0.ld Normal file
View file

@ -0,0 +1,28 @@
OUTPUT_FORMAT(elf32-i386)
ENTRY(_start)
SECTIONS {
. = 0x7c00;
.text : {
*(.text .text.*)
}
.data : {
*(.data .data.*)
}
.rodata : {
*(.rodata)
}
. = 0x7db8;
.header : {
KEEP(*(.header))
}
. = 0x7e00;
.bss(NOLOAD) : {
*(.bss .bss.*)
}
}

21
config/x86-pc-none.json Normal file
View file

@ -0,0 +1,21 @@
{
"arch": "x86",
"cpu": "i386",
"data-layout": "e-m:e-i32:32-f80:128-n8:16:32-S128-p:32:32",
"dynamic-linking": false,
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"llvm-target": "i386-pc-none",
"max-atomic-width": 64,
"position-independent-executables": false,
"disable-redzone": true,
"target-c-int-width": "32",
"target-pointer-width": "32",
"target-endian": "little",
"panic-strategy": "abort",
"os": "none",
"vendor": "pc",
"relocation-model": "static",
"features": "-sse,-mmx,+soft-float"
}

4
rust-toolchain.toml Normal file
View file

@ -0,0 +1,4 @@
[toolchain]
channel = "nightly"
components = ["rustfmt", "clippy", "rust-src", "llvm-tools-preview"]
targets = ["x86-pc-none"]

24
src/main.rs Normal file
View file

@ -0,0 +1,24 @@
#![no_std]
#![no_main]
use core::arch::asm;
use core::panic::PanicInfo;
#[no_mangle]
pub extern "C" fn main() -> ! {
panic!();
}
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
unsafe {
asm!(
"1: cli",
" hlt",
" jmp 1b", // NMI may resume the CPU or something, idk
options(att_syntax)
);
}
unreachable!()
}