diff --git a/hbvm/src/float/mod.rs b/hbvm/src/float/mod.rs index f8b3ea63..5206f702 100644 --- a/hbvm/src/float/mod.rs +++ b/hbvm/src/float/mod.rs @@ -1,13 +1,27 @@ macro_rules! arch_specific { { $({$($cfg:tt)*} : $mod:ident;)* - } => {$( - #[cfg($($cfg)*)] - mod $mod; + } => { + $( + #[cfg($($cfg)*)] + mod $mod; - #[cfg($($cfg)*)] - pub use $mod::*; - )*}; + #[cfg($($cfg)*)] + pub use $mod::*; + + #[cfg($($cfg)*)] + pub const FL_ARCH_SPECIFIC_SUPPORTED: bool = true; + )* + + #[cfg(not(any($($($cfg)*),*)))] + mod unsupported; + + #[cfg(not(any($($($cfg)*),*)))] + pub use unsupported::*; + + #[cfg(not(any($($($cfg)*),*)))] + pub const FL_ARCH_SPECIFIC_SUPPORTED: bool = false; + }; } arch_specific! { diff --git a/hbvm/src/float/unsupported.rs b/hbvm/src/float/unsupported.rs new file mode 100644 index 00000000..8befdd90 --- /dev/null +++ b/hbvm/src/float/unsupported.rs @@ -0,0 +1,16 @@ +use hbbytecode::RoundingMode; + +#[inline(always)] +pub fn conv64to32(_: f64, _: RoundingMode) -> f32 { + f32::NAN +} + +#[inline(always)] +pub fn f32toint(_: f32, _: RoundingMode) -> i64 { + i64::MAX +} + +#[inline(always)] +pub fn f64toint(_: f64, _: RoundingMode) -> i64 { + i64::MAX +} diff --git a/hbvm/src/lib.rs b/hbvm/src/lib.rs index e16c318b..33a9fe2d 100644 --- a/hbvm/src/lib.rs +++ b/hbvm/src/lib.rs @@ -25,6 +25,8 @@ mod float; mod utils; mod vmrun; +pub use float::FL_ARCH_SPECIFIC_SUPPORTED; + use { bmc::BlockCopier, mem::{Address, Memory}, diff --git a/hbxrt/src/main.rs b/hbxrt/src/main.rs index 93a037f6..156cb253 100644 --- a/hbxrt/src/main.rs +++ b/hbxrt/src/main.rs @@ -14,6 +14,17 @@ fn main() -> Result<(), Box> { eprintln!("== HBĂ—RT (Holey Bytes Experimental Runtime) v0.1 =="); eprintln!("[W] Currently supporting only flat images"); + if !hbvm::FL_ARCH_SPECIFIC_SUPPORTED { + eprintln!( + "\ + [W] Architecture not fully supported!\n \ + FTI32, FTI64 will yield {:#x}\n \ + FC64T32 will yield NaN\ + ", + i64::MAX, + ) + } + let mut args = args().skip(1); let Some(image_path) = args.next() else { eprintln!("[E] Missing image path");