From cee9a17f90e0fe60859e6887edaa7238b6e96d03 Mon Sep 17 00:00:00 2001 From: Within Date: Wed, 23 Oct 2019 23:26:47 -0400 Subject: [PATCH] h --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/hack.rs | 20 ++++++++++++++++++++ src/main.rs | 2 ++ x86_64-xe_os.json | 4 +++- 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/hack.rs diff --git a/Cargo.lock b/Cargo.lock index 088632a..be23778 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -33,6 +33,11 @@ name = "cast" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "compiler_builtins" +version = "0.1.19" +source = "git+https://github.com/rust-lang/compiler-builtins#462b73c1fe1f67a62223a3ccf830f02a2571c016" + [[package]] name = "cpuio" version = "0.2.0" @@ -174,6 +179,7 @@ name = "xe_os" version = "0.1.0" dependencies = [ "bootloader 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.19 (git+https://github.com/rust-lang/compiler-builtins)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked_list_allocator 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -192,6 +198,7 @@ dependencies = [ "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum bootloader 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abfbe6cdea6367860818facc8e4a184f003cb83d7d004acaaf57baebf1949da0" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" +"checksum compiler_builtins 0.1.19 (git+https://github.com/rust-lang/compiler-builtins)" = "" "checksum cpuio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22b8e308ccfc5acf3b82f79c0eac444cf6114cb2ac67a230ca6c177210068daa" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" diff --git a/Cargo.toml b/Cargo.toml index 6a45572..05f5e23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ pic8259_simple = "0.1.1" pc-keyboard = "0.3.1" linked_list_allocator = "0.6.4" wasmi = {version = "*", default-features=false, features = ["core"]} +compiler_builtins = { git = "https://github.com/rust-lang/compiler-builtins" } [patch.crates-io] wasmi = { path = "/Users/within/Code/xeos_forks/wasmi" } diff --git a/src/hack.rs b/src/hack.rs new file mode 100644 index 0000000..30a7868 --- /dev/null +++ b/src/hack.rs @@ -0,0 +1,20 @@ +#[no_mangle] +extern "C" fn fmod(x: f64, _y: f64) -> f64 { x } + +#[no_mangle] +extern "C" fn fmodf(x: f32, _y: f32) -> f32 { x } + +#[no_mangle] +extern "C" fn fmin(x: f64, _y: f64) -> f64 { x } + +#[no_mangle] +extern "C" fn fminf(x: f32, _y: f32) -> f32 { x } + +#[no_mangle] +extern "C" fn fmax(x: f64, _y: f64) -> f64 { x } + +#[no_mangle] +extern "C" fn fmaxf(x: f32, _y: f32) -> f32 { x } + +#[no_mangle] +extern "C" fn __truncdfsf2(x: f64) -> f32 { 0.0 } diff --git a/src/main.rs b/src/main.rs index 9d12d39..3ace6b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ #![reexport_test_harness_main = "test_main"] extern crate alloc; +mod hack; use bootloader::{entry_point, BootInfo}; use core::panic::PanicInfo; @@ -18,6 +19,7 @@ use wasmi::{ entry_point!(kernel_main); fn kernel_main(boot_info: &'static BootInfo) -> ! { + println!("booted"); xe_os::init(&boot_info); println!("Hello World{}", "!"); diff --git a/x86_64-xe_os.json b/x86_64-xe_os.json index c1c29f9..fb14fbf 100644 --- a/x86_64-xe_os.json +++ b/x86_64-xe_os.json @@ -11,5 +11,7 @@ "linker": "rust-lld", "panic-strategy": "abort", "disable-redzone": true, + "no-compiler-rt": true, + "no-default-libraries": true, "features": "-mmx,-sse,+soft-float" - } \ No newline at end of file + }