diff options
| author | pravic <[email protected]> | 2017-09-13 07:09:18 +0300 |
|---|---|---|
| committer | pravic <[email protected]> | 2017-09-13 07:09:18 +0300 |
| commit | 9531dbcbfb063cf578fabbcef686ba999c546eec (patch) | |
| tree | 496d1474db14782e96b955073a0f286271e83bd0 /src | |
| parent | examples: test under ReactOS too :) (diff) | |
| download | winapi-kmd-rs-9531dbcbfb063cf578fabbcef686ba999c546eec.tar.xz winapi-kmd-rs-9531dbcbfb063cf578fabbcef686ba999c546eec.zip | |
tweak: Update CRT for modern Rust.
Diffstat (limited to 'src')
| -rw-r--r-- | src/crt.rs | 61 | ||||
| -rw-r--r-- | src/lib.rs | 1 |
2 files changed, 26 insertions, 36 deletions
@@ -35,52 +35,41 @@ pub static __security_cookie: usize = 0x00002B992DDFA232; #[doc(hidden)] pub mod rust_intrinsics { + #![allow(unused_variables)] + // Idk why, but linker cannot find `_memcmp` for llvm intrinsics. So lets make forward one. #[no_mangle] - pub unsafe extern fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 { + pub unsafe fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 { return ::crt::memcmp(s1, s2, n); } // ported from compiler-rt + // pub fn __muldi3(a: u64, b: u64) -> u64 { + // unimplemented!(); + // } + #[no_mangle] - pub unsafe extern fn __mulodi4(a: i64, b: i64, overflow: &mut i32) -> i64 { - const N: i32 = 64; - const MIN: i64 = 1 << (N-1); - const MAX: i64 = !MIN; - *overflow = 0; + pub fn __mulodi4(a: i64, b: i64, overflow: &mut i32) -> i64 { + unimplemented!(); + } - let result = a * b; - if a == MIN { - if b != 0 && b != 1 { - *overflow = 1; - } - return result; - } + #[no_mangle] + pub extern "C" fn __multi3(a: i128, b: i128) -> i128 { + unimplemented!(); + } - if b == MIN { - if a != 0 && a != 1 { - *overflow = 1; - } - return result; - } + #[no_mangle] + pub extern fn __muloti4(a: i128, b: i128, oflow: &mut i32) -> i128 { + unimplemented!(); + } - let sa = a >> (N-1); - let sb = b >> (N-1); - let abs_a = (a ^ sa) - sa; - let abs_b = (b ^ sb) - sb; + #[no_mangle] + pub extern "C" fn __udivti3(n: u128, d: u128) -> u128 { + unimplemented!(); + } - if abs_a < 2 || abs_b < 2 { - return result; - } - if sa == sb { - if abs_a > MAX / abs_b { - *overflow = 1; - } - } else { - if abs_a > MIN / -abs_b { - *overflow = 1; - } - } - return result; + #[no_mangle] + pub extern "C" fn __umodti3(n: u128, d: u128) -> u128 { + unimplemented!(); } } @@ -3,6 +3,7 @@ #![feature(lang_items)] #![feature(on_unimplemented, fundamental)] #![feature(no_core)] +#![feature(i128_type)] #![no_std] #![allow(bad_style)] |