add stage1 skeleton

main
anna 12 months ago
parent 343512ee2f
commit fb36d1f949
Signed by: fef
GPG Key ID: 2585C2DC6D79B485

6
Cargo.lock generated

@ -4,4 +4,8 @@ version = 3
[[package]]
name = "bussy"
version = "0.1.0"
version = "0.1.0"
[[package]]
name = "bussy-stage1"
version = "0.1.0"

@ -1,10 +1,30 @@
[package]
name = "bussy"
version = "0.1.0"
edition = "2021"
version.workspace = true
repository.workspace = true
[workspace]
members = [
"stage1"
]
[workspace.package]
version = "0.1.0"
repository = "https://git.bsd.gay/fef/bussy"
[profile.dev]
panic = "abort"
opt-level = "s"
lto = true
codegen-units = 1
debug = true
overflow-checks = true
[profile.release]
panic = "abort"
opt-level = "s"
lto = true
codegen-units = 1
debug = true
overflow-checks = false

7
stage1/Cargo.lock generated

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

@ -0,0 +1,5 @@
[package]
name = "bussy-stage1"
edition = "2021"
version.workspace = true
repository.workspace = true

@ -0,0 +1,8 @@
use std::path::Path;
fn main() {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let ld_script_path = manifest_dir.join("stage1.ld");
println!("cargo:rustc-link-arg=--script={}", ld_script_path.display());
}

@ -0,0 +1,19 @@
#![no_std]
#![no_main]
use core::arch::asm;
use core::panic::PanicInfo;
#[no_mangle]
pub extern "C" fn main() -> ! {
loop {}
}
#[panic_handler]
pub fn rust_panic(_info: &PanicInfo) -> ! {
loop {
unsafe {
asm!("cli", "hlt");
}
}
}

@ -0,0 +1,32 @@
OUTPUT_FORMAT(elf32-i386)
ENTRY(_start)
SECTIONS {
. = 0x0500;
_stage1_start = .;
.header : {
KEEP(*(.header))
}
.text : ALIGN(8) {
*(.text .text.*)
}
.data : ALIGN(8) {
*(.data .data.*)
}
.rodata : ALIGN(8) {
*(.rodata .rodata.*)
}
_stage1_end = .;
.bss(NOLOAD) : ALIGN(8) {
_bss_start = .;
*(.bss .bss.*)
_bss_end = .;
}
}
Loading…
Cancel
Save